FIrst rule ever, seems to not trigger

Good day,

i created a Home.rules file in /etc/openhab2/rules/
Now i wanted to create my first rule ever but it is not working, any help would be appreciated.
The idea is when the sun sets turn on a light.
The time of sunrise and sunset time is visible and and working in my BasicUI btw.

But if i am correct i need to use the “Range Event” for this.

Here is my code.

Items file:

String           Sunset             "Sunset"                                    {channel="astro:sun:home:set#event"}

Group Office "Bureau Bjorn" <office> (Home, Eersteverdieping)
    Switch Officebjornlicht "Lichtpunt Bureau Bjorn" <light> (Office, Lichten) {channel="nikohomecontrol:onOff:440e003a1939:15:switch"}


astro:sun:home  [ geolocation="50.816807,4.893583,67.3", interval=60 ]
astro:moon:home [ geolocation="50.816807,4.893583", interval=60 ]


rule "Test Astro"
       Channel "astro:sun:home:set#event" triggered START


2018-10-31 17:16:00.014 [vent.ChannelTriggeredEvent] - astro:sun:home:set#event triggered START

2018-10-31 17:16:00.022 [vent.ChannelTriggeredEvent] - astro:sun:home:daylight#event triggered END

2018-10-31 17:19:00.005 [vent.ChannelTriggeredEvent] - astro:sun:home:civilDusk#event triggered START

2018-10-31 17:19:00.010 [vent.ChannelTriggeredEvent] - astro:sun:home:set#event triggered END

My rule does not seem to trigger

Try renaming your file Home.rules to home.rules, no capitals.
When you do that monitor the log to see if the file is loaded properly.

Hey vzorglub,

thanks for the reply.
My last “test” was just changing this:


to this:


i know it is like this in the documentation, but i thought i tried it and it didnt work and there are some posts going around stating it needs to be different.

Though… this morning my light was on my wife said.
Going to do another test as it is now for tonight 17:14 to be sure.

Then for the name of the file.
Someone made me change my sitemap file to “Home” instead of “home” because of errors in my log.
Therefor i used the capital letter.
Should i still change it if it seems to be working tonight?

Not necessarily, it’s a matter of preference
Be consistent. In general linux uses only lower case for file names but can work with both.

1 Like

i will change it tonight then when i know my rule works.
So i can test again tomorrow morning :slight_smile:

Thx for the info!