Astro binding and timezone [Solved!]

I am porting my openhab from a linux pc, running ubuntu, to a raspberry pi. So far so good but I am having an issue with the sunset and sunrise times reported by the astro binding. The raspberry time is showing correctly but the sunset and sunrise times are showing as 5 hours off (I’m in the Eastern timezone). The ubuntu is showing sunrise as 7:16 where the raspberry is showing it as 12:16.

So the raspberry system clock shows the correct local time but the time reported in astro is accurate but it is reporting it as zulu time. I can change the rules to adjust my calcs but it seems strange that the same everything (items, rules, sitemap, openhab.cfg) all work fine on the PC running ubuntu but don’t on the Rpi.

I just noticed that my ubuntu clock says 5:16 PM where my Raspberry says 17:16 for the current time. Astro however is showing 07:16 for sunrise and 16:37 for sunset on the ubuntu box, where it’s showing 12:16 and 21:37 respectively on the RaspPi.

Hmmm. The Astro binding gets the sunrise and sunset time based on your lat/long, not timezone.

What about other DateTime Items? If in a rule you set a DateTime Item to now, is that time off or is it the right timezone?

What do you get when you run date +%Z on the RasPi command line? It should print your timezone. I believe the RasPi comes preconfigured for GMT so unless you explicitly change that during setup or later it will be GMT.

Have you configured the Astro binding correctly in openhab.cfg?

You should put in your latitude/longitude so then Astro knows where to use as the point on the Earth to do it’s calculations for:

################################# Astro Binding #######################################
#
# The latitude
astro:latitude=xx.xxxxxx

# The longitude
astro:longitude=xx.xxxxxx

# Refresh interval for azimuth and elevation calculation in seconds
# (optional, defaults to disabled)
astro:interval=300

That should give you accurate times for astrological events as observed from your location.

Yes I did. Just to double check the openhab.cfg file in the raspberry is in /etc/openhab/. That is where I copied the one on my ubuntu install over to my raspberry.

It should be in /etc/openhab/configurations

Did you install manually or using apt-get?

I did apt-get to install. Then I copied my openhab.cfg from my ubuntu install over to that location. When I bring it up into an editor now on the raspberry it does have the lat and long correctly set to my location. It also matches the openhab.cfg that is on my ubuntu install (obviously since I copied it across.)

FYI the method I used to get the proper time to show on my raspberry was via this method #1 on this link.

Another observation is that the date/time stamp in the openhab.log file is not showing the local time, it’s showing GMT. I’m not sure if that has anything to do with what is happening but I found it curious.

OK, I figured it out. Turns out I needed to use Method #2 in this link.

This file /etc/timezone needs to be edited and in my case the first and only line changed to America/New_York. That resulted in the Astro sunset and sunrise times to be correct for my lat and long as well as the datetime stamps in the openhab.log file to be correct.

hey guys,
having the same issue here with the astro binding.
in the log i also see that the systemtimezone is set to GMT.
i’m running on synology and all my regionals and ntp is set correctly, as far as i see it there is no wat you can add the systemtimezone in the openhab.cfg
to my opinion this should be changed to avoid further problems like this.

try what I describe at Synology DiskStation
:smile:

Tried, does not work

I checked my regional settings in syno and they are good. (cet)
Astro keeps its Gmt and +000 while it should be Europe/brussels +1

Thnx for the reply :slight_smile:

still not solved in 1,8

Thanks changing the timezone in /etc/timezone solved this problem for me as well.