Jump to content

Bathroom Script needs a little work...


RichTJ99

Recommended Posts

Posted

Hi,

 

I finally got around to installing a switchlinc relay in the attic for the bathroom fan & the switchlinc dimmer in the bathroom for the regular lights.

 

I have it set so that a fast on turns the fan on, a fast off turns the fan off, and if the fan is on, that 45 minutes later it will turn both the light & fan off.

 

I think it needs a little work as my wife went to take a bath with the light & fan on, then at some point later, I went in & while i was in the lights shut off.

 

Is this just a matter of shutting off the lights & turning them on to reset the program?

 

Here is what i have in the "bathroom" program subfolder:

 

BR fast on

 

If
       Control 'Bathroom: Guest Light' is switched Fast On

Then
       Set 'Bathroom: Guest Fan' On

Else
  - No Actions - (To add one, press 'Action')

 

BR Fast off

 

If
       Control 'Bathroom: Guest Light' is switched Fast Off

Then
       Set 'Bathroom: Guest Fan' Off

Else
  - No Actions - (To add one, press 'Action')

 

BR light 45 minute script:

 

If
       Status  'Bathroom: Guest Fan' is On

Then
       Wait  40 minutes 
       Set 'Bathroom: Guest Fan' Off
       Set 'Bathroom: Guest Light' Off

Else
  - No Actions - (To add one, press 'Action')

 

Thanks,

Rich

Posted

Putting bathroom lighting on a timer isn't usually a good idea unless you have motion sensors to override the program. People don't like being left in the dark in the bathroom. I'd take the lightswitch out of that third program.

 

You have several options for how to deal with the light. You could write a program that automatically dims the light instead of turning it all the way off, or if the room has natural light you could turn it off if during daylight hours, but I'd be reluctant to just turn it off when people are in the house.

Posted

Hi,

 

I actually do have a motion sensor in there. How could I set up those programs so that if it senses motion, it restarts the countdown once that motion stops?

 

Thanks,

Rich

Posted
Hi,

 

I actually do have a motion sensor in there. How could I set up those programs so that if it senses motion, it restarts the countdown once that motion stops?

 

Thanks,

Rich

 

 

Let me know if this works for you:

 

Bath Fan Manual Control

 

If
       Control 'Bathroom: Guest Light' is switched Fast On
       And Control 'Bathroom: Guest Light is not switched Fast Off
Then
       Set 'Bathroom: Guest Fan' On
       Wait 40 minutes
       Run Program 'Bath Fan Manual Control' (Else Path)
Else
       Set 'Bathroom: Guest Fan' Off

 

 

Bath Motion

 

If
       Control 'Bathroom: Guest Motion' is On
       And Status 'Bathroom: Guest Light' is On
Then
  - No Actions - (To add one, press 'Action') 
Else
  - No Actions - (To add one, press 'Action') 

 

 

Bath Light Timeout

 

If
       Time is Last Run Time for 'Bath Motion' + 10 minutes
       And Status 'Bathroom: Guest Light' is On
Then
       Set 'Bathroom: Guest Light Off
Else
  - No Actions - (To add one, press 'Action') 

Posted

Fitzpatri8,

 

Thanks for your help, let me see if i get this straight.

 

Bath Fan Manual Control

 

This says if the BR guest light is switched fast on, and is not turned fast off, then turn on guest fan, wait 40 minutes, then run Bath Fan Manual Control

 

Im not sure I get that portion. Should I remove the other bathroom (fast on / fast off programs I made)?

 

Bath Motion

 

That says if Bathroom motion is on and light is on, then do nothing?

 

Bath Light Timeout

 

This says the last time the bathroom motion has run (after ten min of no motion) and the bathroom light is on, then turn bathroom light off.

 

So the three scripts together

 

Bath fan manual - this is stand alone - any time fast on is detected, it will wait 40 minutes then shut off. If I do a manual fast off, then another fast on, will that reset the fan?

 

Thanks,

Rich

Posted
Fitzpatri8,

 

Thanks for your help, let me see if i get this straight.

 

Bath Fan Manual Control

 

This says if the BR guest light is switched fast on, and is not turned fast off, then turn on guest fan, wait 40 minutes, then run Bath Fan Manual Control

 

