Can anyone please confirm (or refute) that text based Astro rules don't work in OH3

rule "Civil Dusk Has Occured"
  Channel 'astro:sun:local:civilDusk#event' triggered START 

rule "Sun Rise Has Occured"
  Channel 'astro:sun:local:rise#event' triggered START  

I migrated these Rules over from OH2 and they won’t fire.

The Astro binding seems to work fine as I can link Items to its Channels and they do update okay. There is one exception though the Trigger type channels won’t link. I get the error, “There is no profile available for the selected item”.

I realize I can now use UI rules but all my other rules are text based and I’d like to keep them all together for now. I am however going to try a UI built rule tonight to see if it fires.


Nothing has changes as far as I’m aware. They should work.

They’re not supposed to link, they are trigger events. What are you trying to do with them?
This is not related to

rule event triggers.
What do these events look like in your events.log ?

Thanks for your reply!

I am trying to turn some lights on at civil dusk and turn one light off at sun rise. These rules worked for months with no issues in OH2. I copied the .rules file exactly as-is to OH3 and it stopped working.

I’m not sure what you mean by, “This is not related to rule event triggers.” Isn’t, “Channel ‘astro:sun:local:rise#event’ triggered START” an event that I can use in the When clause of a rule?

These are all the events over the past couple of days that contain “astro”. Odd that there are no Dusk events?

2021-08-21 21:41:00.003 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:noon#event triggered START
2021-08-21 21:42:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:noon#event triggered END
2021-08-22 05:03:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:moon:local:rise#event triggered START
2021-08-22 07:00:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:morningNight#event triggered START
2021-08-22 12:24:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:morningNight#event triggered END
2021-08-22 12:24:00.003 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDawn#event triggered START
2021-08-22 13:16:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDawn#event triggered END
2021-08-22 13:16:00.029 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDawn#event triggered START
2021-08-22 14:00:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDawn#event triggered END
2021-08-22 14:00:00.004 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDawn#event triggered START
2021-08-22 14:03:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:moon:local:phase#event triggered FULL
2021-08-22 14:22:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:moon:local:set#event triggered END
2021-08-22 14:36:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDawn#event triggered END
2021-08-22 14:36:00.003 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:rise#event triggered START
2021-08-22 14:40:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:rise#event triggered END
2021-08-22 14:40:00.004 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:daylight#event triggered START
2021-08-22 21:41:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:noon#event triggered START
2021-08-22 21:42:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:noon#event triggered END
2021-08-23 05:25:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:moon:local:rise#event triggered START
2021-08-23 06:57:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:morningNight#event triggered START
2021-08-23 12:27:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:morningNight#event triggered END
2021-08-23 12:27:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDawn#event triggered START
2021-08-23 13:18:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDawn#event triggered END
2021-08-23 13:18:00.004 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDawn#event triggered START
2021-08-23 14:02:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDawn#event triggered END
2021-08-23 14:02:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDawn#event triggered START
2021-08-23 14:38:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:rise#event triggered START
2021-08-23 14:38:00.006 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDawn#event triggered END
2021-08-23 14:41:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:daylight#event triggered START
2021-08-23 14:41:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:rise#event triggered END
2021-08-23 15:42:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:moon:local:set#event triggered END

“This” referred to -

which has nothing to do with rule triggers. So I was curious what you were trying to do, when seeing this message.

There’s one of your rule triggers, looks good. Confident that your rule did not run, perhaps when you did not expect it? This ‘sunrise’ is after two in the afternoon.

May we know your latitude? Not all events appear in all parts of the world all the year round.

Having said that, there are sunrises but no sunsets, which makes no sense. It might be because your timezone is so weirdly offset, with a sunrise in the afternoon so the corresponding sunset would be the next date.
You probably ought to fix your timezone or location.

I have similar rules for both lights and blinds that run without any problems under OH 3
BUT only using trigger events like this


ie civilDusk and CivilDawn

…I cant see any issue otherwise

I don’t suppose your sunrise is at half past two in the afternoon though. The more I think on it, the more likely Astro is to mess up if the location/timezone combination gives “sun rise after sun noon”

Yes, I think that was it. I had set the time zone in the OpenHab UI but not in the Linux OS, it was still set to its default which I assume would be GMT. I have now set the OS time zone to what it should be, MDT (GMT-6:00), I also enabled the local NTP client.

This is the recent log:

