Astro Binding

Really stuck trying to get thie Astro Bindnig working.

  • I have the org.openhab.binding.astro-1.8.1.jar in the addons folder
  • I added the lat / long in the config file, removed the comments, and have not leading spaces
  • In the log I see: 08:01:24.253 [INFO ] [.b.a.internal.bus.AstroBinding:70 ] - AstroConfig[latitude=,longitude=,interval=60000,systemTimezone=America/New_York (EST -0500),daylightSavings=false]

But it does not display the times per my item file:
DateTime Sunrise_Time “Sunrise [%1$tH:%1$tM]” { astro=“planet=sun, type=rise, property=start” }
DateTime Sunset_Time “Sunset [%1$tH:%1$tM]” { astro=“planet=sun, type=set, property=start” }

I see the the log, that there are not values for sun rise or set. If I’m reading it correctly. See below:

2016],sunset=Range[start=,end=],night=Range[start=,end=],morningNight=Range[start=,end=],astroDawn=Range[start=,end=],nauticDawn=Range[start=,end=],civilDawn=Range[start=,end=],civilDusk=Range[start=,end=],nauticDusk=Range[start=,end=],astroDusk=Range[start=,end=],daylight=Range[start=Mon Feb 15 00:00:00 EST 2016,end=Tue Feb 16 00:00:00 EST 2016],eveningNight=Range[start=,end=],eclipse=SunEclipse[total=Tue Mar 08 20:58:00 EST 2016,partial=Thu Feb 15 15:53:00 EST 2018,ring=Thu Sep 01 05:09:00 EDT 2016]]

What the heck am I doing wrong??? Please help, thanks!

Jeff

note: I manually removed my lat and long from above. It is shown properly in the log.

It all looks okay :sunglasses:
The only thing I can think of: either you have the wrong addons folder or you have the org.openhab.action.astro-1.8.1 instead of the binding in place …

Good luck.

1 Like

Thanks but I do have the bindings file and the action (made that mistake
earlier). It is strange that id does get some values (SunEclipse[total=Tue
Mar 08 20:58:00 EST 2016,partial=Thu Feb 15 15:53:00 EST 2018), but not the
sunset.

I do have a negative value for the lat, would that have any issue?

I’ve read several posts where that was the problem! Try removing the action …

That should not be a problem.

Upps, NOW I see: try
DateTime Sunset_Time "Sunset [%1$tH:%1$tM]" { astro="planet=sun, type=set, property=end" }
for the sunset (property=end instead of property=start)

I removed the action file.
My items now look like below:

DateTime Sunrise_Time “Sunrise [%1$tH:%1$tM]” { astro=“planet=sun, type=rise, property=start” }
DateTime Sunset_Time “Sunset [%1$tH:%1$tM]” { astro=“planet=sun, type=set, property=end” }

but, still all I see is -:- for values

I haven’t used the astro binding much but doesn’t it fire at certain times (midnight?) to update the items?

Is there an alternative I could use to get sunrise and sunset times?

Pass on the last question. But if openHAB is running over night you could see if the items have values in the morning to confirm.

Okay, the last thing I can do is give you my working example.
And no, you don’t have to wait until midnight, the times are updating also when for example you are restarting openhab or rebooting your computer.

openhab.cfg:

################################# Astro Binding #######################################
#
# The latitude
astro:latitude=53.xxxxx

# The longitude
astro:longitude=7.yyyyy

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

items:

DateTime    Sunrise_Time    "Sonnenaufgang [%1$tH:%1$tM]"    <sunrise>    { astro="planet=sun, type=rise, property=start" }
DateTime    Sunset_Time    "Sonnenuntergang [%1$tH:%1$tM]"    <sunset>    { astro="planet=sun, type=set, property=end" }

sitemap:

Text item=Sunrise_Time
Text item=Sunset_Time

Also make sure you only use formatting in either the items OR the sitemap.

Here is another working example. Like @sihui, I don’t seen anything obviously wrong.

DateTime        Sunset_Time             "Sunset [%1$tr]"        <moon>  (Weather)       { astro="planet=sun, type=set, property=start" }
DateTime        Sunrise_Time    "Sunrise [%1$tr]"       <sun>   (Weather)       { astro="planet=sun, type=rise, property=start" }

When you modify the .items file where you define Sunset_Time and Sunrise_Time you should see the following log statements:

 2016-02-15 10:07:30.881 [INFO ] [.b.a.internal.job.JobScheduler] - Scheduled a daily job at midnight for astro calculation
 2016-02-15 10:07:30.881 [INFO ] [.o.b.w.i.s.WeatherJobScheduler] - Starting and scheduling weatherJob-home with interval of 10 minutes

If you don’t see those then your Astro binding is not working. Try reinstalling the jar files and restarting OH.

Also, make sure you haven’t left astro:latitude and astro:longitude commented out (there should NOT be a ‘#’ in front of them).

Overwrote everything with your example. Changed nothing except for the lat
and long. Restarted OH…

Same deal! It’s like the addon is just not working. Looking at the log I
see:

12:05:02.370 [DEBUG] [.b.astro.internal.job.DailyJob:50 ] -
Sun[sunrise=Range[start=,end=],noon=Range[start=Mon Feb 15
04:29:00 EST 2016,end=Mon Feb 15 04:30:00 EST
2016],sunset=Range[start=,end=],night=Range[start=,end=],morningNight=Range[start=,end=],astroDawn=Range[start=,end=],nauticDawn=Range[start=,end=],civilDawn=Range[start=,end=],civilDusk=Range[start=,end=],nauticDusk=Range[start=,end=],astroDusk=Range[start=,end=],daylight=Range[start=Mon
Feb 15 00:00:00 EST 2016,end=Tue Feb 16 00:00:00 EST
2016],eveningNight=Range[start=,end=],eclipse=SunEclipse[total=Tue
Mar 08 20:58:00 EST 2016,partial=Thu Feb 15 15:53:00 EST 2018,ring=Thu Sep
01 05:09:00 EDT 2016]]

Some of the values are being populated, but most of them are showing as null. What
would make this happen??

Try what @rlkoshak suggested: download the jar, remove the old one, maybe the file is corrupted …
https://openhab-ci.innoq.io/jenkins/view/openHAB/job/openhab-1/org.openhab.binding$org.openhab.binding.astro/lastSuccessfulBuild/artifact/org.openhab.binding/org.openhab.binding.astro/1.9.0-SNAPSHOT/org.openhab.binding.astro-1.9.0-SNAPSHOT.jar

1 Like

Thanks for all help guys. So dummy me had the lat and long reversed. I guess that combo was not a valid location, and I was receiving invalid data. Swapped the lat/long values, and she fired right up. Dummy me! Thanks!

I was having similar problems - downloaded the .jar file. Works now.
Thanks a whole lot.