Im not sure I get that portion. Should I remove the other bathroom (fast on / fast off programs I made)?

 

 

Bath Fan Manual Control would replace both your BR Fan On and BR Fan Off programs. By adding the "And Control 'Bathroom: Guest Light is not switched Fast Off" line we accomplish two things: if you turn the fan off, the timer aborts, so it won't accidentally turn the fan off early if you activate it again, and you eliminate one program. The Run Else Path jumps to the Else portion of the same program, so if we look at the program status from the ISY console we can see if the program timer is currently running or not.

 

 

Bath Motion

 

That says if Bathroom motion is on and light is on, then do nothing?

 

Almost. The ISY puts a timestamp on the program every time it runs. That's the key to the first line in the next program, Bath Light Timeout: "If From Last Run Time for 'Bath Motion' For 10 minutes."

 

 

Bath Light Timeout

 

This says the last time the bathroom motion has run (after ten min of no motion) and the bathroom light is on, then turn bathroom light off.

 

That's the hope--I'm still new at this myself, that's why I wanted you to tell me if it works!

 

(The original post was wrong. I just edited it and corrected the logic.)

 

Bath fan manual - this is stand alone - any time fast on is detected, it will wait 40 minutes then shut off. If I do a manual fast off, then another fast on, will that reset the fan?

 

Exactly. Let me know if it works as expected!

Posted

 

Let me know if this works for you:

 

Bath Fan Manual Control

 

If
       Control 'Bathroom: Guest Light' is switched Fast On
       And Control 'Bathroom: Guest Light is not switched Fast Off
Then
       Set 'Bathroom: Guest Fan' On
       Wait 40 minutes
       Run Program 'Bath Fan Manual Control' (Else Path)
Else
       Set 'Bathroom: Guest Fan' Off

 

Fitz - will that allow me to do a fast off as a manual off for the fan?

 

 

 

Bath Motion

 

If
       Control 'Bathroom: Guest Motion' is On
       And Status 'Bathroom: Guest Light' is On
Then
  - No Actions - (To add one, press 'Action') 
Else
  - No Actions - (To add one, press 'Action') 

 

 

For some reason I cant get the motion to be "On" its "Switched on". I dont know if that makes a difference. My code is below.

 

If
       Control 'Motion: Bathroom Sensor' is switched On
   And Status  'Bathroom: Guest Light' is On

Then
  - No Actions - (To add one, press 'Action')

Else
  - No Actions - (To add one, press 'Action')

 

 

 

 

Thanks! I will let you know how this goes.

 

RIch

Posted

 

Let me know if this works for you:

 

Bath Fan Manual Control

 

If
       Control 'Bathroom: Guest Light' is switched Fast On
       And Control 'Bathroom: Guest Light is not switched Fast Off
Then
       Set 'Bathroom: Guest Fan' On
       Wait 40 minutes
       Run Program 'Bath Fan Manual Control' (Else Path)
Else
       Set 'Bathroom: Guest Fan' Off

 

Fitz - will that allow me to do a fast off as a manual off for the fan?

 

 

Yes, it should.

 

 

 

For some reason I cant get the motion to be "On" its "Switched on". I dont know if that makes a difference. My code is below.

 

 

That was just a typo on my part. Your code should be fine.

Posted

I just wanted you to know this works great! Just as expected! I am thinking I might change the time for the motion portion to 20 minutes (in case someone is in the bath).

 

I was also wondering if it made sense to add sometihng so that if the light is off & it sees motion, it turns the light on. More for hte person stuck in the bathtub who stands up in the pitch dark (its an interior bathroom).

 

Another thing I was wondering was if it made sense to add something for the dusk/dawn sensor. It seems that the Insteon motion sensors dusk/dawn portion is triggered after 5 minutes of light (or dark).

 

I dont know what that gets us aside from an extra 5 minutes on the timer.

 

Thanks!

Rich

Posted
I just wanted you to know this works great! Just as expected! I am thinking I might change the time for the motion portion to 20 minutes (in case someone is in the bath).

 

I was also wondering if it made sense to add sometihng so that if the light is off & it sees motion, it turns the light on. More for hte person stuck in the bathtub who stands up in the pitch dark (its an interior bathroom).

 

