Astro binding triggering twice

Tags: #<Tag:0x00007f61752dba80> #<Tag:0x00007f61752db6e8> #<Tag:0x00007f61752d9fa0>

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). :wink:

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

astro.things:

astro:sun:home  [ geolocation="xx,yy", interval=60 ]

This is running on version 2.5.3 of openhab. While I usually configure OpenHAB via text files, I have set the timezone via PaperUI.

Have a look in your events.log for 00:00:30, there might be more to see

I have used


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

Thanks to @rossko57 it is working like a dream.

I can see in the logs that the values that I use with the Astro Binding are updated with a new day.

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.

Just remember my rule looks complicated but. I take my alarm status in consideration. But it jas been working like a charm.