Light automation with Astro Binding - not reacting

Hi, I would like to automate my lights, so that they switch on when the sun goes down and switch off when the night is over.

I created this lichter.rules files and put this code in it.

rule "Nacht start Licht Buero EIN"

    Channel 'astro:sun:local:set#start' triggered START

rule "Nacht ende Licht Buero AUS"

    Channel 'astro:sun:local:rise#start' triggered START

I also tried with

    Channel 'astro:sun:local:set#event' triggered START

but no success.
Then also like this

    sendCommand( E_Office_Light, OFF)

but also no reaction

I did not create any things objects for astro. I understood that it is not necessary. Ofcourse the light E_Office_Light is in a thing file and has the status ON or OFF

I use openhab 2.5, astro 2.5.10., my lights are homematic HmIP-FSM16 and runing on raspberymatic

Thanks for the help

ps: I noticed that my system has a delay of 1 hour I assume the time is not set properly. I created a corn job to stop the light at a specific time. Just as information…

You need to create a thing for the sun. Based on that you will have local time (set up geolocation) and available channels (visible directly if you define it in Paper UI)

Ow thanks a lot for your quick answer, that is awesome.
So I create a thing for the sun, should it be called sun or it doesn’t matter? But the name of the thing is not needed, right?

I can leave the code as I wrote it in the lichter rules? The channel wil triger it, right?

For Range Event channels you do not need items and and can put them in rules directly, Therefore:

  Channel 'astro:sun:local:set#event' triggered START

shall be OK assuming the channel name is correct. Not sure about local from the above. If you use Paper UI you need to copy the name of the channel generated by Openhab. If you define on your own you need to refer to Thing definition name accordinlgy,

Ok that is me mixing up sorry

So now I created a new things files and with this line
astro:sun:home [ geolocation="xx.xxxxx,y.yyyyyy", interval=60 ]

In paperUI I get this channel name
DateTime SetStart "Startzeit" {channel="astro:sun:local:set#start"}

Do I have to change the name to correspond the things file or visversa?
Do I have to set events for the things?

I’m very sorry, I’m not use to work with things and trigger events

Maybe I did understand you wrong. In PaperUI ther is a thing for sun already existing with the name astro:sun:local. So I do not need to create a file called lichter.things right? I can delet it? Because the thing needed is already in paperUI. I’m I right?



do this

1 Like

Do I need to take the name astro:sun:local:rise#start or astro:sun:local:rise#event?

this is the right one to work without item definition which is triggered START/END. But this is for sun rise. You may need a similar channel for sunset event! (to switch your light on)…See for a channel like

astro:sun:local:set#event in Paper UI

It shall work in your rule, if not check as follows:

  • do you have proper geolocation and update interval set up at the thing level, if yes:

  • see openhab event log for astro event evidence (you may need to wait ~24 hours for next sunrise event :slightly_smiling_face:)

1 Like

Same problem for me. I have several astro rules and they are have problems with OH 3.0. Interesting that some of them triggered yesterday, but today no rules fired at all.


astro:sun:home  [ geolocation="XXX,YYY,0", interval=60 ]

Astro events are fired, according to the log:

2020-12-27 16:31:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:home:set#event triggered START
2020-12-27 16:35:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:home:civilDusk#event triggered START
2020-12-27 17:13:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:home:nauticDusk#event triggered START
2020-12-27 17:53:00.001 [INFO ] [openhab.event.ChannelTriggeredEvent ] - astro:sun:home:astroDusk#event triggered START

And rule:

// Christmas lights auto
rule "Sunset Rule"
    Channel "astro:sun:home:civilDusk#event" triggered START
    logWarn("light", "Sunset Rule")

Was NOT fired. (No message “Sunset Rule” or any error messages related around it).

Full source of my setup: GitHub - petrows/smarthome-openhab: My smart home configuration (OpenHAB 2)


  • there is no error messages in log
  • rule worked before, at least one time in OH2 and OH3
  • rule is configured via text file (see git), visible in GUI, displayed correctly and could be started via “run” button in OH3 interface
  • if started manually via GUI, also works correctly

Next investigation…

Try to trigger channel via CLI, rule was NOT fired:

openhab:things trigger astro:sun:home:civilDusk#event START

Rule was NOT fired.

Then, i coped rule to 2nd one, saved file (OH reloaded .rules file):

// Christmas lights auto
rule "Sunset Rule 2"
    Channel "astro:sun:home:civilDusk#event" triggered START
    logWarn("light", "civilDusk trigger")

// Christmas lights auto
rule "Sunset Rule"
    Channel "astro:sun:home:civilDusk#event" triggered START
    logWarn("light", "Sunset Rule")

And triggered via CLI again using same command -> BOTH (old and new rules) were triggered.

It looks like a definitiv bug in rules engine.

My answers/comments were related to astro setup in OH2.
I am not yet on OH3. This might be more OH3 rule related issue? and might be good to start a separate conversation with [OH3] beginning for a proper attention

Oops, sorry, i missed that point. This topic was found using “OH 3.0” search. I will try to isolate this issue and open proper bug report for OH 3.0 version.

So I checked the log and saw this

The time seams to be right

But the sunset trigger is not correct
Start is at 15:41 wich is too early

and end 4 minutes later

this is strange, isn’t it? But at least somthing is happening in the log, wich I thing it’s a good sign?

In paperUI my location seams to be correct. update interval is default because I did not change it. I think it is set to 300. Shall I change anything?

Just figured out, that my timezone seams to be incorrect. In the settings of openhab it is set correctly. I supect that my docker container might be wrong. So I will try to fix the timezone issue and mybe it will help.

You do confirme that my rule should work so I will leave it like it is now and testing for the next 48 houres.

Thanks for the help. I might come back in a couple of days :wink:

I do not see anything strange with it. In my location sunset starts is 15:30 in Winter time, then few minutes later sunset ends. If it is too bright to turn on the lights you can use another channel in the rule (ex Dusk) or set offset parameter at the Sunset Range channel to move the event…

1 Like

FYI, i have opened an issue. Looks like i have spontaneous rules removal due to conflicting rules ID’s: OH3.0.0 stable: DSL Rules are broken after reload of other .rules files with same file prefix · Issue #2022 · openhab/openhab-core · GitHub

So, seems to be unrelated with Astro. Sorry for some noise it topic.