Jump to content

Programming Wisdom Please


jpiroli

Recommended Posts

I have been interested home automation for quite some time. Just recently pulled the trigger and bought an ISY with 4 switchlinc dimmers to get me started. I am now finding myself immersed in figuring out the programming, but need some advice from more seasoned users.

 

I have a light in my front room for which I created a scene (to illuminate at 40%). I created a program to run the scene from sunset to sunrise:

 

If
       From    Sunset 
       To      Sunrise (next day)

Then
       Set Scene 'IL Night Timer' On

Else
       Set Scene 'IL Night Timer' Off

 

I have found that if a family member increases the light output, it does not affect the fact that the light will remain on until the end of the program. It's brighter than I would like but still meets the purpose of the "nightlight". But, if the light is turned off, is there a way to modify the program so that the ISY will identify the light is off and after a short delay (maybe 10 minutes) return it to the correct scene to complete the program?

 

Thanks

Link to comment

This Program is separate from the posted Program. It reacts to the ‘nightlight’ being turned off between Sunset and Sunrise, waits 10 minutes and turns the Scene On.

 

If
       From    Sunset 
       To      Sunrise (next day)
And  Status ‘nightlight’ is Off 

Then
       Wait 10 minutes
       Set Scene 'IL Night Timer' On

Else

Link to comment

LeeG,

 

Thank you so much. That's a lot simpler than the direction I was going... I was thinking that "false" had to be in there somewhere.

 

In the future I am planning on adding devices to the scene. Would independent programs need to be added for each device?

 

Again, thanks.

Link to comment

Not independent Programs but Yes the 2nd Program would have to change. Assuming that there are multiple load controlling devices in the Scene and any of the load controlling devices being turned Off should reestablish the entire Scene. If only the 'nightlight' being turned Off should reestablish the Scene then the Program is good as written.

 

If
       From    Sunset 
       To      Sunrise (next day)
And (
       Status ‘nightlight’ is Off 
   Or Status 'device2' is Off
   Or Status 'device3' is Off
     ) 
Then
       Wait 10 minutes
       Set Scene 'IL Night Timer' On

Else

Link to comment

One thing that you may have to watch out for with this second program is the possibility that someone turns off the nightlight less than ten minutes before sunrise. I am concerned that, were this to happen, the wait period would continue and turn the night light on AFTER sunrise.

 

The simple solution might be a slight modification to the second program, such as:

 

If
       From    Sunset 
       To      Sunrise - 10 minutes (next day)
And  Status ‘nightlight’ is Off 

Then...

Link to comment

I don't think that would be a problem here. The if will reevaluate false at sunrise during the 10 minute wait and the light will not be turned back on. Looks fine to me as LeeG has it.

 

-Xathros

Link to comment
The if will reevaluate false at sunrise during the 10 minute wait and the light will not be turned back on.

 

Are you sure? If the lights were manually turned off during the night, the status would change at that time, triggering the wait program. If, at sunrise, if the lights were already off because of a manual intervention, there would be no status change, thus no trigger and no reevaluation.

 

Am I missing something?

Link to comment

The From ... To is also a trigger and triggers twice - Once at the From time and again at the To time. If the only condition was the From...To, then the program would trigger and run true at the From time and trigger and run false at the To time. As LeeG posted the program, the program will always run false at sunrise time regardless of the nightlight status.

 

And besides, the very first program the OP posted would still turn the light off at Sunrise based on it's else clause.

 

-Xathros

Link to comment

Hi Guys

 

The key, as Xathros has noted, is the To time arrival triggers the 2nd Program independent of the Status of the 'nightlight'. The If must evaluate to False independent of the Status of the 'nightlight' because it is now past the To time value. Assuming the only thing in an If is a From/To time range, the From time trigger is always True, the To time trigger is always False. The 2nd Program has a null Else so the only thing functional that happens is the cancel of an active Wait (if the Program was in a Wait) which prevents the 2nd Program from turning the Scene On after the To time.

Link to comment

I incorporated the program from LeeG and tested it last night. Worked like a charm.

 

Oberkc, after I got to thinking about it, I had the same thought that maybe there would be a hiccup if the light were to be turned off within 10 minutes of the program end at sunrise. But then concluded that in this case the offending parties would most likely be asleep anyways.

 

Really appreciate the feedback everyone.

 

Thanks!

Link to comment
Oberkc, after I got to thinking about it, I had the same thought that maybe there would be a hiccup if the light were to be turned off within 10 minutes of the program end at sunrise. I had the same thought that maybe there would be a hiccup if the light were to be turned off within 10 minutes of the program end at sunrise.

 

As usual, LeeG and Xathros were correct. The part that I missed was that the proposed second program would trigger at sunrise and ALWAYS evaluate as false, regardless of any light status. When this happens, the wait statement will, in effect, halt and no further action will take place (empty else statement).

 

Yes, this is a pretty remote scenerio, but no need to adress it from a programmatic standpoint.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...