Astro binding - solar midnight trigger channel

Hello everybody,
some weeks ago I finally managed to end the transition from Openhab to Openhab2 and to have it up and running. When I configured the new Astro binding I had again a problem for which I already wrote a post about Openahab 1 (Astro binding - events when azimut is 0 and when is 180 [SOLVED]).
Basically I would like to have a trigger channel for the solar midnight (when the solar azimut is 0) because I want to configure some rules triggered through this event, but it seems to me the binding doesn’t include that possibility. I thought I could set an offset of -720 minutes to the “noon” event, but in that case I couldn’t use anymore the noon “event” in the way I use it now (to trigger other rules those I want to start at noon time. So, reading the documentation I could understand that I can only have one between the “noon” and the “solar midnight” event.
I would like to ask to the binding creator or the maintainer to add a new trigger channel that runs when the solar azimut is 0.
Or do you have other solving ideas? Bye.

It has been awhile since I’ve messed with this but I believe one drawback with offsets is you cannot have one Thing with events for a standard event and that event with an offset. For example, you can’t have one Thing that generates an event for Noon and for Noon-720 minutes. You need to create another Thing.

However, there is also an azimuth channel which I think you might be able to use with:

when
    Item sunAzimuth changed to 0
then

Thank you Rich, my problem is exactly that I can’t have the same Thing generating some events for Noon and some other events for Noon-720 minutes.
In my opinion the best way to solve this problem would be to insert in the new Astro binding a new group “solar midnight” and to use it as a trigger channel (for example, astro:sun:home:solarmidnight#event). Anyway, as a second option, I didn’t think yet to trigger the rule in the way you suggested. I’ll try it as soon as possible and I’ll write here the results.

Hello Rich,
I tried to insert the condition you suggested

to trigger events at “solar midnight” but the problem is that my sunAzimuth item is a variable that doesn’t receive everyday the value 0 (or better: it happens almost never) because Astro binding updates its values every n seconds (in my case 5 minutes) and so around the solar midnight the azimuth often changes directly from a value around 360 to a value around 0 (e.g 359,56 to 0,31).
I think I could develop a more complex rule but it would not be a clean solution, it would be much better to have a new group “solar midnight” in the Astro binding, but I guess in this case we would need to contact the binding creator.

Well, it isn’t that much more complex of a rule:

when
    Item sunAzimuth changed
then
    var azimuth = sunAzimuth.state as Number
    if(azimuth > 359 || azimuth < 1) {

To have this implemented as part of the binding open an issue on the openhab-addons github project and reference this thread.

1 Like

Yes Rich, I was thinking about something like that. You’re right it’s not much more complex but in my opinion it could be simpler to add a new trigger group in the binding. I’ll try to propose this idea in the openhab-addons github project and I hope that if it’ll be considered useful it will be implemented in the next versions of the binding.
Thank you for your messages and your solution.
Bye.