A question from a completely newbie…
I have an ESPEasy setup with two relays controlled via h/w logic (4013). “state” is referring to current relay state. The rules looks like:
on TurnOn1 do
if [relay1#state]=0
pulse,12,0,100
endif
endOn
on TurnOff1 do
if [relay1#state]=1
pulse,12,0,100
endif
endOn
I’m trying to add this as a switch to HA using MQTT.
If I set the payload to “0” and “1” the state is updated correctly in HA, but I can’t toggle the HW from HA.
switch:
- platform: mqtt
name: "InWall1 Switch a"
state_topic: "/Inwall1/relay1/state"
command_topic: "/Inwall1/cmd"
payload_on: "1"
payload_off: "0"
qos: 0
retain: true
If I set the payload to the required event command, then I can trigger the toggle of the HW but is unable to receive the new state back to HA.
switch:
- platform: mqtt
name: "InWall1 Switch a"
state_topic: "/Inwall1/relay1/state"
command_topic: "/Inwall1/cmd"
payload_on: "event,TurnOn1"
payload_off: "event,TurnOff1"
qos: 0
retain: true
I’ve found other posts referring to binary_sensor but have been unable to get it to work.
How can I solve this?