Astro event not triggering rule

I’m trying to get a rule to fire based on an astro event.

I’ve created an astro thing in paper ui with my home coordinates, and I see events in events.log…

2019-08-09 20:19:00.003 [vent.ChannelTriggeredEvent] - astro:sun:c3eee86d:daylight#event triggered END
2019-08-09 20:19:00.008 [vent.ChannelTriggeredEvent] - astro:sun:c3eee86d:set#event triggered START
2019-08-09 20:22:00.001 [vent.ChannelTriggeredEvent] - astro:sun:c3eee86d:civilDusk#event triggered START
2019-08-09 20:22:00.003 [vent.ChannelTriggeredEvent] - astro:sun:c3eee86d:set#event triggered END
2019-08-09 20:54:00.002 [vent.ChannelTriggeredEvent] - astro:sun:c3eee86d:civilDusk#event triggered END
2019-08-09 20:54:00.007 [vent.ChannelTriggeredEvent] - astro:sun:c3eee86d:nauticDusk#event triggered START

However, when I create a rule to be triggered with an astro event, the rule doesn’t fire. I don’t get any indication in openhab.log that the rule is executing so I’m assuming it’s not triggering at all.

rule "Roller shutters - open at start of daylight event"
when
    Channel "astro:sun:c3eee86d:daylight#event" triggered START
then
    val mqttActions = getActions("mqtt","mqtt:broker:c967843e")
    mqttActions.publishMQTT("/broadlink/rollershutters/1/up", "play")
    mqttActions.publishMQTT("/broadlink/rollershutters/2/up", "play")
end

I’ve seen references in the forums to using ‘local’ or ‘home’ instead of the thing id, but I’m assuming I need to use thing id, since that’s what’s showing up in events.log. Regardless, I’ve tried replacing with both local and home, but it still doesn’t work.

What am I doing wrong?

TIA!

At first I would make sure the rule really isn’t triggered by adding a logInfo at the start of the rule code.

1 Like

Thank you for the suggestion. I assumed it wasn’t firing the rule because I didn’t have a log entry, but it makes sense that there wouldn’t be a log entry if I didn’t explicitly make one in the script. The problem was I had an extra forward slash in the MQTT topic. Removing the forward slash solved it.

rule "Roller shutters - open at start of daylight event"
when
    Channel "astro:sun:c3eee86d:daylight#event" triggered START
then
    val mqttActions = getActions("mqtt","mqtt:broker:c967843e")
    mqttActions.publishMQTT("broadlink/rollershutters/1/up", "play")
    mqttActions.publishMQTT("broadlink/rollershutters/2/up", "play")
end
1 Like