PLTS Example - A Smarter Bathroom Fan

I’m posting this as an example of how the Program Logic Timer Switch (PLTS) twin timing intervals can be useful.

I have long been aggravated by the way my en-suite bathroom fan operates. As installed by the builder, the fan triggers whenever the bathroom light is switched on. After the light is turned off, the fan keeps running for a period set by its internal timer. The minimum setting is about three minutes - long enough to be annoying when the bathroom is used during the night. There is an isolator switch that disables the fan but, if I turn it off, I forget to turn it on again so then when I use the shower the bathroom gets all steamed-up. Even when the fan runs I have to leave the light switched on for at least 30 minutes after I use the shower to clear the room of water vapour. Then I discover I left it running all day. It’s just a pain!

In a previous house I triggered the bathroom fan whenever the shower pump ran. The current house uses a pressurized water system so has no shower pump. I could fit a flow sensor in the shower feed pipes but they are under the floor. :cry:

I needed a smarter way to control the fan. That sounds like a job for a PLTS! :slight_smile:

So, I replaced the simple on/off light switch with a Fibaro FGS221 dual relay module behind a dual on/off switch plate. One relay controls the light and the other controls the fan. Each relay is controlled by its own switch and, of course, Z-Wave.

The PLTS is configured like this:

Input Triggers
LightOn: EnSuite Light is turned on
LightOff: EnSuite Light is turned off
FanOn: Ensuite Fan is turned on
FanOff: Ensuite Fan is tuned off

Conditions
Interval: 45:00
Interval2: 5:00
ResetState: Off
SwitchMode: Immediate Toggle/Delayed Reset

Condition Trigger Expressions
Reset: FanOff
Trigger:
Trigger2: LightOn and ((LightOn; Now > 03:00) or (LightOff; LightOn < 10))
Restart: LightOn and (LightOn; Now > 06:00)
Restart2:
On: FanOn
Off:

Actions
On: Switch EnSuite Fan On
Off: Switch EnSuite Fan Off

Here’s how it works now: The fan does not start unless the light is turned on for at least three minutes (3:00 to 3:59) and then it will start with a timer of 5 minutes (Interval2). If the light stays on for over six minutes, I’m probably in the shower so the timer is restarted for 45 minutes (Interval). When the light is turned off, the fan keeps running until the timer completes its countdown. I can also trigger the fan if I chose by turning the second wall switch on and it will run for 45 minutes and then turn off. If I turn the fan wall switch off (or on then off if it’s already off) the fan will stop immediately. The fan can also be triggered to run for 5 minutes by turning the light off then on again within 10 seconds.

It isn’t artificial intelligence but it’s considerably smarter than it was. ;D

Edit: Added trigger for 5 minutes by LightOff/LightOn sequence.

Why not use a Z-Wave humidity sensor to trigger the fan?

That’s a good idea! It really hadn’t crossed my mind. ::slight_smile: I shall track down a bathroom-friendly sensor and give it a whirl. Thanks for the inspiration.

I am trying to do something a lot simpler, just have a motion sensor trigger a light for 3 minutes. Looking at your description here looks all pretty simple. Just when i enter 3:00 into interval, close the dialog with the cross, i do not get the ‘save’ in UI5, and when i reopen the interval setting is gone. Whatever i do, i seem not to be able to save the interval time.

@mikee123
Sorry, That was a bug in my last release … I thought I had tested that code path … but I missed it.

I will have a patch for this and a couple of other bugs posted later today.

I have released a patch …

See: [url=http://forum.micasaverde.com/index.php/topic,14155.0.html#new]http://forum.micasaverde.com/index.php/topic,14155.0.html#new[/url]

The patch worked great, so now i can continue and try to figure out how it’ll do what i want it to do ! That could be a little more time consuming…

Great to see an example of “How to”, but I’m a beaten man after reading through all the examples I could find, the closest being the Fan in En-suite, I just can’t get my head around it possibly because I now can’t see the forest for the tree’s ! ;D

In my scenario I want to use an AEON 4 in 1 Sensor to detect motion and use it to trigger a passage and entry light (2 * Z-Wave switches), leave one on for 4 min’s, the other 3 min’s, but only when the light level from the AEON sensor is below a certain level.

I’m hoping someone can prevent premature baldness as well… :slight_smile:

Try a PLEG configured thus:

Inputs Triggers
Motion Multisensor Motion armed is tripped

Inputs Device Properties
LightLevel Multisensor Light CurrentLevel

Conditions
LightsOn Motion and (LightLevel < 100) <Note: Replace 100 with required threshold>
Light1Off LightsOn; Now > 3:00
Light2Off LightsOn; Now > 4:00

Actions
LightsOn
Light1Off
Light2Off

There isn’t currently a Z-Wave module for premature baldness but try the following:

Actions
ASAP Buy_A_Hat

;D

Thanks Rex, I’ll be using ASAP very soon.

[i][b]Inputs Triggers
Motion Multisensor Motion armed is tripped

Inputs Device Properties
LightLevel Multisensor Light CurrentLevel

[/b][/i]

OK so far so good, now I get lost with…

Conditions
LightsOn Motion and (LightLevel < 100) <Note: Replace 100 with required threshold>
Light1Off LightsOn; Now > 3:00
Light2Off LightsOn; Now > 4:00

This is probably the most stupid question to hit this forum, but where do I place these on the conditions TAB?

Like so:

Sorry, have no idea how to embed the image into the body of this post, have attached screenshot as attachment.
I must have it so wrong as the condition tab bears no resemblance to your shot.

edit, ahh somethings has gone right for me at last with the SS…

Your screenshot is from a Program Logic Timer Switch (PLTS) device. I suggest you use a Program Logic Event Generator (PLEG) for this application. They work on the same principles but PLTS has a single on/off output while PLEG has as many as you care to define as conditions and actions.

Because you want your two lights to have different stay-on timers, PLEG is better suited. You could use two PLTS devices but this would consume more Vera memory. Also you will probably find, once you get this working, you will want to add more conditions and/or features. PLEG has almost limitless capability to do stuff so it is well worth your time to learn how to use it.

Little wonder I couldn’t find a way to make it work… ;D

Now you have a PLEG How to Night light, perhaps a separate thread for nobs like me… ???

Spoke to soon…

I get:

Program Logic Event Generator[42] : Startup Lua Failed

:frowning:

edit: reloaded and crossing fingers…
edit2: In the Advanced Tab, should
Device #42
Controlled via Program Logic Core []
Device params

Be controlled by the PLC?
It had No Parent selected when created.

Lights are turning on, but not timing out ???

It’s OK to look … but the only thing you should ever change in the Advanced Tab is the Debug field.
The rest are internals for the PL plugins. Changing things there will likely Destoy that PL device instance.

If you have a DEAD PL device … create a new one First then delete the old one.
This will guarantee that you get a new device ID and there is no possibility of using any retained … corrupted state.

so what should the device be controlled by?

so what should the device be controlled by?
No Parent.

If you want help with the

Lights are turning on, but not timing out
please post the report from the PLEG. You can post it as a JPEG using Windows7 Snipping Tool or print it to a PDF.

All ZWave devices are controlled by a single built-in Zwave controller.
Same for Scenes and many other Hardware oriented devices that share a common hardware interface.

Most Software devices (PLUGINS) are self controlled … In some cases a Software Plugin will control child devices … Like the Weather plugin controls multiple temperature and a humidity child devices.

The concept of controlled by is an implementation detail!