Mqtt: fix setter not cleared

This commit is contained in:
andig 2023-07-18 18:43:34 +02:00
parent b0d2c2f2d1
commit 4b4587a286

View file

@ -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)
}