Another thing I was wondering was if it made sense to add something for the dusk/dawn sensor. It seems that the Insteon motion sensors dusk/dawn portion is triggered after 5 minutes of light (or dark).

 

I dont know what that gets us aside from an extra 5 minutes on the timer.

 

Thanks!

Rich

Hi Rich,

 

Definitely I would have motion turn the light on, yes. Then after a period of no motion, turn the light off.

 

My main bath has a motion sensor which covers the room completely, except for the bath/shower, because the bath/shower has doors on it which the sensor can't see through.

 

The main bath door also has a TriggerLinc (formerly a DS10a), so ISY knows whether the door is open or closed. The idea being that if the door is open, the occupant won't be too long (washing hands or whatever), but if the door is closed the occupant could be having a bath/shower and therefore not re-triggering the motion sensor.

 

When the door is open, the lights (and fan) shut off after five minutes of no motion. When the door is closed, that time is increased to 45 minutes, to allow for a nice hot bath or a leisurely 20 minute shower :roll: .

 

It could be set longer for that matter. After all, if the door is closed and there is no motion for an hour, there is a more serious problem than the lights being left on!

 

But when the door is opened, the timer reverts from the long period to the short period, so the lights don't stay on for 45 minutes!

Posted

So what would be the best way to add motion turning the light on into the mix? Should it be added to the "bathroom motion" script?

 

I admit the programing logic is hard for me to grasp, the terms of control vs status are a little confusing.

 

 

Logically speaking:

 

If

Control 'Bathroom: Guest Light' is switched Fast On

And Control 'Bathroom: Guest Light' is not switched Fast Off

Control meaning that if the fast on is "on" & Fast off, is "not off"

 

Then

Set 'Bathroom: Guest Fan' On

Wait 30 minutes

Run Program 'Bathroom Fan Manual Control ' (Else Path)

Again fast on is on & fast off is not off - then turn on the fan, wait 30 min, then run this program were already in (I dont understand this), it goes back to the begining?

 

Else

Set 'Bathroom: Guest Fan' Off

I dont get how it knows to go to off, is it because the status (though its control & I am not sure what that means) is neither fast on or "not" fast off?

 

Thanks,

Rich (very confused, but really wants to learn this)

Posted
the terms of control vs status are a little confusing.

See if this helps:

 

A "control" event happens when the associated switch (control) is operated. The event exists only at the instant the control is activated and the associated message is received by the ISY. It does not create any lingering state which can be evaluated later in a condition. (Control conditions are always FALSE if the IF is evaluated any time the event was not what triggered evaluation of the conditions.)

 

A "status" condition is the actual status of the device, no matter how it got that way. A program can evaluate a "status" condition at any time. Although it's useful to know that a change in status (as seen by the ISY) will cause a program with a condition on that status to stop (if running) and reevaluate the IF clause in its entirety.

 

And this is a key to understanding ISY programming logic: a program's IF clause will run whenever any of the specific condition items in that IF change state (status) or are activated (control). It won't run any other time (unless called manually or there are other conditions such as time).

 

So consider this commonly used construct, from your example:

 

If Control 'Bathroom: Guest Light' is switched Fast On
And Control 'Bathroom: Guest Light' is not switched Fast Off 

 

When does this IF execute? Whenever the 'Bathroom: Guest Light' switch is turned Fast On OR turned Fast Off. Either action causes it to run.

 

The next step is to evaluate the logic once the program runs:

 

- If the event is a FAST ON (which means that a FAST OFF could not have been received at the same time), then both conditions are TRUE and the fan turns on (THEN clause):

(FAST ON) AND NOT (FAST OFF) = (TRUE) AND NOT (FALSE) = TRUE AND TRUE = TRUE

 

- Similarly, if the event is a FAST OFF (which means that a FAST ON was not received) then the condition is FALSE and the fan turns off:

(FAST ON) AND NOT (FAST OFF) = (FALSE) AND NOT (TRUE) = FALSE AND FALSE = FALSE

 

The presence of the NOT OFF is why the ELSE turns off the fan. It's also why the program is interrupted if it's in the WAIT when the FAST OFF is received: the event causes the IF to reevaluate: it's now FALSE, and the fan turns off.

 

Clearer, I hope!

 

--Mark

