Hi Guys,
I am new to HA, this is my first attempt at using it with a SONOFF switch and a raspberry Pi. OK, so I have
them all working with MQTT, node-RED and commands to turn on and off the SONOFF using HA Services,
turn_on and turn_off. However my UI switch, when I click on it, it only turns the SONOFF on, turns to the right
then shortly return left. When I click it again it does not turn the SONOFF off. In other words it does not act as
a toggle switch. I can turn the SONOFF on/off with node-RED injectors. How can I make it into a toggle switch?
This is how it is configured in HA:
It normally does this when it does not receive the MQTT message indicating the state has changed. Do you have the state_command correct? It looks like its missing an e off the end.
This is part of my configuration.yaml
Make sure that the topic in your .yaml matches with the Arduino code: #define MQTT_TOPIC “home/sonoff/living_room/1”
#############################
switch lroom:
platform: mqtt
name: “Living Room”
state_topic: “home/sonoff/living_room/1”
command_topic: “home/sonoff/living_room/1”
qos: 0
payload_on: “on”
payload_off: “off”
optimistic: false
assumed_state: true
retain: true