I just pulled out one smart socket and one smart lightbulb of of Tuya!!! With Tasmota firmware ofc.
Question is: How can I trigger and automation when device becomes online from offline state? I have wall switch which physically disconnects power from smart bulb. What I want is when power is back it should always switch mode to white (not colour) and brightness 100%. How this condition should look like in YAML?
Trigger when the state changes from unavailabe. However, even if you do this sucessfully, you probably won’t get the desired result, because once the light gets power again it takes a moment for HA to notice and by this time the light will already be turned on and it will then change afterwards to white 100%, you won’t be able to have the light turn on with with 100%, there will be a short period where it is in the other state.
Thanks for reply. Seems like not possible. Besides HA automation would it be possible to configure it in device itself using Tasmota SetOption like mentioned here:
I don’t use Tasmota sorry. I attached buttons/switches next to the physical light switch and only use these instead of the ohysical ones. For some switches there’s even a plate you can out on top of the switch and mount a smart switch.
Actually it’s very simple. Since Tasmota devices needs MQTT broker to talk to all you have to do is make automation triggered by MQTT payload like this:
In other words MQTT informs HA that status of light has changed back to online so automation turns light on and sets it to normal white with full brightness. One second delay before is needed because it won’t work without it.
Now the funny part. After disabling light by wall switch (so cutting power) MQTT needs about a minute to figure out the device is offline. Nethertheless even when you cut power only for 3 seconds and then turn it back on MQTT will send new payload saying Online even tho it never changed so the automation will trigger as well That’s because even payload didn’t changed the message was re-created as new one so again will be send to HA.