Turn fan back on when power goes out

Would a motion sensor be an option?

Hmm maybe use a Ring v2 extender...

When detect change from battery to mains turn on fan

Perhaps a vibration/acceleration sensor? You can set a trigger so that if movement stops a rule would start a loop that would send the on command every few minutes until it starts up again. This would depend on the fan and if you can put something like that on it and not unbalance it.

Although the Ring 2 extender would also be a solution, as suggested by @rlithgow1

1 Like

OK, but what about when the fan is supposed to be off? This would detect no motion, and turn the fan on.

The issue is not detecting if the fan is on or off with sensors. The switch being off would do the same thing. The issue is how do we let Hubitat know the fan was on or off before power went out?

If the trigger is motion stops then if the fan is off to begin with it will not trigger. You can add time constraints as well, perhaps only when in sleep mode, etc.

In my opinion the simplest way to do this is using a device that detects when mains power is restored. You can use a Ring Extender as suggested by @rlithgow1, or just build a device that detects power loss/restoration.

Here's an example of such a device:

And then use a rule like this:

Required expression: When mode is Sleep
Trigger: Power is restored
Actions: Turn on Fan.

3 Likes

If fan is a simple motor that is either "on" or "off" (or if it can be configured like that), then even simpler solution is possible: just attach smart switch module that has last state memory and can restore it after power outage (For example Aeotec Nano: for Dual Switch Nano it has a parameter 20 that can be set to "Last state [value = 0]").

2 Likes

Does your fan controller report that the fan is off after you lose power? If so, you could just use a repeat loop to re-send the On command to the fan every 15 minutes, or whatever interval you want it to be, until you manually turn it off. No need to detect anything.

Temperature is another option. Set a rule to run the fan above a set temp.

1 Like

I like this idea. Especially because temperature sensors are way more sensitive than humans perceiving temperature changes.

1 Like

Depends on how long the power off periods are; might deplete the battery.

1 Like

True but you can schedule a shutdown to the hub to prevent corruption and upon restart have the restart trigger the fan. Or if the hubitat ups is big enough (a 750 would last a couple of days) all it has to do is wait for direct power to be applied to the repeater. At that point it sees change and turns on the fan

How about mirroring the ceiling fan to a sacrificial plug that remembers power state from before an outage (the $15 Tradfri does this I think).

Then if you use the plug state to turn on the fan, it would re-start after an outage, or vice versa if the plug was set to off, the fan will be turned off after an outage.

Umm, at least that makes sense in my head.
Just don't ask me to write the rule(s). :wink:

I can use a virtual switch as well. The problem is when I use the fan normally, I need the V switch (or in your example the plug) to turn off when I turn the fan off from the switch. When I loose power, and it comes back on, the fan switch is now off, which turns off the V switch, or in your case the plug.

I thought I had a solution, which was actually along those lines. I set up a V switch that would turn on when the fan was turned on, but when the fan was turned off, it would wait 15 seconds before turning the V switch off. Then another rule that was triggered by a system start, that if the V switch was on, then turn the fan on. The idea being that this rule would kick in before the 15 seconds was up.

I got it all set up, tested it out by unplugging my Hubitat, and I was all happy. That is until I remembered I have the Hubitat on a UPS. So it won't loose power and have a power up. But, I think this is still the right direction. I just need to figure out something that will tell Hubitat if power was lost.

I meant the other way around, the plug state controls the fan state.
When power comes back on, the plug remembers whether it was on or off, and sets the fan(via HE) to that same state.

2 Likes

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)

3 Likes

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.