Astro Elevation Type of Integer

I came across something that gave me a headache and wanted to share my fix in case it helps someone else. I didn’t see anything in the Community nor the Astro binding documentation.

I noticed this morning that my Astro data was stale and that none of my Astro events were firing in rules. My Astro data was stale for 15 days. Astro DateTime vars were showing Feb 13 and today is Feb 28. I missed the problem for a while!

I was playing around with many things but it turned out that the fix required a change to the things file. My elevation was a float type instead of an integer.

Problematic entry:

$ cat /etc/openhab2/things/astro.things
Thing astro:sun:home  [ geolocation="<Obfuscated>,<Obfuscated>,128.5", interval=1200 ]
Thing astro:moon:home [ geolocation="<Obfuscated>,<Obfuscated>,128.5", interval=1200 ]

Fixed/Working entry:

$ cat /etc/openhab2/things/astro.things
// WARNING: Altitude must be integer - Using a float causes problems
Thing astro:sun:home  [ geolocation="<Obfuscated>,<Obfuscated>,128", interval=1200 ]
Thing astro:moon:home [ geolocation="<Obfuscated>,<Obfuscated>,128", interval=1200 ]

Note the altitude change from 128.5 to 128. After changing that, saving the things file, and restarting openHAB, the Astro data updated as expected. I’ve had it this way for a long time so I’m guessing something came through on the 12th or 13th of Feb that introduced this behavior. One would assume that all fields can be floats.

My Astro binding version is 2.5.2 as is my openHAB version. I’m running raspbian on a Raspberry Pi 4. All of my regional settings and timezone were set properly according to PaperUI.

Unfortunately, I only retain logs for 10 days (using logrotate daily) so I don’t know what happened on the 13th.

Thanks for sharing this (personally, I will not be hit by this issue since I live on sea level (elevation 0 :smiley:).

Out of curiosity: does it still work if you change it back to 128.5? Or, in other words, is it ‘fixed’ by reloading the things file? If it is really caused by using decimals, the documentation should be updated or the binding fixed of course…

I’m not at home right now but I will check tonight and let you know.

1 Like

If I change it back to a float, it’s not working for me.

I tested this by tailing the events.log to see if solar radiation was updating. I have my Astro update interval set to 1200 which is 20 minutes and I waited for two intervals and never saw an update come through.

Please open an issue in GitHub or this will likely never be fixed.


An issue has been opened:

1 Like