Astro Binding Glitch/Issue OH 3.1.0

Hello and good day,

I’ve found an issue that I’m unable to solve with the Astro binding immediately after upgrading from OH 3.0.1 to 3.1.0.

The Astro Dawn, and Night variables are “UNDEF” and will not populate. I’ve restarted the OpenHAB service twice, I’ve uninstalled the astro binding, and restarted OpenHAB, which in-turn re-installs it from my addons.cfg file… I’ve also restarted my VM that’s running OpenHAB with no luck.

Both “Astro Dawn” and “Night” do not show a time and are both UNDEF, wheras everything else works fine. If this weren’t something I used, I likely wouldn’t bother, but I have several routines that run under the Night event trigger, so this is a bit of a problem.

Any suggestions on what I can try?

Thanks for your time

What’s your latitude? In Oslo for example, there is no astro dawn or dusk today, it does not exist. Astro binding will return UNDEF for these conditions.

Hello, thanks for the reply!

I’m in Calgary, Alberta, my latitude is 51.0447° N.

Our longest day of the year would have been summer solstice, June 20th, although it was working right up until earlier this week.

I don’t think you get an astronomical dawn in Calgary between mid June and mid July. Try it with an online calculator.

I’d guess the default OH3 persistence setup is carefully persisting and restore-on-startup your times, to add confusion. UNDEF doesn’t get persisted so last valid time will get restored. Date should be wrong of course.
There’ll be a race between binding and restore to see who gets the last word at startup. Timing may vary. Until Astro runs again next midnight.

I think you’ll have to revise your definition of ,“night” to suit your location.

1 Like

Learn something new every day. :slight_smile: I appreciate you going into more detail about this for me. I checked Sun & moon times today, Calgary, Alberta, Canada and it looks like it doesn’t get darker than Astro Twilight overnight currently.

I guess for my Night rule… Instead of

// Night
rule "Night Functions"
    Channel 'astro:sun:local:night#event' triggered START

I could do

// Night
rule "Night Functions"
    Channel 'astro:sun:local:night#event' triggered START or
    Time cron "0 15 23 1/1 * ? *"

To set a hard cutoff of 11:15 for the times that Night is undefined, the time rule will set the latest of a limit, otherwise once we start moving back into Fall/Winter and Night gets earlier, it’ll start triggering earlier with the Astro binding.

Thank you so much for the help, I suppose before my upgrade to 3.1.0, my VM did have an uptime of about 65 days, so once Night went to UNDEF, it probably never updated the last night time which just kept going day to day.

The binding offers the ability to specify ‘earliest’ and/or ‘latest’ times for specific events.
I think these still work with events that are UNDEF for today, but you’d have to try.

This would avoid triggering your rule twice on non-UNDEF days.

I actually do have a few offsets set up for other times, Although wasn’t sure about that because of it being undefined, I’ll comment out my 11:15 or condition rule and try setting up this as a test just so I can see if it triggers before I go to bed

        Type rangeEvent : night#event [

Thanks for that suggestion too! :slight_smile:

1 Like