Astro Binding Rule Openhab2

Using the new openhab2 guide:http://docs.openhab.org/addons/bindings/astro/readme.html#binding-configuration

I would like 2 civilDawn events, one with a 30min offset and one with an hour offset
In openhab 1.x I was to define a switch which used offset so I could tie various offsets to various switches, ex:
Switch Sunrise_Event_one {astro=“plant=sun, type=rise, property=start, offset=10”}
Switch Sunrise_Event_two {astro=“plant=sun, type=rise, property=start, offset=30”}

However, now I must define the atro sun in things
astro:sun:home [geolocation="##, ##" interval=60]
{
Channels:
Type rangeEvent: civilDawn#event [
offset=30
]
}
Then in rules I write, in part
when
Channel ‘astro:sun:home:civilDawn#event’ triggered START
then
[do something here]

How do I now define 2 different offsets given the new syntax which bypasses the item declaration?

astro:sun:home30min [geolocation="##, ##" interval=60] and
astro:sun:home60min [geolocation="##, ##" interval=60]

then define in each thing a different offset.

Awesome. Thank you so much for the quick response.

Maybe somebody can help with an issue regarding rules and the Astro binding. Up until build 885 everything was working fine on my installation (OH2 with Astro binding 2). I am on build 983 now and am experiencing one problem: I cannot get a rule working that depends on the nautic dawn or civil dawn events to fire.

  • I have defined a thing in Paper UI, and I am able to run rules that depend on civil dusk and nautic dusk, as well as noon: everything that happens during the current day. It seems that the binding doesn’t update at midnight.

19:39:18.585 [INFO ] [smarthome.event.ThingAddedEvent ] - Thing ‘astro:sun:4bf63f77’ has been added.
19:39:18.594 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘astro:sun:4bf63f77’ changed from UNINITIALIZED to INITIALIZING
19:39:18.610 [INFO ] [me.event.ThingStatusInfoChangedEvent] - ‘astro:sun:4bf63f77’ changed from INITIALIZING to ONLINE
19:39:18.633 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:4bf63f77
19:39:18.668 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:4bf63f77

Here’s the rule:
rule "Front entrance light OFF at dawn"
when
_ Channel ‘astro:sun:4bf63f77:nauticDawn#event’ triggered START _
then
_ sendCommand(ZWaveNode1245609OnOffRelaySwitch_Switch, OFF)_
_ logInfo(“event”, “Front entrance light OFF”) _
end

This is the binding which I installed in the addon folder after downloading it from the openhab-addons-2.2.0-SNAPSHOT.kar from build 983:

212 | Active | 80 | 0.9.0.201706270841 | Astro Binding | org.eclipse.smarthome.binding.astro

Any suggestions?

Check your hometown on suncalc.net (go to detailed view) if values for those events are present at all, also read the last paragraph in the docs:
http://docs.openhab.org/addons/bindings/astro/readme.html
Tips

Do not worry if for example the “astro dawn” is undefined at your location. The reason might be that you live in a northern country and it is summer, such that the sun is not 18 degrees below the horizon in the morning. For details see this Wikipedia article. The “civil dawn” event might often be the better choice.

Do you have your astro things configured through text files? Then read the release notes (breaking changes astro binding) for openHAB2.1:

Thanks for the info. To make sure there is no influence from Paper UI I deleted my things/items there and creted them from scratch in a text file.
Everything is working fine. Example here for turning on a light at nautic dusk:

20:25:58.904 [INFO ] [marthome.event.ChannelTriggeredEvent] - astro:sun:home:nauticDusk#event triggered START
20:25:58.905 [INFO ] [eclipse.smarthome.model.script.event] - Hallway light ON
20:25:58.906 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘zwave_device_15a9b6d2cb3_node11_switch_binary’ received command ON

The problem seems to be that somehow the channels that depend on the change of day information don’t seem to work:

23:59:58.539 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:home
23:59:58.540 [WARN ] [ding.astro.handler.AstroThingHandler] - The Astro-Binding is a read-only binding and can not handle channel updates

==> So the rule that depends on the channel nautic dawn to fire, which should occur at 5:00am, never runs.

Never seen that error by myself, but here is a user who was able to solve that:

So it looks there are some old “remains” from previous tests or config changes …

I have a slightly different problem, the event channel triggers fine - but only on the calculated sunset, the offset is not respected.

I have a config like this :

astro:sun:home [ geolocation=“111, 222”, interval=60 ] {
Channels:
Type rangeEvent : set#event [
offset=-30
]
Type start : set#start [
offset=-30
]
}

Any clue whats going on?

I’m on 2.2-SNAPSHOT.

I was not able to make that work with text files config, but it works without any problems if defined through PaperUI.
There are users who claim to made it work, search the forum, there are a couple of examples …

I’ve read the threads and got to the concusion that this was resolved like 6 months ago and due to missing functionality in the OH2 binding.

Changes i do in text files gets picked up in PaperUI. I have also tried a fully PaperUI managed thing and channel without luck. Im updating the rangeEvent channel with the offset but no luck.

I’m running 180 │ Active │ 80 │ 0.9.0.201708151402 │ Astro Binding
I believe that this version do have the PR with fixed event handling?

Strange, works fine for me:

1

Yes, should be fine …

No, apparently the fix was a degrade. Handling of latest/earliest/offset is now fixed but its included in a an ESH release not yet available.

Check this : https://github.com/eclipse/smarthome/issues/4059
Its fixed in PR #4061

Once there is a build here which include PR #4061 it should be available in the 2.2-SNAPSHOT disributions i hope.

While waiting i did the longitude 15 deg offset instead in the geolocation and it works just fine.

I missed that whole story, sorry.

:+1:So, there are still people around that do understand such a astro-logic.