Astro binding issue?

Any news on this?

This simple rule works perfectly for my needs to know when it is daylight. Thanks

Hi guys, just wanted to inform you that Gerhard implemented channel triggers in the latest astro binding snapshot! Now you can use a trigger in a rule:

rule "example trigger rule"
when
    Channel 'astro:sun:local:rise#event' triggered START 
then
    ...
end

It’s working perfectly! Here’s the link to the readme: https://github.com/openhab/openhab2-addons/tree/master/addons/binding/org.openhab.binding.astro

Regards, Christian

4 Likes

Hello!

I’ve tried this example, but it didn’t work for me. I have a thing astro:sun:local, and two rules:

rule "Night ON"
when
Channel ‘astro:sun:local:set#event’ triggered START
then
NightTime.postUpdate(ON)
end

rule "Night OFF"
when
Channel ‘astro:sun:local:rise#event’ triggered START
then
NightTime.postUpdate(OFF)
end

The item I’m using with astro 1.9 works as it was working before (it’s night time here), but a new NightTime item haven’t changed to ON after sunset. What am I doing wrong? I’m using OH2 online snapshot, and I’ve installed Astro 2 binding today, so I guess it should be the latest version of the binding.

Best regards,
Davor

You can check your sun-thing for the range event channel, see this
screenshot. If it isn’t there you’ve got an older version.

Christian

Hello!

I do have a range event channel in the Paper UI. So, I guess the binding I have is OK. Do I have to do any other setup of the binding (binding picked geolocation by itself)? Thank you for your help.

Best regards,
Davor

@davorf I did the same yesterday and it worked for me.

Please have also a look to the “astro.cfg” in conf\services\ to be sure that longitude, latitude and optionally refresh interval is set to your location. Or you can do it in the thing itself:

BR
Michael

You can look up your longitude and latitude with Google maps. Then edit
your sun and set it to the right value, the default is not your location.
I didn’t have to edit the astro.cfg, is all done via the paper ui

Christian

Hello!

I’ve looked up latitude and longitude that was set by default, and it’s actually just a few hundred meters from my actual location. Interval is set to 300 by default, so, I guess that’s OK too.

@michaeljoos: astro.cfg has the parameters used for astro1 binding. I’m trying to use astro2, and I think all the settings for OH2 native bindings are saved in JSON (earlier MapDB), and not the .cfg file in services folder.

Thank you both for your help.

Best regards,
Davor

Ah, I have a VPN up and running, so I got the wrong values automatically :slight_smile:

Hello!

Do you know if it’s necessary to have items bound to the channels used by rules event, because I don’t have any items connected. Just the rules triggering proxy item.

Best regards,
Davor

Hi,

I’m not sure, but I do have items bound to display sunrise/sunset in the UI:

Group            Sun                        "Sonne"                                        <sun>            (All)
DateTime    Sunrise_Time  "Sunrise    [%1$tH:%1$tM]"    <sunrise>    (Sun)    { channel="astro:sun:local:rise#start" }
DateTime    Sunset_Time   "Sunset        [%1$tH:%1$tM]"    <sunset>    (Sun)    { channel="astro:sun:local:set#start" }

Regards, Christain

I’ll try adding an item for sunrise/sunset to see if it makes any change. Thank you for your help.

Best regards,
Davor

How can i add a offset to the event

Note: Offsets for each event group can be configured in the channel properties

i do not find a documentation abut this.

Afaik it isn’t implemented (yet).
I just use this in my rules:

Thread::sleep(60000)

It’s in milliseconds, so this example sleeps for 60 seconds.

Christian

okay i declare a global integer for the offset

var Integer OffsetForSun = 1000*60*15

This is great. Looks like offset has just been added so should be in the next nightly build by adding an “offset” (in minutes) to the channel properties

When is it possible to use this function?

Should be available in last nights SNAPSHOT.

Hello!

I’ve tried adding items for sunrise and sunset. They update correctly, but events are not triggered. I even updated OH2 to the latest nightly snapshot, but it still doesn’t work. Any help would be greatly appreciated.

Best regards,
Davor