Astro Sunset Event does not trigger while Sunrise event does

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Plus Rev 1.3
    • OS: Raspbian GNU/Linux 10 (buster)
    • Java Runtime Environment: (Zulu 8.48.3.246-CA-linux_aarch32hf) (build 1.8.0_265-b11)
    • openHAB version: 2.5.10-1 (Release Build)
    • astro binding version: 2.5.10
  • Issue of the topic: After configuring the astro binding, the sunrise event fires every morning but the sunset event does not.

Apologies if this was answered else where. I’ve been searching for a couple days and haven’t found anything that has worked. I was previously running 2.4.0 Release a month ago on the same hardware and the same things and rules were working then. I ran the 2.5.9 openhab and astro binding versions for a couple weeks with the sunset event not firing. I upgraded to 2.5.10 a couple days back and the sunset event still doesn’t fire. I have tried restarting the Raspberry Pi, reinstalling the astro plugin as well as changing the location. Here’s the things configuration, rules and logs.

things.things:

astro:sun:home [geolocation="45.5242, -122.6673", interval=120]

rules.rules:

rule "PorchLights Off"
when
        Channel 'astro:sun:home:rise#event' triggered
then
        logInfo("Info" , "Sun rise event")
        switch(receivedEvent.getEvent()) {
                case "START": {
                        PorchLights.sendCommand(OFF)
                }
        }
end

rule "PorchLights On"
when
        Channel 'astro:sun:local:set#event' triggered
then
        logInfo("Info", "Sun set event")
        switch(receivedEvent.getEvent()) {
                case "START": {

                        PorchLights.sendCommand(ON)
                }
        }
end

logs:

Correctly working sunrise event

2020-11-02 14:14:00.014 [vent.ChannelTriggeredEvent] - astro:sun:home:astroDawn#event triggered START

2020-11-02 14:14:00.019 [vent.ChannelTriggeredEvent] - astro:sun:local:astroDawn#event triggered START

2020-11-02 14:14:00.023 [vent.ChannelTriggeredEvent] - astro:sun:local:morningNight#event triggered END

2020-11-02 14:14:00.028 [vent.ChannelTriggeredEvent] - astro:sun:home:morningNight#event triggered END

2020-11-02 14:48:00.006 [vent.ChannelTriggeredEvent] - astro:sun:home:astroDawn#event triggered END

2020-11-02 14:48:00.010 [vent.ChannelTriggeredEvent] - astro:sun:home:nauticDawn#event triggered START

2020-11-02 14:48:00.014 [vent.ChannelTriggeredEvent] - astro:sun:local:astroDawn#event triggered END

2020-11-02 14:48:00.019 [vent.ChannelTriggeredEvent] - astro:sun:local:nauticDawn#event triggered START

2020-11-02 15:23:00.012 [vent.ChannelTriggeredEvent] - astro:sun:home:nauticDawn#event triggered END

2020-11-02 15:23:00.016 [vent.ChannelTriggeredEvent] - astro:sun:local:nauticDawn#event triggered END

2020-11-02 15:23:00.019 [vent.ChannelTriggeredEvent] - astro:sun:local:civilDawn#event triggered START

2020-11-02 15:23:00.023 [vent.ChannelTriggeredEvent] - astro:sun:home:civilDawn#event triggered START

==> /var/log/openhab2/openhab.log <==

2020-11-02 15:55:00.021 [INFO ] [.eclipse.smarthome.model.script.Info] - Sun rise event

==> /var/log/openhab2/events.log <==

2020-11-02 15:55:00.008 [vent.ChannelTriggeredEvent] - astro:sun:home:rise#event triggered START

2020-11-02 15:55:00.012 [vent.ChannelTriggeredEvent] - astro:sun:local:rise#event triggered START

2020-11-02 15:55:00.016 [vent.ChannelTriggeredEvent] - astro:sun:local:civilDawn#event triggered END

2020-11-02 15:55:00.021 [vent.ChannelTriggeredEvent] - astro:sun:home:civilDawn#event triggered END

2020-11-02 15:55:00.062 [ome.event.ItemCommandEvent] - Item 'PorchLights' received command OFF

2020-11-02 15:55:00.067 [nt.ItemStatePredictedEvent] - PorchLights predicted to become OFF

2020-11-02 15:55:00.097 [vent.ItemStateChangedEvent] - PorchLights changed from ON to OFF

