Bathroom Fan Control

Hello -

With inspriation from Rex’s “ensuite” example as well as the examples found in the PLTS “getting started” PDF, I wanted to implement my own bathroom fan control.

This is just a half-bath (no need to remove humidity) so I’ve changed the logic a bit and wanted another set of eyes to see if this is correct.

  1. If the person is in the bathroom (turned the light on) for more than 3 minutes - Start the fan and let it run for 20 minutes.
  2. If the person was in the bathroom for more than 3 minutes (turned the light on but then left without turning the fan on) - Start the fan and let it run for 20 minutes.
  3. If the person is still in the bathroom after the first 3 minutes, reset the timer.
  4. If they turn the fan on manually - turn it off after 20 minutes.

My only issue is it will automatically fire the fan even if they don’t “need” it (if you catch my drift) so I’ll have to think of that a bit.

Does this look close?

Thanks @tbully, it’s nice to be any form of inspiration. ;D I do have comments on your proposed logic:

Given your rule #1, I don’t see how your rule #2 can happen - the fan should have started after 3 minutes…
I don’t understand rule #3. Did you mean restart the timer rather than reset it?

In your PLTS configuration: Trigger2 can never fire because (HalfBathLightOn; HalfBathLightOn > 3:00) will never be true. Did you mean (HalfBathLightOn; HalfBathLightOff > 3:00)? In any event, I’m not convinced you need this as queried above.

Awesome idea for switch based logic.

I’ll add a little logic for motion/door sensor based control to allow you or your guests never to need touch a switch.

Upstairs Bath/Shower - Full Bath, One Room

  • Motion sensor turns light on and fan on.
  • After no motion detected for 5 minutes, light turns off.
  • If bathroom is door closed (detected using door contact sensor), no motion detected is extended to 30 minutes before turning off to allow time for showering.

Master Bath Vanity - 2 Part Bathroom - Part #1

  • Motion sensor turns light on in vanity.
  • After no motion detected for 5 minutes, light turns off.
  • Fan does not turn ON with Vanity motion and wait for motion near the shower/toilet room. However, once no motion is not detected in the Vanity or Shower, it will turn off.

Master Bath Shower/Toilet Room off Vanity Room - 2 Part Bathroom - Part #2

  • Motion sensor turns light on in shower room. Fan turns on.
  • After no motion detected for 5 minutes, light turns off.
  • If bathroom is door closed (detected using door contact sensor), no motion detected is extended to 30 minutes before turning off to allow time for showering.

Note - Turning on a switch on and off or off manually also triggers the scenes so you can turnoff early. Sadly, it will not turn on until the motion times out at 5 minutes configured on the Z-Wave motion sensor timeout.

Cheers!

@Rex - Yep, you’re right. Do you think I can simply drop the second rule? Should be fine, right?

@Agile - I never thought about using motion and/or door contact. I’m a little confused though. What do you do with the fan? I see that you fire it but when does it turn off? Is this a PLTS so you’re just using the interval timers? Would you mind sharing your “code”? I pay tuck it away for use as I expand my sensors, experience, etc.

Thanks guys. This forum is fantastic. I hope to one day be able to give back…

@Rex - Yep, you're right. Do you think I can simply drop the second rule? Should be fine, right?

That’s what I would do. You may find another need for the second PLTS Interval in the future. You never know what new detectors are lining-up for crowd-funding…

I think I need help with my reset logic:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00)

My goal is to have the 20 minute timer reset if they’re still in the bathroom for more than 3:00 minutes - in other words I want to run the fan for 20 minutes after they’ve left the room (turned off the light). However, what I need to do is take in account for the fact that the light could be left on. I assume, if the light is left on, that the reset would keep occurring.

How can I inhibit resets if the light is left on for (say) 30 minutes?

(adding motion and/or door contacts could help this obviously - my bank account isn’t going to be happy with Agile!)

Sadly I designed the logic before I learned PLTS and only use it as a timer.

I have a hodgepodge of Compbination Switches, Virtual Switches, and PLST. I’m sure it could move to PLST, but I had some issues initially due to the way PLC handles armed sensors.

Basically, the automatons are fired from a combination switch. When the combination switch or manual light switch turn on, the scene fires on.

The combination switch turns off when no motion is detected from any x of sensors.

One day, I plan to re-write it in PLTS.

[quote=“tbully, post:6, topic:179422”]I think I need help with my reset logic:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00)

My goal is to have the 20 minute timer reset if they’re still in the bathroom for more than 3:00 minutes - in other words I want to run the fan for 20 minutes after they’ve left the room (turned off the light). However, what I need to do is take in account for the fact that the light could be left on. I assume, if the light is left on, that the reset would keep occurring.

How can I inhibit resets if the light is left on for (say) 30 minutes?

(adding motion and/or door contacts could help this obviously - my bank account isn’t going to be happy with Agile!)[/quote]

Try:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00 < 30:00)

[quote=“AgileHumor, post:7, topic:179422”]Sadly I designed the logic before I learned PLTS and only use it as a timer.

I have a hodgepodge of Compbination Switches, Virtual Switches, and PLST. I’m sure it could move to PLST, but I had some issues initially due to the way PLC handles armed sensors.

Basically, the automatons are fired from a combination switch. When the combination switch or manual light switch turn on, the scene fires on.

The combination switch turns off when no motion is detected from any x of sensors.

