Closed airdrummingfool closed 6 years ago
One thing I've found as I start to set up Home Assistant with the ST/MQTT devices is that if we don't de-dupe incoming user messages (specifically on the command topic), the user must not set retain=true
in hass device configs (the default is retain=false
, so I don't think this is necessarily an issue).
I set it to true
on my first few devices, and each time the bridge re-subscribed to all topics it would receive the last (retained) message for each command topic, and replay it. In my case, that meant my office lights and monitor were turning off every ≈15 minutes or so, which got old very quickly.
Again, since the default is retain=false
, I think we're okay. I just figured it was worth mentioning.
Bravo! Well done on the PR merge! I've been testing this patch on my box and it after making sure my HA configs for each switch were set to retain:false and the persistence option was set to false as well in the MQTT broker. After that it all works like a charm.
Here's an attempt at fixing #133.
We don't want to deduplicate any message that we know is from the user. The only time we don't know for sure that a message is from the user is when it comes from a topic the bridge writes to (i.e. a read topic). The user might also write to a read topic if they haven't set a separate
write
orcommand
topic.This PR simply checks to see if the incoming message is from the read topic, and if so, it deduplicates.