Turn ON after powerloss

I recently picked up an In wall Zwave receptacle outlet. The top half is always on and the bottom have is controllable. But I’ve learned that on a power loss the bottom zwave controllable will default to OFF when power is restored.

Well, I have this outlet located behind my Washer and Dryer and is not easily accessible. And recently with a power outage, the wife wasn’t the happiest when trying to do laundry and Washer didn’t turn on. So I’m thinking of setting up a rule to turn the outlet back on when power is restored, and wondering the best approach.

I’m thinking something along the lines of checking when OH2 starts combined with a cron job to check the switch every XX hour? That outlet is not on the same breaker as my OH2 server so think need to do both.

rule "Keep Laundry Outlet On at all times"
when
        Time cron "0 0 * * * ?" or
        System started
then
		sendCommand(BS_Laundry_Power_Switch, ON)
end

Or think there is a better way? Do you thing necessary to also check if Switch is OFF first to send the ON command? I think if already ON and sending an ON command shouldn’t harm anything?

There’s a few ways but I wouldn’t say they’re any better.

You can persist the state and have a single rule to restore all persisted states on start up.
Alternatively you can just use Item status is received update off then send command on. So anytime the state is updated by openhab so you don’t have to worry about timing.

No configurable option to turn the device ON or restore state after power restore?

Unfortunately, that option doesn’t exist on the outlet. It is an Enerware ZW15RM that tracks energy use, but does not let you set status after power loss.

My only thought and would be rare event is that if the breaker for the Washer was flipped Off and then back On, while OH2 was still running. Checking if the item received an update may not work?

ie. Turn off breaker to the washer. Would OH2 see status change and then send the ON command when the power to Washer was still Off? Then when power to the Washer was actually turned back on, OH2 would already thinks it On when it is really Off?

ie. Turn off breaker to the washer. Would OH2 see status change and then send the ON command when the power to Washer was still Off? Then when power to the Washer was actually turned back on, OH2 would already thinks it On when it is really Off

Does the Zwave binding do any polling? It would post the update at each polling interval
The periodic refresh would give you the correct states unless it doesn’t, and you had autorefresh off then it would be out of sync.

There was a polling period one used to be able to set in 1.x binding but I don’t know if there is in the 2 version and if there is where it is.

Personally, I would probably do something simple and dumb. You always want the outlet to be on so at System started and once every 10 minutes to an hour just send ON, kind of like your original suggestion. Though I think once per minute might be a bit excessive.

Another alternative might be set a timer based on receiving updates from the power usage. Presumably, the washer trickles a little power from the outlet while it is plugged in (it’s a rare appliance that doesn’t I bet) so you might be able to use a lack of power usage reported for a certain time period as a way to discover the outlet is off.

Ideally that would be best but in this case OH may think it is ON when it is really OFF. So you can’t depend upon the state of BS_Laundry_Power_Switch.

Sending lots of ONs to a device that is already ON shouldn’t harm anything beyond jamming your zwave network with useless commands.