Help with Extractor Fan Piston


#1

1) Give a description of the problem
I have a piston that automatically turns off the extractor fan when the humidity level drops back to it’s original level. This is working fine. I need to tweak my piston so that it doesn’t turn off the light after the initial wait period if there has been further motion in the bathroom.

I have a seperate piston that turns the light and extractor on independently from each other depending on the time of day (they are on seperate Fibaro modules). The triggers for the bathroom light are either the light switch or the motion detection from a sensor.

2) What is the expected behaviour?
Light stays on whilst someone is in the bathroom and then turns off 20 minutes after no motion.

3) What is happening/not happening?
Light is turning off 20 mins after the extractor is turned on.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

I’d wrap the “Turn bulb off” part in another if statement, checking if the motion was inactive for the defined wait period.

...
If
    Motion Sensors motion changes to inactive
Then
    Wait X minutes
    Set variable ...
    If 
        Motion Sensors motion was inactive for at least X minutes
    Then
        Turn bulb off
    End If
    ...
End If

#3

Sounds like the Task Cancelling Policy and Task Scheduling Policy are coming in to play.

If the extractor turns on or off, or the motion goes active or inactive, during the twenty minute ‘wait’, I would expect the time either to be completely cancelled (extractor on/off or motion active) or restarted (motion going inactive).


#4

Many thanks for this. Will test.


#5

I had a look and this is how it is set:


#6

I can see what is (probably) happening but I’m not immediately sure what the solution is.

It might be as simple as changing the structure to:

if switch changes to on
then record humidity
else if motion changes to inactive
        then
        ....
        endif
endif

However the extractor turning off might still cause issues.