So, I have the following items:
DateTime Night_Start "Night Start [%1$tH:%1$tM]" { channel="astro:sun:myastrothing:night#start" }
DateTime Night_End "Night End [%1$tH:%1$tM]" { channel="astro:sun:myastrothing:night#end" }
DateTime Day_Start "Day Start [%1$tH:%1$tM]" { channel="astro:sun:myastrothing:daylight#start" }
DateTime Day_End "Day End [%1$tH:%1$tM]" { channel="astro:sun:myastrothing:daylight#end" }
And, the following in rules:
val night_beg = new DateTime(Night_Start.state.toString)
val night_end = new DateTime(Night_End.state.toString)
val day_beg = new DateTime(Day_Start.state.toString)
val day_end = new DateTime(Day_End.state.toString)
And the following logic in a rule:
if( now.isAfter(day_end) &&
now.isBefore(day_beg) &&
zwave_device_16500637f6a_node11_switch_binary.state == OFF) {
logInfo("Driveway Motion Rule", "Send Amber lamp on")
zwave_device_16500637f6a_node11_switch_binary.sendCommand(ON)
createTimer(now.plusMinutes(30), [ | zwave_device_16500637f6a_node11_switch_binary.sendCommand(OFF) ])
}
The intent being to have the light come on for 30 minutes, if it between day_end and day_beg (day_beg as in the beginning of tomorrow).
Since the light never comes on, I’m guessing my day_beg is actually referring to beginning of the current day, thus the logic fails.
Assuming this is the case, I need to add 24 hours to day_begin. (I don’t see any “tomorrow morning” like methods on now() or Astro…but, that could be my search engine skills. )
I’m thinking I could add another Astro thing with an offset of 24 hours, but is there an easier/better way?