Yes, however, in order for the plug to know what state the fan was in, it has to turn on when the fan is turned on, and off when the fan is turned off. When power goes out, the fan switch turns off, and when power comes back on, Hubitat just sees that the fan is off, and it turns the plug off because it's already set to have the plug mirror the fan switch.
That's the whole key to the problem. The system cannot differentiate the switch turning off because of a loss of power from the switch turning off because I pushed it. In other words, when power comes back on, Hubitat thinks I just pushed the switch off myself.
I believe you misunderstand the OP’s issue. He wants to detect power on/off of the fan when the fan switch turns on, not when there is power loss to the home. My point is that, if a Ring Extender is powered together with the fan (not by the mains that power the switch to the fan), the Ring Extender’s battery will deplete if the fan stays turned off for a long time.
In the normal situation, a home’s power will be lost for, say, a week at most, which is fine for the battery in a Ring Extender, which can trigger a shutdown rule. Not the situation here.
If you're willing to use a virtual switch to turn on the fan then I think this should work fine. Note that a momentary outage will have the fan off for 10 minutes max but I don't think that's too bad of a compromise for a simple solution.
Trigger Events:
VirtualSwitch turns on
Actions to Run
On: Fan
Repeat every 0:10:00 (stoppable)
On: Fan
Wait for event: VirtualSwitch turns off
Stop Repeating Actions
END-REP
Off: Fan
Note that the on within the Repeat could be On: Fan (Command only switches that are off)
Check if your real switch driver properly labels the event as “physical” when you actuate the switch manually. RM can tell the difference between physical and digital device events.
What kind of UPS? Some have Community developed integrations that report status info back to HE, admittedly requiring an always on PC or RPI, etc. You may be able to use this to detect the power outage, though I expect it will be on a different circuit, so you may get the odd false reading, but I expect it would suit this purpose.
It's an Amazon Basics. I don't want to have a computer set up to watch it, but that sounds like it's on the right path. But that's the key to the problem is detecting a power outage itself.
Op was talking about power loss to the home during a storm or example and the fan doesn't come back on. using the extender or similar as a trigger to show power outage to the house can be used as a trigger.
I could be over simplifying this but reading your OP the challenge you are trying to solve is… when you sleep keep fan on. Assuming you use a mode or something to know when night/sleep time is, you could just issue an On command to the fan every 15-30 minute during the night. If fan is already on it stays on, if off it turns on.
When the power goes out, HE just sees the fan is now off, the exact same as if I turned it off myself. So in a power outage HE would think the fan is supposed to be off.
Yes, but before we go further, I also have a button by the bed that can turn it off. So sometimes it's digital off. And yes, sometimes I get up and turn the fan off by the wall switch. (Depends on how half asleep I still am at the time.)
When I saw that at first, I was thinking it would always just turn the fan on after an outage, but I think this might work along with the virtual switch that is delayed turning off when the fan is turned off.
Set a hub variable when the button controller is used that gets reset when the fan is turned on using the switch. That will let you keep track of the button controler.