Extractor Fan Automation


#1

1) Give a description of the problem

Is someone able to help me out with a piston that will turn my extractor fan on for 3 minutes when motion is detected then off again if motion has stopped but if motion is active for more than 3 minutes, keep the fan running for 15 minutes once motion has stopped.

Thanks


#2

Hi there,
I can write you a draft no problem.
But let me ask you first, are you okay with using variables or with a little compromise on what you want i can come up with something without variables.


#3

That would be great thanks. I only have a basic understanding of webCore but im hoping I’ll be able to understand better the more I use it. I’m not familiar with using variables, but I’m happy to do so, maybe it’ll help me with future pistons.

Thanks


#4

Great…
This is a version without a variable. Not 100% what you want but very close.

IF motion sensor changes to active 
OR
IF motion sensor is active
Then
With 
Extractorfan turn ON

If motion sensor stays inactive 15 minutes
Then 
With
Extractorfan turn OFF

What this does is, turns ON the fan if there is motion, keeps it running if still motion
if no motion for 15 minutes stops the fan…

I’d say start with this and then go to the variables…


#5

Thanks. Is there a way to turn the fan off after 3 minutes if motion has stopped during the first 3 minutes but continue for 15 minutes if motion is detected for 3+ minutes initially.


#6

i don’t know why 3 minutes is so important but the one I suggested does this,
as long as there is motion in the room, it will be ON
as soon as the motion stops for 15 minutes it will stop…

To me it feels like the same???

if a coder (i’m not) wants to jump in and help more pls feel free…


#7

It’s not of huge importance. I’ll try and explain what I’m trying to achieve. The extractor fan is located in the bathroom so what is like is for it to come on but go off almost immediately if I’m in there for a short period of time e.g. brushing my teeth ect… So not to waste energy, but if I’m in there for a longer period of time it means I’m having a shower or a bath hence the reason I’d like it to continue for 10-15 minutes one the motion has stopped, so long as the motion is detected for 3+ minutes initially.

Make sense?


#8

oh yes it does make sense,

then how about this one,

As long as there is motion, the fan is active, as soon as motion is not picked up for lets say 2 minutes - meaning you are no longer in the bathroom - it stops…

would that work for you?? because it’s really simple…

btw, what you want is doable but just makes the piston(s) complicated and in the long run more complicated piston you have more troubles will be around the corner…


#9

Yeah I’ve managed to get the fan to turn on and off with motion/no motion is just getting it to run for a longer period of time, beyond the time I’m in the room I’m struggling with. I just had a thought, would two separate pistons be better? One for the initial 2-3 minutes and one for anything beyond that?


#10

does your motion sensor have a blind spot in the bathroom??
Or it picks up every movement??

if yes to the second question, we can try something…


#11

I actually have 2 sensors in there so I’m confident at least one of them will pick motion up at all times if someone is on there.


#12

How did you do this one, because if this worked exactly how it supposed to, you would already have what you wanted… Would you mind sharing this solution as a piston?


#13


#14

Here’s what I have been using, but no matter what the fan will go off 3 minutes after motion has stopped and won’t continue with the desired 10 minutes after motion has stopped.


#15

I apologize for interrupting, but I just tested a piston that should do exactly what you want without complex variables

(the logs are just for information and potential troubleshooting)

You can PAUSE your current piston, and then IMPORT this one to test.
(It should work right out of the box)


Pro Tip:

I normally do not control a device that is also a trigger in the same piston, but I broke that rule here (with fan’s switch) because the 15 minute delay keeps the two events separated…


#16

Thanks @WCmore I’ll give this a go.


#17

I’m glad @WcMore jumped in… He is a pro… so you are in good hands…


#18

Just out of curiosity, what is the timeout on your motion sensor? If it is longer than 3 minutes, it won’t be possible for the first part of the piston to fire since the sensor will never go inactive before 3 minutes. It’s just a common thing to overlook when trying to implement something like this so wanted to make sure you’d taken that into account before tearing your hair out wondering why it’s not working. :slight_smile:


#19

I’m using Xiaomi motion sensors with a device handler. I believe the time out is 1 minute but I may be wrong.


#20

Here’s one with complex variables. I’m curious if a condition can contain a variable or not, so I don’t know if this would work:

If you do import it, I think you’ll have to set the variable to 3 the first time through.