Mqtt: fix setter not cleared
This commit is contained in:
parent
b0d2c2f2d1
commit
4b4587a286
1 changed files with 2 additions and 1 deletions
|
|
@ -137,7 +137,8 @@ func (m *Client) Listen(topic string, callback func(string)) {
|
|||
|
||||
// ListenSetter creates a /set listener that resets the payload after handling
|
||||
func (m *Client) ListenSetter(topic string, callback func(string) error) {
|
||||
m.Listen(topic+"/set", func(payload string) {
|
||||
topic += "/set"
|
||||
m.Listen(topic, func(payload string) {
|
||||
if err := callback(payload); err != nil {
|
||||
m.log.ERROR.Printf("set %s: %v", topic, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue