Fix Your Smart Home – Stop Tasmota Devices From Switching Randomly

Lights Mysteriously Turning On ?

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.

Me when my lights unexpectedly turned on at 2 AM in the morning.

MQTT Retain Settings

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.

A Ghostly Example

Rob gives a common example of the problem:

  1. Turn on your device using Home Assistant.
  2. Turn it off using the physical switch.
  3. Unplug the device, wait 10 seconds, and plug it back into the wall.
  4. Wait and see if the device turns back on.

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.

Fix Your Retain Settings

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)

    Change Retain to False in Your Home Assistant Configuration File

  1. Add “retain:false” to each of your Tasmota device switches in your Home Assistant configuration.yaml file.

    Change Retain Related Settings in the Tasmota Console of Each Device

  2. In your browser, navigate to the internal ip of your Tasmota device (e.g., 192.168.X.X, click on “Console”).

  3. Type in the following command (this is a one-line backlog command that combines the various commands that The Hookup provides):

    as shown below:

  4. Restart Home Assistant

  5. On one of my devices, I also had to delete the Tasmota device from my Home Assistant integration (Configuration->Integrations->Tasmota) before restarting Home Assistant.
  6. Delete Your MQTT Topics

    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.

How to Monitor Your Home Remotely With Skype

SkypeCall

Want to peek in on your dog ? Have an elderly parent or friend that you want to check up on ? Don’t have the time or cash to shell out for a dedicated web based camera solution ?

If you have a spare laptop with a camera, you can install Skype and have your call answered automatically so that you can get a full audio and video peek at any time using your mobile phone.

SkypeCall

A note of caution, this method using Skype obviously involves some risk that a random person might call and peek in on the camera. To minimize this, don’t use an existing account, set up a new user, and limit calls and your contact list only to those who are authorized to check on the camera.

In addition, note that this only works on a Windows or Linux version of Skype. The Apple IOS version does not permit auto answer and the Android version only answers in audio only – the person receiving the call must manually switch the video on (which works great if you have an elderly parent that has trouble with Skype calls as Skype automatically answers your audio call, you can then guide them by voice to turn the video on).

Installing Skype

Here are the instructions for Windows 10 (Linux also works, but the screen shots will be slightly different):

  1. From a Windows 10 machine install the Skype App.
  2. Create a new unique User account with its own set of contacts different from any other existing login you have. Give it a name that is not interesting or identifiable to you or a location.
  3. Login as your new user.

    Configure Skype Settings To Limit Contacts

  4. Open Settings:

  5. Make sure you do not “Sync Contacts” while setting up your Skype Account. Make sure this is turned off, as we are going to limit received calls to those in your contact list and do not want everyone on your computer’s contact list to be able to call this account. Later we will add only a select few to the Skype contact list:

    Skype-no-sync

  6. Turn “Appear in Search Results” off under Contacts->Privacy

    Skype Setting Hide From Search

  7. Turn off “Share location with Bing”Do Not Share With Bing
  8. Click on Calling – Turn on “Only Allow Skype Calls from Contacts to Ring on this device”:

    Skype Only Allow Contacts

  9. Since Skype options often change with each new version, look around for any other settings that might allow unauthorized persons to call or expose your contact information or your camera location and turn them off.
  10. Now turn on automatic answer, by going into Settings->Calling->Advanced Calling:

    Auto Answer

  11. Now add yourself and any other authorized persons to the contact list:

    Skype Add Contact Button

    Invite to Skype

  12. Now – test it out and enjoy two way video monitoring!

    Whatsapp Tip
    For another life-hack which works well as a video baby monitor, you can use Whatsapp on a mobile phone. Although Whatsapp won’t automatically answer, it will will stay connected for hours. Install it on your phone, point it at the baby, and call from another phone. Whatsapp won’t automatically answer so you’ll need to do that yourself, but it doesn’t require the more restrictive contact settings above as someone. This is ideal for monitoring your baby or elderly parent from another room in the same house, getting full HD video and audio (although it will lack night vision).

Make a $5 Motion Sensitive Coca Cola Night Light

Coca-Cola Night Soap Dispenser

Here’s a simple project.

Motion Sensitive Soap Dispenser

Home Depot is currently selling this “Soap Brite Lighted Soap Dispenser” which acts as a night lite, lighting up the liquid soap with one of 7 colors when it senses motion.

It will set you back a grand total of $3.88 plus tax. The LED lighting is contained in the base and shines up through the plastic container to illuminate the soap. There’s a button on the base which can rotate through the seven colors.

Coca-Cola Bottle Replacement

By itself, and for the cost, the dispenser is pretty cool, but you can give it a simple upgrade by replacing the container with a one pint Mexican bottled glass coke bottle. I found mine at a local grocery store for $1. The dispenser’s container simply lifts off the base (no screws). The base fits the pint Coke bottle exactly. Find a pump that fits the Coke bottle, and it can continue its use as a soap dispenser (I was able to snatch one from another soap dispenser we had lying around which fit perfectly).

No pump ? Than simply put it on a shelf with the cap back on and you have an interesting night light!

Coca-Cola Night Light

Caution: If you are going to use the glass Coke bottle as a soap dispenser, be careful as it is a little top heavy and may fall if one is not careful when using. Suggest using superglue to glue the base. Not recommended for kids.