Posted
So what would be the best way to add motion turning the light on into the mix? Should it be added to the "bathroom motion" script?

 

The simplest option would be to add to the Else portion of the Bath Motion program. "Else Set 'Bath: Guest Light' On"

 

As best I can tell, adding door open/closed logic to adjust timers would require adding a couple of programs. We haven't even addressed the ambient light question--if this bathroom has a window, do you want the outside light level (as determined by the optional Weatherbug module, since the motion detector's dusk/dawn detector needs 3+ minutes to adjust to changing conditions) to influence whether motion turns on the light? This could get complicated!

  • 2 weeks later...
Posted
So what would be the best way to add motion turning the light on into the mix? Should it be added to the "bathroom motion" script?

 

The simplest option would be to add to the Else portion of the Bath Motion program. "Else Set 'Bath: Guest Light' On"

 

Fitz - thanks for the help, that works great. Its nice to walk into the bathroom & have the light turn itself on. I am debating adding a triggerlinc so the light turns on when the door opens but I am not sure how the two would interact.

 

Darrel - thanks for putting your info up, I am sure I will have plenty of questions soon!

 

Thanks,

Rich

Posted

Actually, the light seems to keep putting itself on for no reason. Any ideas if I did something wrong?

 

Motion Script:

 

If
       Control 'Motion: Bathroom Sensor' is switched On
   And Status  'Bathroom: Guest Light' is On

Then
  - No Actions - (To add one, press 'Action')

Else
       Set 'Bathroom: Guest Light' On

 

Bathroom Light Timeout:

 

 

 

 

 

If
       Time is Last Run Time for 'Bathroom Motion ' + 25 minutes
   And Status  'Bathroom: Guest Light' is On

Then
       Set 'Bathroom: Guest Light' Off

Else
  - No Actions - (To add one, press 'Action')


 

 

Bathroom Fan Manual Control:

 

If
       Control 'Bathroom: Guest Light' is switched Fast On
   And Control 'Bathroom: Guest Light' is not switched Fast Off

Then
       Set 'Bathroom: Guest Fan' On
       Wait  30 minutes 
       Run Program 'Bathroom Fan Manual Control ' (Else Path)

Else
       Set 'Bathroom: Guest Fan' Off


 

Thanks for the help figuring this out.

 

Thanks,

Rich

Posted
Actually, the light seems to keep putting itself on for no reason. Any ideas if I did something wrong?

 

Motion Script:

 

If
       Control 'Motion: Bathroom Sensor' is switched On
   And Status  'Bathroom: Guest Light' is On

Then
  - No Actions - (To add one, press 'Action')

Else
       Set 'Bathroom: Guest Light' On

Rich, change your first program to:

 

If
       Control 'Motion: Bathroom Sensor' is switched On
   And Status  'Bathroom: Guest Light' is NOT On

Then
       Set 'Bathroom: Guest Light' On

Else
  - No Actions - (To add one, press 'Action')

Posted

While my wife thinks I am a little OCD.....

 

Anyway, I am playing with some new ideas that I saw while looking at Darrel's scripting. The Slow Dim to off idea.

 

I added a new scene called Scene: Bathroom Motion Ramp. The only item in this scene is the bathroom light & the ramp rate is 60 seconds. The idea being when the light goes out it takes 60 seconds & if someone moves, the lights go back on.

 

This is good but while the lights do dim, when there is motion, they go back up at the same slow speed (which i guess is OK but I dont understand why it does this).

 

Here is my current attempt at a program:

 

If
       Time is Last Run Time for 'Bathroom Motion ' +  1 minute
   And Status  'Bathroom: Guest Light' is On

Then
       Set Scene 'Scene: Bathroom Motion Ramp P' Off
       Wait  5 seconds
       Set 'Bathroom: Guest Light' Off

Else
  - No Actions - (To add one, press 'Action')

 

I had to add that extra "Wait & "Set Off" as I think that when just the scene turned off the lights, the ISY didnt register the bathroom light as off, even though the scene turned it off.

 

All my other scripts for the bathroom are the same as well. I may add a triggerlinc into the mix at some point too.

 

Any advice is welcomed.

 

Thanks,

Rich

  • 3 weeks later...
Guest
This topic is now closed to further replies.

×
×
  • Create New...