Rule in OH4 does not trigger on Astro event

I have a fresh install of Openhabian, running Openhab 4.0.0 on a raspberry pi. I’m trying to set up a rule to trigger a script based on events from the Astro module. This worked fine when I was running OH3 and OH2, but it doesn’t now and I’m not really sure what the problem is.

I want the rule to trigger on astro:sun:local:civilDusk#event START, and I can see the event triggering in the log.

When creating the rule, I choose “Thing Event”. As the thing I choose “Local Sun (astro:sun:local)”. But when I then click on “channel” to choose the correct one, nothing happens. It doesn’t show a new dialogue, it’s just dead. This itself seems like a bug, as the thing does have trigger channels.

As kind of a workaround I try clicking Done and modify the code to add the channel there manually, so it looks like this:

configuration: {}
triggers:
  - id: "1"
    configuration:
      thingUID: astro:sun:local
      event: START
      channelUID: astro:sun:local:civilDusk
    type: core.ChannelEventTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    label: Run astro dusk script
    configuration:
      considerConditions: true
      ruleUIDs:
        - 59239ce01f
    type: core.RunRuleAction

If I manually run the rule in the GUI, it works, so I know the action is correct, and that the script the action runs is correct. And I see the event being triggered in the logs. But the rule does not run when the event triggers. What am I doing wrong?

I can confirm this behavior and it is indeed a regression. Please file an issue on the openhab-webuis repo. How to file an Issue

I couldn’t say. I would have expected adding the channelUID manually would work. It might be related to the same thing that is breaking the dialog.

As a temporary work around you can link the civilDusk#START Channel to a DateTime Item and use the Time is item rule trigger.

2 Likes

Thanks for confirming! I’ve created an issue here: Cannot choose channel when creating rule to trigger on Thing Event · Issue #1996 · openhab/openhab-webui · GitHub

I’m tempted to try a file based DSL rule to see if that triggers, but it’s possible I’ll just wait for a fix or do it the way you suggested. :slight_smile:

I would not expect this to be a problem with file based rules in any language. This very much looks like a problem with UI rules only.

1 Like