Skip to content

Commit

Permalink
Mqtt: fix setter not cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jul 18, 2023
1 parent b0d2c2f commit 4b4587a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion provider/mqtt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 4b4587a

Please sign in to comment.