I’m trying to help out a fellow user here. @gzisimatos postet this in the lounge, and thought maybe more people would help solve his challenge here in the support category:
The last state is not remembered on the Xiaomi two channel relay after an outage, default is off. He needs a solution to remember last state and set it back where it was before a power outage or a tripped circuit breaker occured (Basically same thing)
So my thought was to make a rule with a trigger/action to read the state/mode of the switch when changed, and store the state in a local variable. Then somehow, for action condition, detect that the hub is rebooted and use that to run an action to set the switch back to last variable (state), after the HE is up and running again.
I think that is what he is needing.
Any good advice on how to use a reboot or something else that only happens during a cold start as a condition in RM?
Maybe a Canary Bulb? I use a smart bulb in a coat closet , which defaults to on after power is restored and is never used for any other purpose. My hub is on a UPS. so when there is an outage and power is restored, I can use that bulb's state change as a trigger. If your hub is not on a UPS (Shame on you!), you could set up a periodic rule that checks the state of that bulb and do your necessary actions.
I use systemStart event to turn on my Homeseer fan controllers. They do not remember their state after a power failure. It works like a champ! One thing though, any time the hub reboots, either from a power failure or it reboots manually or automatically after a platform update, this will fire.
I tried this and it is not working. I unplugged the hubitat to simulate power outage, but when it comes online again, the bulb (Sengled) is still ON. In Rule Machine shows not installed after the reboot.
Sorry if my answer isn't very sophisticate, but it's working to me. I have several devices - mainly bulbs, but some plugs too - that return on after a power outage; just in my hall there are 12 bulbs with this behavior. It's very inconvenient when it happens by night, but the most worrisome is the fact that it may happen when we're out.
So I took one of these plugs that I wasn't using and made a rule based in its behavior. I keep it always off; so, if it turns on, the rule turns off all other lamps after 5 minutes. I put this delay to prevent any device that takes longer to connect from staying on.