Can anyone help me understand what’s going on here?
I have two Sonoffs TH 10’s connected to my network and both setup in HA (Hass.io) running on RPI 3B+
Both are visible on the network and can be controlled from the Tasmota GUI.
In HA, I’m having problems with one of the switches. (sonoff_3270).
When I use the toggle button in the HA GUI the Sonoff will turn on and the state in HA changes to ON. However when I try to turn it off again the switch will toggle to the off position and then back on. If I double click the toggle in HA it then turns the switch off.
Mosquitto Log:
1552440657: |-- aclcheck(mymqtt, stat/sonoff_3270/RESULT, 2) CACHEDAUTH: 0
1552440657: |-- mosquitto_auth_acl_check(…, client id not available, mymqtt, stat/sonoff_3270/POWER, MOSQ_ACL_WRITE)
1552440657: |-- aclcheck(mymqtt, stat/sonoff_3270/POWER, 2) CACHEDAUTH: 0
1552440657: |-- mosquitto_auth_acl_check(…, client id not available, mymqtt, cmnd/sonoff_3270/POWER, MOSQ_ACL_WRITE)
1552440657: |-- aclcheck(mymqtt, cmnd/sonoff_3270/POWER, 2) CACHEDAUTH: 0
1552440657: |-- mosquitto_auth_acl_check(…, client id not available, mymqtt, cmnd/sonoff_3270/POWER, MOSQ_ACL_READ)
1552440657: |-- aclcheck(mymqtt, cmnd/sonoff_3270/POWER, 1) CACHEDAUTH: 0
Configuration.yaml
switch:
- platform: mqtt
name: "Garage Light"
state_topic: "tele/sonoff_2763/STATE"
value_template: "{{ value_json.POWER }}"
command_topic: "cmnd/sonoff_2763/POWER"
availability_topic: "tele/sonoff_2763/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
- platform: mqtt
name: "Bedroom Pendants"
state_topic: "tele/sonoff_3270/STATE"
value_template: "{{ value_json.POWER }}"
command_topic: "cmnd/sonoff_3270/POWER"
availability_topic: "tele/sonoff_3270/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
Any help would be appreciated.
first, cuz someone else is going to say it, format your yaml properly. but anywho.
try adding -
state_on: "ON"
state_off: "OFF"
into your configs
I’ve added that to the yaml but doesn’t seem to make a difference.
Seems like it could be an issue with the MQTT broker?
I’ve tried uninstalling and reinstalling the MQTT add-on in the hope that would delete any retained state messages, but that hasn’t changed anything either.
Also tried resetting Tasmota config and re-flashing firmware.
You should be able to go into the tasmota console and see the correct topics. Watch the console while you toggle the light to see if you’re correctly pub’d and sub’d
Thanks,
When i comapre the console data from both Sonoff’s it looks like the problem is that one isn’t sending a return state message to the MQTT broker.
How can I change this so sonoff-3270 publishes it’s state when the toggle button is used in the HA GUI?
Below is the console output from each Sonoff.
sonoff_2763
01:44:59 WIF: Checking connection…
01:44:59 WIF: Connected
01:45:01 SRC: MQTT
01:45:01 RSL: Received Topic cmnd/sonoff_2763/POWER, Data Size 2, Data ON
01:45:01 RSL: Group 0, Index 1, Command POWER, Data ON
01:45:01 MQT: tele/sonoff_2763/STATE = {“Time”:“2019-03-14T01:45:01”,“Uptime”:“0T22:15:47”,“Vcc”:3.498,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“ON”,“Wifi”:{“AP”:1,“SSId”:“[MY WIFI]”,“BSSId”:“FC:EC:DA:E9:CB:9F”,“Channel”:11,“RSSI”:100}}
01:45:01 MQT: stat/sonoff_2763/RESULT = {“POWER”:“ON”}
01:45:01 MQT: stat/sonoff_2763/POWER = ON
01:45:02 CFG: Saved to flash at FA, Count 434, Bytes 3584
sonoff_3270
01:46:25 WIF: Checking connection…
01:46:25 WIF: Connected
01:46:44 SRC: MQTT
01:46:44 RSL: Received Topic cmnd/sonoff_3270/POWER, Data Size 3, Data OFF
01:46:44 RSL: Group 0, Index 1, Command POWER, Data OFF
01:46:44 MQT: stat/sonoff_3270/RESULT = {“POWER”:“OFF”}
01:46:44 MQT: stat/sonoff_3270/POWER = OFF
01:46:44 CFG: Saved to flash at F4, Count 72, Bytes 3584
01:46:45 WIF: Checking connection…
01:46:45 WIF: Connected
It should reply with a state update immediately. You could not be receiving it because of things like incorrect credentials. Also make sure you’re using unique device ids/names.
I personally don’t use the Tasmota topics and switched to my own schema because its easier to understand and follow when things like this happen. Might be something to look into. It makes is so much easier to troubleshoot
Thanks for your help,
I’ve managed to get them both working by enabling discovery in Tasmota (setoption19 ON) and getting rid of the manual configuration.yaml entries.
1 Like