Noremac Posted October 30, 2015 Posted October 30, 2015 I have a light that I would like to come on at either 4:30pm, or 2 hours before sunset, whichever occurs LATER. With this criteria, the light would never come on before 4:30pm, but could come on well after 6pm on the longest days of the year. How would I capture this logic with a 994i timer? Many thanks!
jerlands Posted October 30, 2015 Posted October 30, 2015 I hacked this out quickly using v. 5.02 firmware and haven't tested because I'm in route soon but should give you an idea. (also noticed the 3rd program should have a time value to run in If) It took me 3 "State" variables and 5 programs. I'm probably overlooking something very simple s.1630.time.in.seconds - name whatever but it's value is 59,400 (seconds) (also put value in Init) s.2hrs.before.sunrise.in.seconds s.sunset.in.seconds 1st program sets variable $s.sunset.in.seconds Set Sunset In Seconds - [ID 007B][Parent 00CC] If Time is 4:00:00PM Then $s.sunset.in.seconds = [Sunset Today (seconds)] Else - No Actions - (To add one, press 'Action') 2nd Program sets $s.2hrs.before.sunrise.in.seconds Set 2 Hours Before Sunrise - [ID 0010][Parent 00CC] If Time is 4:00:05PM Then $s.2hrs.before.sunrise.in.seconds = $s.sunset.in.seconds $s.2hrs.before.sunrise.in.seconds -= 7200 Else - No Actions - (To add one, press 'Action') 3rd Program compares the two variables 1630 or 2hrs Before Sunset - [ID 00D2][Parent 00CC] If $s.1630.time.in.seconds > $s.2hrs.before.sunrise.in.seconds Then Disable Program '1630 Outside Lights' Else Disable Program '2hrs Before Sunset Outside Lights' The next two programs run either at 4:30pm and 2 hours before sunset 1630 Outside Lights - [ID 00D3][Parent 00CC] If Time is 4:30:00PM Then Set Scene 'Outside Front Door Light' On Else - No Actions - (To add one, press 'Action') 2hrs Before Sunset Outside Lights - [ID 00DA][Parent 00CC] If Time is Sunset - 2 hours Then Set Scene 'Outside Front Door Light' On Else - No Actions - (To add one, press 'Action') Jon...
Noremac Posted October 30, 2015 Author Posted October 30, 2015 Thanks for the approach, Jon. I too am hoping there is something simpler that makes use of if/then/else/and/or logic!
ScottAvery Posted October 30, 2015 Posted October 30, 2015 Have we figured out how to insert a variable in wait? I am away from my system and won't be able to test this anytime soon, but my approach to trim this down would be one program that executes at 4:30pm that sets a single state variable to the difference between sunset and 6:30 pm (sunset minus value for 6:30). second program reacts to the once daily change of the state variable to execute if state variable is greater than zero, wait that amount of time and turn on the light, else turn it on immediately. if we can't use a variable in wait then I guess it would take more work. I never switched over from state machine approach so dunno how the variables actually work!
BamBamF16 Posted October 31, 2015 Posted October 31, 2015 I'm not in front of my computer but is it possible to add 2 time criteria to an if statement? If from 430 to sunrise (next day) And From sunset-2 hr to sunrise (next day) Then .... Else That would evaluate at both 430 and ss-2 hr, and sunrise correct? And would only be true when inside both time conditions? Of course if you can't enter 2 time conditions then ignore all of my silliness. Jeff
paulbates Posted October 31, 2015 Posted October 31, 2015 Give these 2 a try. I didn't have a way to test, but should be easy to try and evaluate results This program meets the first part of the requirement: If its 4:30, and its within a window of time 2 hours before sunset, turn lights on. The 2 hour window is for cases where sunset doesn't line up exactly at 4:30. I'm not sure how long before 4:30 sunset can be for your location. This could be reduced to that actual gap. Lights at 4:30 - [ID ][Parent 0001] If Time is 4:30:00PM And From Sunset - 2 hours For 2 hours Then Set 'Garage / Garage Lights' On Else - No Actions - (To add one, press 'Action') This second program is for times when sunset - 2 is after 4:30. The other program may decide not to execute, this one always will. The 'And' clause keeps it from executing too soon, before 4:31, but allows it to execute up till the latest sunset time. Again, I don't know what that is worst case for you, so the 3 hour, 30 minute window can be adjusted to your worst case scenario, summer solstice ( - 2 hours) The thing to note is that there will be times that the above program will turn them on, and this will also turn them on too. You won't notice it, just fyi. Lights sunset after 4:30 - [ID 0034][Parent 0001] If Time is Sunset - 2 hours And From 4:31:00PM For 3 hours and 30 minutes Then Set 'Garage / Garage Lights' On Else - No Actions - (To add one, press 'Action')
Recommended Posts