Hi
I have been using the basic sonoff with out any problems throughout my home. I decided to grab a sonoff touch and like the basic’s I flash with tasmota firmware. I set up the touch just like the basics,and when switching the touch from the touch panel it works fine and HA DOES show the stat change. If i try to switch from HA , it will show the switch is changing state but the touch never switches and the HA panel goes back to the current state of the touch. Any idea what this could be?
It usually means that the state change is not being propagated back to HA when you switch it in HA, so either it’s taking to long or you have the wrong mqtt topic for the state change. So if the light is also not turning on the the cmnd topic is also wrong
Use the command line subscribe client to see whats really going back and forwards between the two, would be my advice. Or you could paste what you have here from HA and tasmota and we can see if we can work it out
Here is what i have in HA
- platform: mqtt
name: “switch1”
state_topic: “stat/switch1/POWER”
command_topic: “cmnd/switch1/POWER”
qos: 1
payload_on: “ON”
payload_off: “OFF”
retain: true
what i have on the sonoff touch
Isn’t it state/switch1/POWER
?
Yep good catch
It might help if we knew what %prefix%/%topic% were defined as as well
I havnt every defined those and all my sonoffs are labeled like that. Keep in mind I learning as I go, really never found any documentation that defined what each of those meant.
OK, However I think Jorge above is correct your state mqtt topic is wrong, you are missing an ‘e’ it’s probably not stat but state.
I changed it like you suggested but no joy.
state_topic: “state/switch1/POWER”
like so?
and you restarted?
What does the HA mqtt topics look like for the kitchen device?
In theory it should be cmnd or state /kitchen1
so maybe the other one should be state or cmnd / switch1 without the /POWER?
Will this help?
Funny thing about that change … ALL of my “switches” in the config.yaml are like that … I changed the on touch to reflect like you have above waiting for it to reboot. and now HA will not load… hang on.
Wrong link… This one is the correct one
Thanks and yes i have seen this many times, but it just does not make sense. Im a hardware kinda of guy, i like to build the stuff, not program it. Im horrible at programming and understanding it. There is SOOOO many things I want to make and implement not only with HA but my modest homelab also,but programming is my brickwall.
according to the documentation stat is correct
- platform: mqtt
name: "Kitchen LED"
state_topic: "stat/kitchen1/POWER"
command_topic: "cmnd/kitchen1/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
Lol… That’s why this forum exists! Some have the hardware knowledge and others the software knowledge.
Does it still don’t work?
Yeah I get why the forum is here but in the past I have asked for help, not on this site, and got hammered with negative comments and BS about using the search feature ETC. not helpful.
No its still not working.
I think it could be one or two things, either you have more than one device registered with the same device id or the command topic is wrong, so the command is never getting to the switch.
The state topic is correct as you do get a response when using the switch manually, so it has to be the command topic I think.