I simplify things by having an item called Time_of_Day, and two DSL rules to determine its state.
rule "Day"
when
Channel 'astro:sun:local:rise#event' triggered START
then
Time_of_Day.sendCommand("Day")
end
rule "Night"
when
Channel 'astro:sun:local:set#event' triggered START
then
Time_of_Day.sendCommand("Night")
end
Many of my rules start with an if condition to check if it’s Day or Night.
Also add a rule on startup that checks the current time against the sunrise time for that day, and set your Time_Of_Day item accordingly. This covers the case when you restarted openhab, and before those astro events fired. Or in the OP’s case, turn on the light if openhab is restarted after sunset.
I now know why I didn’t see the Trigger events, I was trying to add them from the Model and they are not listed there.
I noted you select the Thing in the Trigger event and then the channel. I must of done that a couple of years ago when I originally had it working! Will make a note this time.
Lets see if it works later today.
Out of interest is this:
rule “Day”
when
Channel ‘astro:sun:local:rise#event’ triggered START
then
Time_of_Day.sendCommand(“Day”)
end
rule “Night”
when
Channel ‘astro:sun:local:set#event’ triggered START
then
Time_of_Day.sendCommand(“Night”)
end
Just a way of describing, in text, the GUI rule or is it stored somewhere like this?