Why is this so dam unreliable?

My Tasmota switches will not stay on with HASSIO and MQTT Mosquitto.
I cleared cache, I followed multiple YouTube videos, I upgraded Hass,io (like anyone can keep up with all this buggy releases) and updated MQTT Mosquitto Broker, but EVERYTIME my switch fails to respond within the 10 seconds MQTT requires, Hassio or MQTT or SOMEONE turns it off!
WTF WHY?!? WHY DOES MQTT or HASSIO INSIST ON TURNING OFF THE SWITCH WHEN IT CONNECTS? WTF can’t it just keep whatever state its in???
Its easy to test:
Turn the switch on.
Unplug it
Plug it back in.
The switch comes back on for a few seconds then it gets turned OFF!
And the new MQTT Mosquiito broker log in basically impossible to decipher:

1554262634: |-- url=http://127.0.0.1:8080/superuser 1554262634: |-- data=username=MQTT_USER&password=&topic=&acc=-1&clientid= 1554262634: |-- aclcheck(MQTT_USER, stat/sonoff-3/RESULT, 2) SUPERUSER=Y by http 1554262634: |-- Cached [4753ED566B65D2870871DE40AC80891A57A60F8B] for (client id not available,MQTT_USER,2) 1554262634: |-- mosquitto_auth_acl_check(..., client id not available, MQTT_USER, stat/sonoff-3/POWER, MOSQ_ACL_WRITE) 1554262634: |-- url=http://127.0.0.1:8080/superuser 1554262634: |-- data=username=MQTT_USER&password=&topic=&acc=-1&clientid= 1554262634: |-- aclcheck(MQTT_USER, stat/sonoff-3/POWER, 2) SUPERUSER=Y by http 1554262634: |-- Cached [B96E6A8A40ECABD4103759EE7C59C85058C10E3B] for (client id not available,MQTT_USER,2) 1554262634: |-- mosquitto_auth_acl_check(..., client id not available, homeassistant, stat/sonoff-3/POWER, MOSQ_ACL_READ) 1554262634: |-- url=http://127.0.0.1:8080/superuser 1554262634: |-- data=username=homeassistant&password=&topic=&acc=-1&clientid= 1554262634: |-- aclcheck(homeassistant, stat/sonoff-3/POWER, 1) SUPERUSER=Y by http 1554262634: |-- Cached [6DC5916D9B87DF7D313128D21C8E2037BAD251EF] for (client id not available,homeassistant,1) 1554262634: |-- mosquitto_auth_acl_check(..., client id not available, MQTT_USER, stat/sonoff-3/RESULT, MOSQ_ACL_WRITE) 1554262634: |-- aclcheck(MQTT_USER, stat/sonoff-3/RESULT, 2) CACHEDAUTH: 0 1554262634: |-- mosquitto_auth_acl_check(..., client id not available, MQTT_USER, stat/sonoff-3/POWER, MOSQ_ACL_WRITE) 1554262634: |-- aclcheck(MQTT_USER, stat/sonoff-3/POWER, 2) CACHEDAUTH: 0 1554262634: |-- mosquitto_auth_acl_check(..., client id not available, homeassistant, stat/sonoff-3/POWER, MOSQ_ACL_READ) 1554262634: |-- aclcheck(homeassistant, stat/sonoff-3/POWER, 1) CACHEDAUTH: 0 1554262642: |-- mosquitto_auth_acl_check(..., client id not available, MQTT_USER, tele/sonoff-3/STATE, MOSQ_ACL_WRITE) 1554262642: |-- url=http://127.0.0.1:8080/superuser 1554262642: |-- data=username=MQTT_USER&password=&topic=&acc=-1&clientid= 1554262642: |-- aclcheck(MQTT_USER, tele/sonoff-3/STATE, 2) SUPERUSER=Y by http 1554262642: |-- Cached [4071DD21EC330D52E0BDA2CB8AC33BA9E421EE5C] for (client id not available,MQTT_USER,2)

This is basically IMPOSSIBLE to work with. I want to set up a switch that my OctoPi controls so that it can shut down the printer after its finished or if there is a fault (but after the Pi has shut down), but being the switch keeps getting RANDOMLY turned OFF by HASS,IO and/or MQTT, its impossible and I’ve had dozens of failed prints because this software basically sucks.

1 Like

I’m on my phone so can’t help with the broker logs but in case it helps others to help you can you drop the tasmota console outputs in here as well? That will give us an end to end view of broker and client logs.

Checking tasmota console is a good start. But this almost sounds like it is "BLINK"ing. you can check by going to the console and submitting cmnd/name_of_your_device/Power1 (nothing into payload) provided you have only one switch. If it comes back with with the response 3, you have your culprit.

Check commands for Tasmota https://github.com/arendst/Sonoff-Tasmota/wiki/Commands#control

Hope it helps.

Here’s the output from the consol:
05:11:13 CMD: cmnd/Sonoff-3/Power1
05:11:13 MQT: stat/sonoff-3/RESULT = {“POWER”:“OFF”}
05:11:13 MQT: stat/sonoff-3/POWER = OFF (retained)

I’ve tried it with and without ‘retain: true’ in the switch setup of configuration.yaml with no differences.
I’m now reloading all firmware, HASSIO and MQTT software.

Look up on youtube a video about power and retain switches in tasmota by a user called “the hookup” https://www.youtube.com/watch?v=31IyfM1gygo&t=15s

Yea, been there, done that - lots of times. Follow ‘The Hookup’ video again and again. Didn’t help.

Tasmota: 6.5.0
Mosquitto 4.1
Hassio Supervisor: 152
HassOS 1.13

configuration.yaml
- platform: mqtt
name: “Hevo 3D Printer”
command_topic: “cmnd/sonoff-3/power”
state_topic: “stat/sonoff-3/POWER”
qos: 1
payload_on: “ON”
payload_off: “OFF”
retain: false

MQTT Log:
1554265904: |-- data=username=MQTT_USER&password=&topic=&acc=-1&clientid=
1554265904: |-- aclcheck(MQTT_USER, tele/sonoff-3/INFO3, 2) SUPERUSER=Y by http
1554265904: |-- Cached [9FB4212E74ED7A071B1802BA5AABE9450C245211] for (client id not available,MQTT_USER,2)
1554265904: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, stat/sonoff-3/RESULT, MOSQ_ACL_WRITE)
1554265904: |-- aclcheck(MQTT_USER, stat/sonoff-3/RESULT, 2) CACHEDAUTH: 0
1554265904: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, stat/sonoff-3/POWER, MOSQ_ACL_WRITE)
1554265904: |-- aclcheck(MQTT_USER, stat/sonoff-3/POWER, 2) CACHEDAUTH: 0
1554265904: |-- mosquitto_auth_acl_check(…, client id not available, homeassistant, stat/sonoff-3/POWER, MOSQ_ACL_READ)
1554265904: |-- aclcheck(homeassistant, stat/sonoff-3/POWER, 1) CACHEDAUTH: 0
1554265904: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, stat/sonoff-3/RESULT, MOSQ_ACL_WRITE)
1554265904: |-- aclcheck(MQTT_USER, stat/sonoff-3/RESULT, 2) CACHEDAUTH: 0
1554265904: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, stat/sonoff-3/POWER, MOSQ_ACL_WRITE)
1554265904: |-- aclcheck(MQTT_USER, stat/sonoff-3/POWER, 2) CACHEDAUTH: 0
1554265904: |-- mosquitto_auth_acl_check(…, client id not available, homeassistant, stat/sonoff-3/POWER, MOSQ_ACL_READ)
1554265904: |-- aclcheck(homeassistant, stat/sonoff-3/POWER, 1) CACHEDAUTH: 0
1554265912: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, tele/sonoff-3/STATE, MOSQ_ACL_WRITE)
1554265912: |-- aclcheck(MQTT_USER, tele/sonoff-3/STATE, 2) CACHEDAUTH: 0
1554265960: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, tele/sonoff-2/STATE, MOSQ_ACL_WRITE)
1554265960: |-- aclcheck(MQTT_USER, tele/sonoff-2/STATE, 2) CACHEDAUTH: 0
1554265960: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, tele/sonoff-2/SENSOR, MOSQ_ACL_WRITE)
1554265960: |-- aclcheck(MQTT_USER, tele/sonoff-2/SENSOR, 2) CACHEDAUTH: 0
1554265960: |-- mosquitto_auth_acl_check(…, client id not available, homeassistant, tele/sonoff-2/SENSOR, MOSQ_ACL_READ)
1554265960: |-- aclcheck(homeassistant, tele/sonoff-2/SENSOR, 1) CACHEDAUTH: 0
1554265973: |-- mosquitto_auth_acl_check(…, client id not available, MQTT_USER, tele/sonoff-1/STATE, MOSQ_ACL_WRITE)
1554265973: |-- aclcheck(MQTT_USER, tele/sonoff-1/STATE, 2) CACHEDAUTH: 0

Sonoff Consol:
00:00:00 Project sonoff Hevo3DPrinter Version 6.5.0(release-sonoff)-2_3_0
00:00:00 WIF: Connecting to AP1 Loki in mode 11N as Sonoff-3…
00:00:06 WIF: Connected
00:00:06 HTP: Web server active on Sonoff-3 with IP address 172.27.3.13
00:00:07 MQT: Attempting connection…
05:32:12 MQT: Connected
05:32:12 MQT: tele/sonoff-3/LWT = Online (retained)
05:32:12 MQT: cmnd/sonoff-3/POWER =
05:32:12 MQT: tele/sonoff-3/INFO1 = {“Module”:“Sonoff S2X”,“Version”:“6.5.0(release-sonoff)”,“FallbackTopic”:“cmnd/Hevo3DPrinter_fb/”,“GroupTopic”:“sonoffs”}
05:32:12 MQT: tele/sonoff-3/INFO2 = {“WebServerMode”:“Admin”,“Hostname”:“Sonoff-3”,“IPAddress”:“172.27.3.13”}
05:32:12 MQT: tele/sonoff-3/INFO3 = {“RestartReason”:“Power on”}
05:32:12 MQT: stat/sonoff-3/RESULT = {“POWER”:“ON”}
05:32:12 MQT: stat/sonoff-3/POWER = ON (retained)
05:32:12 MQT: stat/sonoff-3/RESULT = {“POWER”:“OFF”}
05:32:12 MQT: stat/sonoff-3/POWER = OFF (retained)
05:32:21 MQT: tele/sonoff-3/STATE = {“Time”:“2019-04-03T05:32:20”,“Uptime”:“0T00:00:16”,“Vcc”:3.308,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“Loki”,“BSSId”:“C0:C1:C0:B4:03:76”,“Channel”:3,“RSSI”:60,“LinkCount”:1,“Downtime”:“0T00:00:06”}}

Power On Switch
Wait 30 seconds
Unplug Switch
Wait 15 seconds
Plug in Switch
Switch turns on
Red Light on
Blue Light Blinks
Blue Light Stops
Red Light turns off
Switch Turns off

WHY???

Sorry, my bad I sent you wrong command to test. Try this and let us know the result.

cmnd/sonoff-3/SwitchMode1

The retain flag is only for the broker to remember the state of the message and give it to new subscribers. It doesn’t affect your device.

If it’s not powering to state you want you should tune the PowerOnState instead.

Have you setup ACL in the addon?

07:55:21 CMD: cmnd/sonoff-3/SwitchMode1
07:55:21 MQT: stat/sonoff-3/RESULT = {"SwitchMode1":0}

PowerOnState is 3

07:57:44 CMD: cmnd/Sonoff-3/PowerOnState
07:57:44 MQT: stat/sonoff-3/RESULT = {"PowerOnState":3}

So, according to this wiki, that should be what I want: GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at

But it doesn’t work. After the switch is plugged in, it powers on and connects to the MQTT broker, its gets turned off anyway.

And if I disable MQTT in the Sonoff Switch. It works as expected:
Plug in the switch
Turn it on
Unplug the switch
Plug it back in
switch stay ON

So, it obviously the retarded MQTT turning off the switch after it sees it either after a reboot or a failure to respond to a keepalive…

If you previously had retain: true you need to clear that flag from the persistence database. You can use MQTT Explorer to do that.

I don’t have ACL in my Hass.io addons Dashboard and I don’t know what that is.
I can’t find ACL in the Add-on store as well.

You need to read the docs for the addon!

active: true turns it on (ACL) and it’s mandatory but you need to set it up.

You can see in the logs, I did that (cleared Retain True) following the ‘Hook Up’ video:
switchretain off
buttonretain on
buttonretain off
poweronstate 3
powerretain on

That does not clear retained messages - that just fixes it going forward.

What addon? ACL? MQTT? which addon? ‘The Addon’ doesn’t mean anything to me, sorry.
Like I said, I can’t find a ACL addon…

That’s not what the video you referred me to said: https://youtu.be/31IyfM1gygo?list=PLJX30NW4d60PVZzl4JoBRvjJXbwN7YqIw&t=391

Mosquitto Addon settings

I didn’t refer you to any video (although I would have told you to look at that one) In any case, you need to clear the retained messages in the persistence database… those Tasmota commands won’t fix that up.

Ok, then more erroneous videos and documentation. What fun. I’ll dig around some more for another video or doc to tell me how to remove those retained messages in the database…hopefully this time their not just blow smoke up my butt…

And I found the Access Control List Settings (ACLS) in the MQTT docs. Not sure how that helps, but I’ll read those those docs…just hope they’re accurate and up to date…