2021-08-23 13:40:00.003 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:noon#event triggered START
2021-08-23 13:41:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:noon#event triggered END
2021-08-23 20:40:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:daylight#event triggered END
2021-08-23 20:40:00.006 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:set#event triggered START
2021-08-23 20:43:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDusk#event triggered START
2021-08-23 20:43:00.006 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:set#event triggered END
2021-08-23 21:19:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDusk#event triggered END
2021-08-23 21:19:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDusk#event triggered START
2021-08-23 21:43:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:moon:local:rise#event triggered START
2021-08-23 22:03:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDusk#event triggered END
2021-08-23 22:03:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDusk#event triggered START
2021-08-23 22:54:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:eveningNight#event triggered START
2021-08-23 22:54:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDusk#event triggered END
2021-08-23 22:54:00.009 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:night#event triggered START
2021-08-24 00:00:30.269 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:morningNight#event triggered START
2021-08-24 04:29:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:morningNight#event triggered END
2021-08-24 04:29:00.004 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDawn#event triggered START
2021-08-24 05:20:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:astroDawn#event triggered END
2021-08-24 05:20:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDawn#event triggered START
2021-08-24 06:04:00.002 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:nauticDawn#event triggered END
2021-08-24 06:04:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDawn#event triggered START
2021-08-24 06:39:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:rise#event triggered START
2021-08-24 06:39:00.004 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:civilDawn#event triggered END
2021-08-24 06:43:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:rise#event triggered END
2021-08-24 06:43:00.005 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:local:daylight#event triggered START

These are the event times from,

12:00 am - 4:25 am
10:50 pm - 12:00 am

Astronomical Twilight:
4:25 am - 5:15 am
9:59 pm - 10:50 pm

Nautical Twilight:
5:15 am - 6:00 am
9:15 pm - 9:59 pm

Civil Twilight:
6:00 am - 6:36 am
8:40 pm - 9:15 pm

6:36 am - 8:40 pm

Solar Noon/Midnight:
1:38 PM
1:38 AM

They look good now, they are a little out but I think that is because of the update interval being 300 seconds.

Shouldn’t changing the time zone in the OpenHab UI also change the OS time zone? There is this note on the UI Settings page, " A time zone can be set from the user interface. The underlying system’s time zone is the default.". Does that mean one should not be setting the OS time zone?

Also there doesn’t not appear to be any provision for daylight savings adjustments in the UI.

Regardless, it’s working now. Thanks very much for everyone’s help!

Use of DST is implicit in the choice of timezone. GMT is not UK time, for example.

Event times are calculated at midnight or binding start up.
Interval is about moving values e.g. solar elevation.

OH does not have permission to change the OS time zone. It’d need to run as root and it would also have to know how to do that for all the OS’s it runs on which is more than just Linux.

No but it does mean that if you don’t set a timezone in the UI, the OS’s timezone will be what OH uses.

Daylight savings is handled by choosing the city/location that is closest to you in your timezone. So for me I’d choose America/Denver which observes daylight savings. Someone from Arizona would choose America/Phoenix or US/Arizona which does not observe daylight savings.

You can also fix it by choosing something like GMT-6 and it will stay GMT-6 no matter what daylight savings is doing in your area.

Both the OS and openHAB offer these options for setting the time zone.

Just about the only place we Arizonans are ahead of the curve :yum:.


Daylight savings is a travesty and needs to end. US states and Canadian provinces in the Pacific Time Zone are considering not changing time twice a year.

What annoys me is that we’re probably going to change permanently to Daylight Savings Time, and not to Standard Time. Why? Because when they took polls, people said “I would rather have DST so that there’s more sun in the evenings during summer”. Oh will those people regret when winter comes and it’s still dark out at 8:00am.

What you could do to get round that is to change the time in the winter by an offset :wink:


Is this correct to turn on a virtual switch at Sunset?

rule "Sunset started"
    Channel 'astro:sun:local:civilDusk#event' triggered START 
    logInfo("time-of-day.rules", "Its Sunset")

Minor Detail: sunset and civil dusk are slightly different times. The Astro binding handles both of those so if you really mean SUNSET then you’ll want to change the trigger channel to reflect that. The difference is minimal, but you can see a brief review here if you need some precision.

Bigger Detail: Your basic rule structure is fine, but you’re sending an OFF command instead of ON.


If you look in your events.log, you should find exactly that event. Check carefully, this is all case- and spelling-sensitive. Not everyone’s sun Thing is called “local” for an example.


1 Like

Sunset = ON, vDaylight = OFF :slight_smile:

I did find the channel name in the log, too late to test tonight, I’ll have to test it tomorrow. Thank you again!!