Hi there all,
I have a problem with an event that I don’t know where from arrive.
I have Hassio installed via docker in a ubuntu partition.
Every night at 4:11 there is something that stop all my switch
and then turn back on.
I have for example sonoff that turn on and off every night at 4:11.
I install the LOG VIEWER addon but there I see nothing.
I’ll try to turn an info log on my MQTT brocker (MQTT Server & Web client)
in order to see if some message arrive from MQTT.
Is more than a week that I can’t understand what’s wrong there
Please help me with some idea
Turn your Wi-Fi access point off then back on. When Wi-Fi is restored, if all your Sonoff devices turn on, then they need to re-configured.
If the Sonoff devices remain off then try turning off the power to one or more of them. Then turn the power back on and see if the Sonoff stays off or turns on. If it turn on then its configuration needs adjustment.
I’ll correct myself and say that Tasmota has a PowerOnState option that determines how the switch behaves when it is powered up. This is unrelated to Wi-Fi. There’s no command to control how it behaves when it first connects to Wi-Fi.
However, what will affect the switch, when it first connects to Wi-Fi, is if the switch’s command_topic contains a retained message. That means the last command sent to the switch is stored (retained) by the MQTT Broker. So when the switch connects to Wi-Fi, it connects to the broker and immediately receives the last transmitted command … which might have been to turn on the light.
Check the configuration of your switches in Home Assistant and look for any that are using retain: true.
On my 2 pieces of sonoff topic I have the “retain true” in the configuration if I remember.
But… this PowerOnState is work also when WiFi is lost ?
…or is work only on powering up the device sonoff ?
I’ll take a look when I’ll arrive home.
Thank’s a lot again
Denis
That’s the leading cause for lights to magically turn themselves on after disconnecting/reconnecting to Wi-Fi.
No, I was wrong about that. I read Tasmota’s documentation and PowerStateOn only applies when the switch is powered up.
You will need to remove retain: true from the configuration (retain: false is the default). However, there is one more very important step. You must delete the retained message stored in the MQTT Broker.
I can explain how to do that but, honestly, the easiest way is to use MQTT Explorer. It displays all of the MQTT broker’s topics, you select the topic containing the retained message, and click the ‘Retained’ button to delete the retained message in that topic.
The usual way to do it is to publish an empty retained message to the topic. Explaining how to do that takes more time that if you just install MQTT Explorer and use it to delete the retained message.
Thanks a lot I have solve my problem of the 04:00 AM On/Off
Now I have a little other problem.
The 2 switch that I have from sonoff with last tasmota firmware
can remember the state (if On or Off) after reboot of Hassio.
But I have a switch on my automatic door (switch that I do)
that every time I reboot hassio it’s olways take the Off status.
Here is how your system works now:
Your switch publishes its status as a NON-retained message. That means a topic’s message is received only by clients that are currently connected to the broker. When Home Assistant restarts:
it connects to the broker
subscribes to the switch’s topic
receives no message for this topic (because it is NOT retained by the broker)
defaults to indicating the switch’s state is off
Set Tasmota’s PowerRetain option to on. This will make the switch publish its status message to the MQTT Broker as a retained message. The broker will store (retain) this message. When Home Assistant restarts:
it connects to the broker
subscribes to the switch’s topic
immediately receives the topic’s message (because it is retained by the broker)