I am trying to setup a rule that triggers lights when my cloud value is higher than 60. Basically, when it starts getting a little darker outside, I want the lights to come on.
I have it working with a dummy switch now, but I have to hard code the hours. I’d like to use the hours from the astro binding, but I don’t know how to do that.
rule "Lights for Clouds On"
when
Item weather_clouds changed
then
if ( now.getHourOfDay > 7 && now.getHourOfDay < 18 ) {
if ( weather_clouds.state > 60 ) {
dummy.sendCommand(ON)
}
}
end
Instead of using now.GetHourOfDay compared to a number, I’d like to compare that to the sunrise and sunset events. Basically, if this hour is within the range of sunrise and sunset, then trigger, but if it’s at night time, then don’t trigger.
The items I have right now are:
DateTime sunset_time "Sunset [%1$tH:%1$tM]" <sun> (astro) {channel="astro:sun:home:set#start"}
DateTime sunrise_time "Sunrise [%1$tH:%1$tM]" <sun> (astro) {channel="astro:sun:home:rise#end"}
Any help is greatly appreciated,
Will