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