One day, I plan to re-write it in PLTS.[/quote]

While it probably could be rewritten, this enforces and/or “taught” me that there are certainly more than one way to solve problems. Cool stuff. Thanks for sharing.

[quote=“RexBeckett, post:8, topic:179422”][quote=“tbully, post:6, topic:179422”]I think I need help with my reset logic:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00)

My goal is to have the 20 minute timer reset if they’re still in the bathroom for more than 3:00 minutes - in other words I want to run the fan for 20 minutes after they’ve left the room (turned off the light). However, what I need to do is take in account for the fact that the light could be left on. I assume, if the light is left on, that the reset would keep occurring.

How can I inhibit resets if the light is left on for (say) 30 minutes?

(adding motion and/or door contacts could help this obviously - my bank account isn’t going to be happy with Agile!)[/quote]

Try:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00 < 30:00)[/quote]

[quote=“RexBeckett, post:8, topic:179422”][quote=“tbully, post:6, topic:179422”]I think I need help with my reset logic:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00)

My goal is to have the 20 minute timer reset if they’re still in the bathroom for more than 3:00 minutes - in other words I want to run the fan for 20 minutes after they’ve left the room (turned off the light). However, what I need to do is take in account for the fact that the light could be left on. I assume, if the light is left on, that the reset would keep occurring.

How can I inhibit resets if the light is left on for (say) 30 minutes?

(adding motion and/or door contacts could help this obviously - my bank account isn’t going to be happy with Agile!)[/quote]

Try:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00 < 30:00)[/quote]

Thanks again, Rex. I didn’t realize that you could write time logic like that. Makes sense. I will implement and test but I suspect a favorable outcome.

Sorry everyone. One more look?

It appears that the fan does come on after 3 minutes of the light being on. - GOOD

However, it doesn’t appear to ever reset. The timer starts at 20 minutes and then shuts off. Now, honestly I think this behavior is just fine. 20 minutes is plenty of light-on time for a small bathroom.

But now I’m simply curious as to why it’s not working.

Ideas?

Actually you want RESTART to be:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00 < 10:00)

Why 10 Minutes … Because you want the Lights/ Fan to go off after 30 minutes.
So the timer will get it’s last restart at 10 minutes with the light on … and the Fan and light will turn off 20 minutes later.
Right now if the light is left on past 30 minutes … it will not reset until 50 minutes from the time the light was turned on.

[quote=“RichardTSchaefer, post:12, topic:179422”]Actually you want RESTART to be:

HalfBathLightOn AND (HalfBathLightOn; Now > 3:00 < 10:00)

Why 10 Minutes … Because you want the Lights/ Fan to go off after 30 minutes.
So the timer will get it’s last restart at 10 minutes with the light on … and the Fan and light will turn off 20 minutes later.
Right now if the light is left on past 30 minutes … it will not reset until 50 minutes from the time the light was turned on.[/quote]

Thanks for chiming in, Richard.

I think I get what you’re saying but it’s still just running for 20 minutes and then going “off”. Should I be setting my timer for something less than 10 minutes? Sorry. I know this is a fairly elementary implementation of PLTS. I’m still having some issues grasping this, I think.

The nice thing about computers is they almost always do what they are told …
The problem with computers is they do not always do what you want them to do …
[hr]
I look at your your PLEG status report … and I can see what you told it to do. It looks reasonable.
What behavior are you observing that you do not want/expect ?

I’m not home now so had to test this through the UI.

  1. Turned on light
  2. After 3 minutes, the fan turned on
  3. After 20 minutes, both turned off

So I never saw the restart trigger…[size=8pt]I don’t think?..[/size] ;D

sigh

I’m confused now and don’t know what I want it to do. LOL I guess I expected that RESTART to fire and restart the 20 minute timer. (whether or not that’s a good idea is certainly debatable)

Is the restart even needed? Won’t both just turn off (due to the OFF action) after 20 minutes and that will be then end of it? Maybe what I’m missing is when RESTART is evaluated.

A STATUS report would show you why …
The RESTART is set to true 3 minutes after the light is on. So setting it to true again will not cause it to re-trigger.
I need to allow this condition to be renamed to _Restart

You can do the following:
HalfBathLightOn AND (Restart; NOW > 1:00) AND (HalfBathLightOn; Now < 10:00)

This will cause RESTART to go false the next evaluation of NOW and back to true the following Interval.
So every two minutes it should restart … as long as the Bath light is on … upto 10 minutes … then 20 minutes later (a total of 30 minutes)
it should shut off.

Richard / All -

Just following up. This last suggestion did the trick. A perk to this was I now know how to read status reports and understand their importance.

Thanks for sticking with me through the elementary questions. (I’m sure their are more to follow!)

tbully

Would you mind posting the log for your final version of this? I’m so close to getting this to work but I’m not there.

Thanks in advance.
Joel

Hello Joel -

I actually deviated somewhat from this later on (after adding door sensors).

What are you trying to do and how far along are you? I’m by far an expert but if you share s status report I’m sure someone will chime in.

It can be confusing sometimes, for sure. The good news is you’re surrounded by helpful people that are always willing to help.

Thanks tbully. I was actually trying to recreate what you had done originally here in this thread. Have a light switch trigger the fan after a few minutes and the, based on how long the light was on, run the fan for either a shorter or longer period.

Here is my status report.