stjohnjohnson / smartthings-mqtt-bridge

Bridge between SmartThings and MQTT
https://hub.docker.com/r/stjohnjohnson/smartthings-mqtt-bridge/
MIT License
367 stars 243 forks source link

Skipping duplicate message appearing in output #44

Open humac opened 8 years ago

humac commented 8 years ago

So i have a fresh install of rasbian on a rpi3 and newly configured mosquito (base config nothing added), smartthings-mqtt-bridge running on node v4.4.7 installed using nvm.

I successfully able to see sensors from ST publish sensor messages to the mqtt broker and i'm able to subscribe to them and see updates. Now I also see the message "Skipping duplicate message .... " appear a lot. Is this normal? What is the reason for this?

an example of this is when I send a on or off payload to one of my switches I see the same message 4 times with one skipped:

info: Incoming message from MQTT: smartthings/Outdoor Back Light/switch = on info: Incoming message from SmartThings: smartthings/Outdoor Back Light/switch = on info: Incoming message from MQTT: smartthings/Outdoor Back Light/switch = on info: Skipping duplicate message from: smartthings/Outdoor Back Light/switch = on info: Incoming message from MQTT: smartthings/Outdoor Back Light/switch = off info: Incoming message from SmartThings: smartthings/Outdoor Back Light/switch = off info: Incoming message from MQTT: smartthings/Outdoor Back Light/switch = off info: Skipping duplicate message from: smartthings/Outdoor Back Light/switch = off

Everything works though so it seems. I just see a lot of messages.

Just want to know if this is as expected.

trymbill commented 8 years ago

I was seeing the same thing and was also curious.

stjohnjohnson commented 8 years ago

Totally normal! We listen to events on MQTT at smartthings/Outdoor Back Light/switch so that you can send change events like off. The problem is, we are not immune to our own messages.

So you sent on to the topic, we heard it and sent it to SmartThings. SmartThings tells us the switch is now on and we send it to the topic. The topic then informs us that the switch is on which is a duplicate.

pir2 commented 6 years ago

What happens when this is related to a sensor that's reporting the same state? It's technically not a duplicate message.

Example:
8am: 80% Humidity 9am: 80% Humidity

Any way to process these "duplicate" messages?