[ASTRO] Openhab 2.3 events trigger


I’m just converting from OH 1.8.3 to 2.3 and I have this issue I can’t seem to solve. I used to have quite a few switches with the Astro binding, triggering 10/20/30 minutes before/after sunrise and sunset. I have tried to reproduce them here after reading nearly all the topics, but I can’t seem to work it out. Any help would be appreciated.

My astro.things:

astro:sun:home_risem60 [ geolocation="50.0,5.0,0", interval=600 ] 

Type start : rise#start[offset=-60]

My rule:(I have tried with double quotes as well)

rule “example trigger rule”
Channel ‘astro:sun:home_risem60:rise#event’ triggered START
postUpdate(Debug, “SUNRISE_TEST”)
I did not define any items related to this - do I need to?

I was also wondering how to bind an event through PaperUI to anything - when I want to link the range event it doesn’t show anything in the list.

When I open the rule file with Eclipse SmartHome designer, it throws an error to the “Channel” bit saying no viable alternative - I’m not sure why.

If someone has a working config on 2.3 for an offset astro event to trigger anything, I’d appreciate if you could share it with me.

Thanks a lot!

SmartHomeDesigner is out.

Your trigger is correct, assuming the channel name (and thing name inside) is, cross-check with PaperUI.
No items needed.
You should be seeing this event in events.log (if not, your astro binding config may be bad).

Thanks. I had a few weird things in my events.log - for example on this binding I saw a ‘noon’ event starting and ending, which was a bit strange for me, but at least there was an event… I just don’t know why isn’t the event fire when I’m at the given time (unless I miscalculated it) - I’ve tried to calculate the “now” time from the actual sunrise value and put in an offset which should make it fire in like 2-3 minutes from saving the rules/things file, but nothing happened so far.

Double-check astro binding level config (geocoordinates etc) and ramp up debug logging (log:set debug org.openhab.binding.astro in Karaf console) to see in openhab.log what’s happening.
Eventually, you might need to restart the binding (bundle:restart …).

Btw, to have multiple triggers x/y/z minutes before or after, setup multiple things of astro type, each to have a different offset. No need to do any time calculations in rules.

Maybe this is wrong:
I use:

astro:sun:Weekend [ geolocation="xx,yy", altitude=300, interval=600 ]
		Type rangeEvent : rise#event [

and rule trigger:

rule "Astro rollershutter down weekend"
 Channel 'astro:sun:Weekend:set#event' triggered START  
1 Like

Thanks guys. It seems like if I do the same with text-based config it doesn’t work, but if I do it from PaperUI it does. Odd. Which one do you use?
For me if a thing is configured via the .things file, for example the channel doesn’t show the offset in PaperUI either.

Well I believe that if you define the thing in .things file, you must be comprehensive in doing so, i.e. you need to include the channel definitions, too. That definition is moved forward into the internal things jsondb database and used. Not sure what happens if you change the input file, though, never tried, you might or might not need to delete the thing before.
As a general advice, you should not be using .things files. Few people (if any) use it, it’s not supported on a number of bindings, and after all there’s no real need or benefit in doing so.
Use PaperUI to define things at least for ‘static’ things such as astro things.
Use autodiscovery on subsystems to have many devices (= things to be added for each device) such as ZWave.

Thanks, this is what I do now and it is indeed working. It’s just hard to get away from the practices of OH 1.83, and I’m still to figure out how to back up all these PaperUI configs. Thank you guys for all the help :slight_smile:

Backup the jsondb file in /var/lib/openhab2/jsondb.