smartthings-mqtt-bridge
smartthings-mqtt-bridge copied to clipboard
MQTT commands don't update the state correctly
I noticed controlling the lights from HA doesn't work reliably and lights states don't sync. After some digging I found that when I send the MQTT commands, the lights turn on but their state is still set to off. Interesting enough, it's not just their MQTT state, their actual state within the SmartThings app is also set to off (while I can see the light is on). Things work fine the other way around (when I switch on/off through ST app). Here's an example config:
- platform: mqtt name: "Office Lamp" state_topic: "smartthings/Office Lamp/switch/state" command_topic: "smartthings/Office Lamp/switch/cmd" brightness_command_topic: "smartthings/Office Lamp/level/cmd" brightness_scale: 100 payload_on: "on" payload_off: "off" optimistic: false qos: 0 retain: true
I don't know if it's related, but if HA is running some lights turn on or off completely randomly.
I am currently dealing with similar issues. My setup was working for a long time without issue whatsoever. At the time I had blanked both "command_topic" and "state_topic", but recently decided to add "cmd" and "state" everywhere. After that I started having all sort of sync issues...with lights even turning on themselves! So I went back to blanks.
Try that in you config: platform: mqtt name: "Office Lamp" state_topic: "smartthings/Office Lamp/switch" command_topic: "smartthings/Office Lamp/switch" brightness_command_topic: "smartthings/Office Lamp/level" brightness_scale: 100 payload_on: "on" payload_off: "off" optimistic: false qos: 0 retain: true
and this in the bridge: "preface": "smartthings", "state_suffix": "", "command_suffix": "",
I have better success this way...
Also, you forgot the "brightness_state_topic"... Either brightness_state_topic: "smartthings/Office Lamp/level" or brightness_state_topic: "smartthings/Office Lamp/level/state" depending of the route you decide to take...
(lol, I just realized this was from Oct 2017!!! Hopefully you got it resolved!! :) )
@damien67 Actually I'm still having the issue (ended up disabling the bridge) so thanks :D I'll update the config and let it run for a few days to see if my smart home is still haunted!
@hoomanb Well, I hope that’s gonna help!! I gotta say that ST is easy and practical, but somewhat limited with automation. I have all my automations written in hass and I does marvelous things!!
I just had a chance to try this. Removing cmd or state from the topic doesn't even work