Sonoff Tasmota Tips & Tricks

Sonoff Tasmota Tips & Tricks

This page is under development. Stay tuned for more Sonoff Tasmota Tips & Tricks.

Contents:


Ghost / Random Switching on Sonoff Devices (MQTT Retained):

If you are experiencing Ghost Switching i.e. A device goes ON / OFF by itself, which is a terrible experience if happens during a mid night!!, then you at correct place to fix this terrible issue.

All of the communication between your Raspberry Pi Server and Sonoff devices running Tasmota firmware, is done through MQTT. If you have not configured your MQTT settings correctly then you might be facing terrible issues including random switching or ghost switching. If you have published a payload with retained flag over your MQTT network on a specific topic then each time your device will connect to your MQTT network, that retained message will be sent to the device who subscribed for that particular topic. So let’s correct it by closing all the back holes to Ghost’s entry 😉

a) Sonoff Tasmota Configuration:

Open up your  Sonoff Tasmota device IP address in your favourite browser and navigate to Console. Input the following commands in console followed by Enter Key.

Now make sure that you have correct PowerOnState. By default PowerOnState is set to 3 which mean it turns to last know power state after boot. You can also change it by issuing the PowerOnState 3 command in Console. You can also use the command below to fire all above mentioned commands at once.

b) Delete all previously retained MQTT messages:

After configuring the Sonoff Tasmota correctly as discussed above, delete all previously retained messages in to Mosquitto broker database to fix the problem completely. Open up the PuTTY, connect to your Raspberry Pi via SSH and fire the commands given below.

Above commands will stop the Mosquitto service, delete the Mosquitto database and start the Mosquitto service once again. Now do not use any Retain Flag with any of MQTT related stuff to avoid Ghost / Random switching.


Incorrect Switch State on Home Assistant / Domoticz:

Another common issue is wrong switch state on being reported on dashboard such as device is ON while it is being reported as OFF on your dashboard. It happens especially when your dashboard is restarted. Here is a quick fix to this problem. Change the PowerRetain to On by issuing the PowerRetain On command in Tasmota Console. Now your Dashboard will receive the last retained message of a switch state immediate after restart.

Leave a Reply

avatar
  Subscribe  
Notify of