[SOLVED] Astro rule stopped working

I have this strange problem all off a sudden where my astro-binding rule doesn’t work anymore. I have a simple rule that turns on my dimmer light outside to 100 in the evening and turns it off again in the morning. This has worked for weeks and now when I added some other rules for radio purposes it doesn’t seem to work anymore.

Rules:

rule "Zons ondergang regel"
when
    Channel 'astro:sun:local:set#event' triggered START
then
    sendCommand(SW_Buitenlamp, 100)
end

rule "Zons opkomst regel"
when
    Channel 'astro:sun:local:civilDawn#event' triggered START
then
    sendCommand(SW_Buitenlamp, 0)
end

Items:

Switch Milight_TVLamp_G1_State     "TVLamp Aan/Uit"  (AlleLichten)   {channel="espmilighthub:rgb_cct:001:0x17953:level"}
Dimmer Milight_TVLamp_G1_Level     "TVLampHelder [%d %%]"            {channel="espmilighthub:rgb_cct:001:0x17953:level"}
Dimmer Milight_TVLamp_G1_CTemp         "TVLamp Wit"          {channel="espmilighthub:rgb_cct:001:0x17953:colourtemperature"}
Color  Milight_TVLamp_G1_Hue    "TVLampKleur" ["Lighting"] {channel="espmilighthub:rgb_cct:001:0x17953:colour"}
String Milight_TVLamp_G1_Cmd      "Command to Send"      {channel="espmilighthub:rgb_cct:001:0x17953:bulbcommand"}
Switch Milight_TVLamp_G1_SndCmd    "Send Command"            {channel="espmilighthub:rgb_cct:001:0x17953:sendbulbcommand"}

Dimmer SW_Buitenlamp "Buitenlamp" {channel="zwave:device:a5af8125:node5:switch_dimmer1"}

In the logs I see the astro triggers but the item is not changed:

2019-05-06 20:56:34.936 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T20:55:34.902+0200 to 2019-05-06T20:56:34.907+0200

2019-05-06 20:57:34.944 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T20:56:34.907+0200 to 2019-05-06T20:57:34.911+0200

2019-05-06 20:58:34.946 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T20:57:34.911+0200 to 2019-05-06T20:58:34.917+0200

2019-05-06 20:59:34.983 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T20:58:34.917+0200 to 2019-05-06T20:59:34.958+0200

2019-05-06 21:00:34.985 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T20:59:34.958+0200 to 2019-05-06T21:00:34.962+0200

2019-05-06 21:01:35.004 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:00:34.962+0200 to 2019-05-06T21:01:34.966+0200

2019-05-06 21:02:00.006 [vent.ChannelTriggeredEvent] - astro:sun:local:daylight#event triggered END

2019-05-06 21:02:00.009 [vent.ChannelTriggeredEvent] - astro:sun:local:set#event triggered START

2019-05-06 21:02:34.995 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:01:34.966+0200 to 2019-05-06T21:02:34.973+0200

2019-05-06 21:03:35.000 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:02:34.973+0200 to 2019-05-06T21:03:34.977+0200

2019-05-06 21:04:35.009 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:03:34.977+0200 to 2019-05-06T21:04:34.983+0200

2019-05-06 21:05:35.016 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:04:34.983+0200 to 2019-05-06T21:05:34.988+0200

2019-05-06 21:06:00.006 [vent.ChannelTriggeredEvent] - astro:sun:local:set#event triggered END

2019-05-06 21:06:00.011 [vent.ChannelTriggeredEvent] - astro:sun:local:civilDusk#event triggered START

2019-05-06 21:06:35.017 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:05:34.988+0200 to 2019-05-06T21:06:34.994+0200

2019-05-06 21:07:35.029 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:06:34.994+0200 to 2019-05-06T21:07:35.004+0200

2019-05-06 21:08:35.039 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:07:35.004+0200 to 2019-05-06T21:08:35.008+0200

2019-05-06 21:09:35.040 [vent.ItemStateChangedEvent] - Date changed from 2019-05-06T21:08:35.008+0200 to 2019-05-06T21:09:35.014+0200

When I change the item manually in the sitemap it does work, this is the log from the manual action:

2019-05-06 21:27:26.945 [ome.event.ItemCommandEvent] - Item 'SW_Buitenlamp' received command 100

2019-05-06 21:27:26.958 [nt.ItemStatePredictedEvent] - SW_Buitenlamp predicted to become 100

2019-05-06 21:27:26.989 [vent.ItemStateChangedEvent] - SW_Buitenlamp changed from 0 to 100

Any ideas?

Please put logs into code fences too.

Add logging to the Rules to verify whether or not the Rule is actually triggering. The problem might be in the SW_Buitenlamp or the sendCommand and Astro is working.

I see the triggers from the channels in the logs so it appears that Astro is working.

What version of OH are you running?

EDIT: I did not have the same issue, in my case the Astro binding didn’t trigger anymore - Thus forget the below.

I had the same issue, a rule to turn on/off my outdoor lights at sunset/sunrise. It was working fine for months and suddenly stopped working in a way that it only worked for the first instance after a restart of openhab. For me the solution was to uninstall the Astro binding, stop openhab, clear tmp/cache, start openhab and reinstall the Astro binding again, perhaps this helps as well in your case.

I run OH 2.4.0, I allready put the logs into the code fences. i tried reinstalling the astro binding but as expected, this was not the problem.
I would like to enable the logs but I tried reading the log section for rules and I must say I find it difficult stuff. I don’t seem to understand how to activate logs for this rule…

Hi Max, thanks anyway for reading and caring :slight_smile:, much appreciated!

I would start by commenting out the rules you added to go back to the situation when it still worked. Also, add logging to the sunset and sunrise rules like Rich suggests.

When, after commenting out the newly added rules, things work again then the error must be in the new rules which causes the rules file not to compile correctly.

Add lines that look like the following:

logInfo("Logname", "Log statement")

“Logname” can be anything. I usually use the name of the Rule or the file. Log statement can be any String. the goal is to add useful information to this String like the states of Items and the like. In this case we just need the log to verify that the Rule is triggering or not. If you add the log statement and it doesn’t appear in the openhab.log then you know the rule is not triggering. If it does appear you know the Rule is triggering.

Hi Marcel, thanks for the golden tip. I commented the 2 new rules out and this morning I checked the logs, the lighting rules work again. Thanks for that!

1 Like

Oké Rich thanks again for your reply. I did solve this issue with the comment from Marcel. But thanks anyway for the help and explanation.