TedLasso
Executive Member
- Joined
- Feb 23, 2016
- Messages
- 5,257
- Reaction score
- 2,905
To help you out a little this is my log when opening the gate, stopping it and closing it again.
17:15:17 MQT: tele/frontgate/SENSOR = {"Time":"2020-05-25T17:15:17","Switch2":"closed"}
17:15:50 MQT: stat/frontgate/RESULT = {"POWER1":"closed"}
17:15:50 MQT: stat/frontgate/POWER1 = closed (retained)
17:15:50 MQT: cmnd/gatestate/POWER2 = open (retained)
17:15:51 MQT: stat/frontgate/RESULT = {"POWER1":"open"}
17:15:51 MQT: stat/frontgate/POWER1 = open (retained)
17:15:56 MQT: stat/frontgate/RESULT = {"POWER1":"closed"}
17:15:56 MQT: stat/frontgate/POWER1 = closed (retained)
17:15:57 MQT: stat/frontgate/RESULT = {"POWER1":"open"}
17:15:57 MQT: stat/frontgate/POWER1 = open (retained)
17:15:58 MQT: stat/frontgate/RESULT = {"POWER1":"closed"}
17:15:58 MQT: stat/frontgate/POWER1 = closed (retained)
17:15:59 MQT: stat/frontgate/RESULT = {"POWER1":"open"}
17:15:59 MQT: stat/frontgate/POWER1 = open (retained)
17:16:09 MQT: cmnd/gatestate/POWER2 = closed (retained)
and my code for it.
Code:- platform: mqtt name: "Front Gate" state_topic: "cmnd/gatestate/POWER2" command_topic: "cmnd/frontgate/POWER" availability_topic: "tele/frontgate/LWT" payload_open: "ON" payload_close: "ON" payload_stop: "ON" state_open: "open" state_closed: "closed" payload_available: "Online" payload_not_available: "Offline" optimistic: false retain: false
Good chance you also aren't using the cmnd topic for the state in HA.
So, i finally got my SV GPIO14 connected to a mag switch and configured SonoffSV as necessary
But when I use your code in my Hass.IO (in switches.yaml) ... I get the error
Invalid config for [switch.mqtt]: [state_open] is an invalid option for [switch.mqtt]. Check: switch.mqtt->state_open. (See ?, line ?).
Same for the payload _open/close,stop commands:
Invalid config for [switch.mqtt]: [payload_open] is an invalid option for [switch.mqtt]. Check: switch.mqtt->payload_open. (See ?, line ?).
If I comment out the payload and /or state_open/closed lines, hass.io doesn't generate an error.
YAML:
- platform: mqtt
name: "Garage Door"
icon: mdi:garage
state_topic: "stat/SONOFF_Garage/POWER2"
command_topic: "cmnd/SONOFF_Garage/POWER"
availability_topic: "tele/SONOFF_Garage/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
# payload_open: "ON"
# payload_stop: "ON"
# payload_close: "ON"
payload_available: "Online"
payload_not_available: "Offline"
# state_open: "open"
# state_closed: "closed"
optimistic: false
retain: false
What have I done wrong. Using latest Hass.IO .. if it makes a difference
Also what is the YAML code, to make the door work like that i.e. the up/down arrow + stop button

Many thanks
Last edited: