Lighted House in Winter by stephan-becher unsplash.com
While working on fixing my KuLED light switches from magically but unexpectedly switching on, I found this great post and video from The Hookup regarding how to stop Wifi switches flashed with Tasmota open source firmware from seemingly being switched on by ghosts.
As Rob explains, most of the time this random switching is caused by MQTT retain commands that are not in sync between your hub (e.g., Home Assistant) and the Tasmota device.
Rob gives a common example of the problem:
I tried this on a Sonoff-modified desk lamp that was experiencing the random switching. After following the steps I re-plugged it into the wall, and after about 2 seconds it turned back on exhibiting this “ghostly” behavior.
The fix for 90% of cases is the following (for a detailed explanation and coverage of some specific use cases see The Hookup’s post)
Backlog switchretain off; buttonretain on; buttonretain off; PowerOnState 3; PowerRetain on;
as shown below:
In addition to the above steps, I also had to use Mqtt Explorer (an excellent free MQTT client available in the Windows store) to delete the MQTT retain messages manually. Instead of hunting all the relevent topics down, I decided to delete ALL the MQTT topics held by the broker as all my devices will simply recreate them (your setup may be different or there might be historical data that you don’t want to lose so you may want to think a little before deleting all your topics).
Without deleting the MQTT retain messages, my devices were turning OFF on a reconnect if the WiFi disconnected. If you watch Rob’s video he explains how the broker will keep MQTT retain messages forever unless they are manually deleted. The switchretain/buttonretain Tasmota commands in the second step above are intended to do that but they didn’t work for my KULED switches.
If the above doesn’t work for you, you probably have an incorrect value in one of your Tasmota settings. Try setting the Tasmota device back to its defaults and then configure your Tasmota from scratch. Then try the above again.
Avoiding Browser Plugins with KeePassXC KeePassXC is a popular free open source password manager. As…
If you've had a Gmail account for years, like I have, at some point you…
Here's a little trick I use to back up my Raspberry Pi without having to…
I try to keep my email inbox fairly clean but I do subscribe to some…
I was recently faced with the dreaded prospect of re-installing Windows 10. While the standard…
Pi-Hole and Upstream DNS Providers Pi-hole is an excellent whole-home, self-hosted ad blocker and DNS…
View Comments
Hi,
Thanks for your explanation! I presume that my ghosting (ON/OFF) of my rack-plugs might be related to this Retention problem. I am not useing HA, but ioBroker. Its related to MQTT very similar! I will test this on next global power-shutdown-test ;-), as i want to re-insert the Tasmota-Plugs on specific places, so I can control the restart of possible device freeze.
A good explanation found on your article! Congrats for this! Easy and fast to read, with all the links to related information. Despite the fact, that this article is already from 2021, it is still an actual topic for some of us;-)
Thanks therfore for these hints.
Greetings from Luxembourg,
Luc