Hello community, I searched the forum but I find only old queries. I have several shellies correctly configured, who trigger automation to switch on/off related yeelight lamps. Everything works perfect as my wall switch trigger shelly, then HA will switch on/off the related light.
My problem is popping up when the shellies lost connection (e.g. router reboot or something similar). In that case, the automation is triggered and the light is switched on/off in all my house.
As I understood from other old post, when shelly state changes from unknown (disconnected) to on or off (reconnected), this is sufficient to trigger the automation. To avoid that I should add a from field to trigger section, so that automation starts only if the previous state was on or off only.
This is one of the original automation (generated by gui):
Then I tried to add the ‘from’ to trigger. This should trigger only when it changes from “on” to “off” or from “off” to “on” and ignore all other states
Thanks, I completely missed such great community guide. Now I have to rewrite all my automations, but at least I’ll avoid the annoying trig when shelly will become unavailable.
Rewrite only when you do work on it. You can leave it as long as they work as expected. The guide is to prevent bulk rewrites, so why bulk rewrite to prevent it… This is generally called: use the “Boy wcout rule”. When you work on it, leave it cleaner then when you started.
I don’t understand your point. You kindly drive me to a solution to my issue (shelly disconnected/unavailable trigger the automation). So, rewriting the automation in below way, will solve my issue:
You said you were going to rewrite ALL your automations to avoid device id’s. I would not change them all at once, but gradually, one by one if you have a reason to change an automation. Device actions MIGHT force you to change a lot of automations. Not using them avoids that chance. Changing them all just because it might happen is even worse.
The way you wrote it will indeed avoid restart problems. I’m not sure if this will trigger too when only an attribute changes though, so I would stick with:
Oh yes, with “ALL” I meant only the automations related to shelly/yeelight, moreover the trigger issue, for some reasons, affecting only the Shelly 2 PM, while the old Shelly 1 doesn’t have such issue
And yes, I ended to use: