That's fine. Physical event at the wall switch to turn it on. Then wait for physical event at the wall switch or button press to turn it off. That's easy to incorporate in the example I provided.
Trigger Events:
Fan Switch physical on
Actions to Run
Repeat every 0:10:00 (stoppable)
On: Fan Switch
Wait for event: Fan Switch physical off OR Button 1 pushed
Stop Repeating Actions
END-REP
Off: Fan Switch
My thought is, when you want it to auto-restart, you start it with a on/off/on sequence which you catch with a rule and set a variable (or virtual switch) to indicate it needs to be restarted.
Otherwise you start it with a normal press.
Off/on/OFF quick sequence would reset the variable.
A timed rule could check if restart is needed every 5 minutes.
Just make sure all automations, buttons and all, control the plug, not the fan. The one exception is physical events on the fan controller must be mirrored back to the plug.
Maybe i missed it i have a few questions about what you have.
What kind of fan is it?
Is it AC or DC powered for the motor?
Does it have smarts built in?
Does it have a remote
Is it a ceiling Fan or a box/tower fan.
You mention a GE Embrighten device being used to control the fan. This makes me think you are completely cutting power to the fan when using that switch is that right?
I feel like there are some gaps of whatbyou have we need to know
There's no gaps. The fan is a plain, 120VAC ceiling fan. No remotes of it's own. In fact, it has no pull chains or controls. When I got it, it did have a remote, but it was one of those deals that has the receiver box that you wire in and slide in above the fan in the ceiling box. Obviously that is not is use for this.
The GE Embrighten controller is a Z-Wave fan controller that does in fact cut power to the fan when it's off. In reality I'm sure it's a MOSFET type thing or something similar inside to where there might be some voltage present, if anyone want's to get technical, but for this conversation, power to the fan is off at that point.
That might be the way to go. I can set it up and cut the breaker to the room to test it. I think what was keeping me a bit confused on this is if the power is lost, would it show as a physical or digital action, or neither at all.
I feel like this is being made much harder then it needs to be.
The fan isn't smart and has it's power controlled by the Enbrighten Switch mentioned. If that is the case then wouldn't it make sense to focus on that switch. What exact embrighten device do you have?
I select that the GE Smart Fan control switch on my dev hub and it doesn't have the the option to return to last power state. Also using physical vs digital switch action can be flacky depending on how the switch implements it.
You also want to avoid putting anything physically on the fan. Balance is ciritical for a fan to work right and adding anything to the fan could through that off.
Maybe swap that out for a Zooz double switch controller(Zen30) would make more sense. It has a option to set the power state after a power loss. Simply setting that to return to the last power state should fix this issue.
You have to have an event for a rule to run. Does the power going off and coming back on cause an off event? I doubt it.
I would think just checking the state of the switch every 5 to 10 minutes while you sleep would be a simple solution. You set a virtual switch, or a boolean varaible that turns on when you go to sleep, if the fan is on. So if the virtual switch is off then don't run the rule. Reset the switch every day when you get up.
I'd be surprised if a power outage shows as a physical event. I think it's worth a try and please let us know the results if you do. For testing, maybe make the repeat 2 or 3 minutes so you don't have to wait so long to find out if it does work.
Back to the drawing board. I cut the breaker to the bedroom, and even let it sit off for a few minutes. As soon as I turned it back on, nothing. Checking the logs, it's showing the fan turned off physical and on physical in relation to the breaker being off and on. What's odd is while power was out, the fan was showing as still being on in the dashboard. So, not sure why that would be.
But, in any event, when power goes out, HE ultimately thinks the fan was turned off by the physical switch. So that pretty much rules out any kind of virtual or actual device that basically mirrors the fan control as a way of remembering the state.
I'm still trying to figure it out, but at the same time, I'm not going to add extra scene controllers next to my existing fan control on the wall. It's annoying but I also still want a clean install in the house.
I don't think this is surprising. The last report from the switch was that the fan was on. When you lose power the switch can't communicate with the hub so it still thinks it's on. I'm surprised, though, that the switch is reporting a physical event when the power comes back on.
Are you using the GE Smart Fan Controller driver? If so, does the double tap work?
@tpaairman Ok... Been thinking more about this.... Again I'm going back to using the Ring v2 extender. So everytime the fan switch is turned on, have a variable populated. When it's off have the variable changed to reflect. (Lets call the variable FAN-OFF and FAN-ON for giggles) My understanding is this will survive a reboot as well. Now create your conditional rule trigger with the change of the power status on the extender switching to battery and back. Start with if the variable fan-on is there when the extender changes back to mains the fan gets turned on, but if it's fan-off then do nothing. Now if the power goes out for an extended period of time after the hub shuts down (this would be a guestamation of how long the ups lasts with the hub on it). Anyway upon reboot you can have the reboot itself trigger the rule and check that variable for fan-on or fan-off and act accordingly.
If there was a off or on event then you can trigger on it. So you set a virtual switch or variable that indicates if the fan is supposed to be on when you go to sleep, and if there is any kind of off or on event while you sleep, send a on command. Maybe do a refresh and then send a on command.