Astro sunrise / sunset stops working after a couple times

I’m trying to trigger an outdoor light to come on/off at sunrise / sunset. I’ve installed the openHAB2 Astro binding, and added the rules:

rule "Turn porch light off at Sunrise"
when
    Channel 'astro:sun:local:rise#event' triggered START
then    
    logInfo("rules", "It's sunrise, I'm turning off the porch light")
    sendCommand(outdoorFrontPorchLight,0)
end

rule "Turn porch light on at Sunset"
when
    Channel 'astro:sun:local:set#event' triggered START
then
    logInfo("rules", "It's sunset, I'm turning the porch light on")
    sendCommand(outdoorFrontPorchLight,23)
end

It worked a couple times, then stopped working, I restarted openhab, it worked once more, then stopped. Any thoughts? Is there a better way to trigger this?

Which openHAB2 release are you using? (stable 2.0, 2.1 or snapshot 2.2)

From what I remember, there were some issues with the Astro binding and the scheduler but they were fixed recently.

I didn’t follow these threads closely since I don’t use the Astro channel triggers in my rules but if you search the forum for “astro +scheduler +full” you may find some relevant info (not sure if this is connected to the issue that you are experiencing… you need to check your logs for more hints)

Ps: Your rule triggers look good to me

I’m on ‘stable’ so I’m not getting any updates., I’ve switched to using the 1.9 Astro binding, so perhaps that will work for me.

Hi,

See my post in this topic. Afaik the issue has not yet been fixed.

I’ve created an issue on Github for it.

Yes, that’s it @Dries … I’m hoping switching to the 1.9 binding helps, I’ll let you know tomorrow

@johnofcamas
The problem is solved (at least for me). See my post in this topic.

Hey, just to add to this thread. I’m on OH2.2 and experienced the same issue. I upgraded to OH2.3 still no luck. I finally figured out that if you use the event trigger:

Channel 'astro:sun:local:rise#event' triggered START

You can only have a single rule that uses this event. If you have multiple (like I did), only one of them get executed. Which one is not clear and seems to change randomly.

Anyone, since I’ve been struggling with this for a few days, I thought I share this tip:

Only use the event trigger in a single rule!

Unfortunately this is not true. I’m using the same trigger channel in different rules and for another case the same trigger channel multiple times in a single rule and all are executed without any problems.
Make sure you have different rule names!

On OH2.2?

I don’t remember, 2.2. was ages ago :grin:
There have been issues with the astro binding a year ago, but those were solved. Since 2.3 and 2.4 snapshot (maybe also with 2.2. snapshot) it works without any problems.

Hmmm. I’ll have another look then! :slight_smile: