Hello,
I want to trigger a rule at sunrise via the astro binding. In general the other rules using the astro binding work fine. Also the value of the sunrise item is shown fine in the sitemap.
However, the usage of sunrise in the rules file is triggering the rule twice. Apparently, the sun rises once at 11 pm CET and then again at the correct time in the morning (currently 5.38 am CET).
As 11 pm CET looks a lot like midnight UTC, I am suspecting the error in this area.
my.rules:
rule "outdoor_lights_off"
when
Channel 'astro:sun:home:rise#event' triggered START
then
....
end
and then used that statuses to turn my lights on and off.
i searched the Astro binding in the community and there is a bunch of guys that say it has double triggers. that was my main reason for changing to TOD.
My Rule:
rule "Stoep Light On"
when
Item vTimeOfDay changed to "EVENING"
then
if (Alarm_Status.state == "Disarmed") {
Kitchen_Light_Stoep.sendCommand(ON) }
if (Alarm_Status.state == "Armed-Stay") {
Kitchen_Light_Stoep.sendCommand(ON) }
if (Alarm_Status.state == "Armed-Away") {
Kitchen_Light_Stoep.sendCommand(ON) }
end
rule "Stoep Light Off"
when
Item vTimeOfDay changed to "BED"
then
if ( Alarm_Status.state == "Armed-Stay" ) {
Kitchen_Light_Stoep.sendCommand(OFF) }
if ( Alarm_Status.state == "Disarmed" ) {
sendBroadcastNotification("Stoep Light Still On" + " - " + now.toString("MM/dd HH:mm ")) }
end
rule "Stoep Light Off Armed"
when
Item vTimeOfDay changed to "MORNING"
then
if ( Alarm_Status.state == "Armed-Away" ) {
Kitchen_Light_Stoep.sendCommand(OFF) }
end
I am still surprised that such a trivial thing as using the sunrise from the astro binding in one rule can cause trouble. I am not really happy with that as my current code is simple and straight forward.
None the less, I will give the suggested pattern a try as it looks good for future extensions. Thanks for the suggestion.