==> /var/log/openhab2/openhab.log <==

2020-11-02 15:58:00.022 [INFO ] [.eclipse.smarthome.model.script.Info] - Sun rise event

==> /var/log/openhab2/events.log <==

2020-11-02 15:58:00.005 [vent.ChannelTriggeredEvent] - astro:sun:local:daylight#event triggered START

2020-11-02 15:58:00.009 [vent.ChannelTriggeredEvent] - astro:sun:home:rise#event triggered END

2020-11-02 15:58:00.013 [vent.ChannelTriggeredEvent] - astro:sun:home:daylight#event triggered START

2020-11-02 15:58:00.016 [vent.ChannelTriggeredEvent] - astro:sun:local:rise#event triggered END

Missing sun set event:
2020-11-01 20:56:00.005 [vent.ChannelTriggeredEvent] - astro:sun:local:noon#event triggered START

2020-11-01 20:56:00.009 [vent.ChannelTriggeredEvent] - astro:sun:home:noon#event triggered START

2020-11-01 20:57:00.005 [vent.ChannelTriggeredEvent] - astro:sun:home:noon#event triggered END

2020-11-01 20:57:00.009 [vent.ChannelTriggeredEvent] - astro:sun:local:noon#event triggered END

2020-11-02 03:40:00.006 [vent.ChannelTriggeredEvent] - astro:sun:local:morningNight#event triggered START

2020-11-02 03:40:00.011 [vent.ChannelTriggeredEvent] - astro:sun:home:morningNight#event triggered START

Note, I have two things because I setup an astro thing in paperUI to see if that configuration would trigger sun:set properly but it doesn’t. I can remove the paperUI thing but it doesn’t have any effect on the the events.
I’ve browsed a lot of the posts here, most of them started 2+ years ago and it seems like most of them just kinda resolve without any specific action. Hoping someone can point me in the right direction, thanks in advance!

So, this does not work

when
Channel ‘astro:sun:home:rise#event’ triggered

but this works

when
Channel ‘astro:sun:local.set#event’ triggered

I assume they are not both Thing names. Try using local in the one that does not work.

This is what I use:
thing:

astro:sun:home [ geolocation="53.316849, 9.863902,51", interval=60 ] {
    Channels:
        Type rangeEvent : set#event [
            offset=-0,
            latest="21:59"
        ]
}

rule:

rule "rule triggered by sun set ( to turn on aussenlicht on sunset )"
when
    Channel 'astro:sun:home:set#event' triggered START
then
        if ( ( now.isBefore(now.withTimeAtStartOfDay.plusHours(21).plusMinutes(15)) ) ) {
                logInfo( "rule triggerd by sun set", "SunSet before 21:15" )
                Rule_Aussenlicht_einschalten.postUpdate( ON )
        }
        else {
                logInfo( "rule triggerd by sun set", "SunSet after 21:15" )
        }
end

This often the case, I agree.
Sometimes it is a matter of patience and/or binding reinitialize - the “standard” Astro job schedule for the day ahead is set up each midnight, and for that your Things must previously have been loaded correctly.

In your case there seems to have been plenty of opportunity for that already, so let’s go on a different tack.
Abandon your ‘local’ Thing, in case of interference from discovery services, or some previously messed up config lingering, and recreate with some unique new iD, ‘myhome’ or whatever.

The rule specifies home so yeah local doesn’t do anything right now. I setup local through PaperUI just to see if it would behave differently than the things file. It also doesn’t fire the sunset event but I’ll remove the local astro thing.

Update to wrap this all up.

Removing the astro:sun:local thing had no effect. Renaming the astro:sun:home thing to astro:sun:myhome after removing astro:sun:local thing also didn’t work.

I ended up uninstalling the astro binding. I went into the openhabian config tool on the pi, ran the ‘02 Upgrade System’ (I don’t think anything was updated), ‘10 Apply Improvements’ -> ‘11 packages’, went to ‘System Settings’ -> set the timezone to my local time and shut down the pi for a minute. Once it powered back on, I reinstalled the astro binding then deleted the astro:sun:local and astro:moon:local out of the discovery queue. One or some combination of the steps above seems to have resolved the issue as a couple hours later at sunset my rule fired.

Note, I left the things.things file as is with the astro thing entry when the astro binding was uninstalled so I did not have to readd the astro:sun:myhome thing when the binding was reinstalled.

Thanks for the ideas everyone!

1 Like