macjex
October 18, 2017, 9:44am
1
I wanted to integrate my flashed Sonoff switch into my Home assistent.
But I fail to set it up …
Here my configuration.yaml :
switch:
platform: mqtt
name: "bett_schalter"
state_topic: "home/sonoff/bett_schalter/stat"
command_topic: "home/sonoff/bett_schalter/power 1"
payload_on: "on"
payload_off: "off"
retain: true
Here the MQTT Config of the switch:
Host192.168…
Port:1883
User:macjex
Password. xxx
Client bett_schalter
Topic: sonoff
Full Topic:home/%topic%/%prefix%/
Maybe someone can give me a hint
Thanks a lot for any help.
pplucky
(Pplucky)
October 18, 2017, 10:17am
2
Hello.
I think you have something wrong in your config. What I have working is:
light:
- platform: mqtt
name: "Luz Teto - Sonoff"
state_topic: "stat/sonoff/POWER"
command_topic: "cmnd/sonoff/POWER"
qos: 1
payload_on: "ON"
payload_off: "OFF"
retain: true
Try this instead:
switch:
platform: mqtt
name: "bett_schalter"
state_topic: "home/stat/sonoff/POWER"
command_topic: "home/cmnd/sonoff/POWER"
payload_on: "on"
payload_off: "off"
retain: true
You can always run this command on the MQTT server to check what is being received:
mosquitto_sub -v -t '#'
In my case, I get these relevant lines:
tele/sonoff/LWT Online
cmnd/sonoff/POWER OFF
stat/sonoff/POWER OFF
Hope this helps.