OH3 Astro channel events not triggering rules

  • Platform information:
    • Hardware: Raspberry Pi 4 / 4GB / 64GB microSD
    • OS: openhabian v1.6.2 / Debian 10.7 / Linux 5.4.83
    • Java Runtime Environment: Zulu 11
    • openHAB version: 3.0
  • Issue of the topic: Channel events for the Astro binding, or possibly all channel events, do not trigger rules.

I have created the following rule:

    rule "Day Has Ended"
        Channel "astro:sun:local:daylight#event" triggered END

I do not believe that the actual rule content matters that much since the “when” never happens. Anyway, I have a channel “astro:sun:local:daylight” which was created through the UI with the Astro binding. Rather than waiting for much time to pass, I triggered the event in the console:

openhab> openhab:things trigger astro:sun:local:daylight#event END

I’m not sure how to include the astro piece in this message, but I’ll try!

UID: astro:sun:local
label: Local Sun
thingTypeUID: astro:sun
  useMeteorologicalSeason: false
  interval: 300
  geolocation: lat,lon  # masked for privacy
  • If logs where generated please post these here using code fences:
2021-01-12 21:14:06.907 [ERROR] [internal.events.ThreadedEventHandler] - Error on event handling.                                                                                            
java.lang.NullPointerException: null
        at java.lang.String.contains(String.java:2036) ~[?:?]
        at org.openhab.core.automation.internal.module.handler.ChannelEventTriggerHandler.apply(ChannelEventTriggerHandler.java:91) ~[?:?]                                                   
        at org.openhab.core.internal.events.EventHandler.dispatchEvent(EventHandler.java:143) ~[bundleFile:?]                                                                                
        at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:111) ~[bundleFile:?]                                                                                  
        at org.openhab.core.internal.events.EventHandler.handleEvent(EventHandler.java:84) ~[bundleFile:?]                                                                                   
        at org.openhab.core.internal.events.ThreadedEventHandler.lambda$0(ThreadedEventHandler.java:67) [bundleFile:?]                                                                       
        at java.lang.Thread.run(Thread.java:834) [?:?]

I looked into ChannelEventTriggerHandler.java for OH3.0 in github and found this:

        public boolean apply(Event event) {
            logger.trace("->FILTER: {}:{}", event.getTopic(), TOPIC);

            boolean eventMatches = false;
            if (event instanceof ChannelTriggeredEvent) {
                ChannelTriggeredEvent cte = (ChannelTriggeredEvent) event;
                if (cte.getTopic().contains(this.channelUID)) {
                    logger.trace("->FILTER: {}:{}", cte.getEvent(), eventOnChannel);
                    eventMatches = true;
                    if (eventOnChannel != null && !eventOnChannel.isEmpty() && !eventOnChannel.equals(cte.getEvent())) {
                        eventMatches = false;
            return eventMatches;

This is the problematic line:

if (cte.getTopic().contains(this.channelUID)) {

I dug in a little deeper and I was unable to tell if the topic was null or the channelUID was null. This is the point at which I gave up and will control my lights with a switch like a caveman or just specify a time for them to turn on and off until this gets resolved.

How do I set the logging so that I can see the first trace message? That would tell me if it’s the topic or the UID.

Congrats on OH3 – it’s a lot nicer than OH2.x and if I had dawn / dusk events I’d be even happier. :slight_smile: I can tell that many people put a ton of work into this!

This is boilerplate from the forum. It should be “were” and not “where”

Hi there

Did you consider creating a new rule in the UI? I have changed many of my rules over and so far so good. I have a rule to turn on a switch for night time and trigger it from event start. From the night switch several light rules can trigger.


Yes, that is what I initially did. However, seeing the exceptions in the log led me to believe that perhaps something in the rule was invalid so I created my own. The end result, however, is the same.

In fact, I can do something like this:

openhab> trigger astro:sun:local:end#event BOOP

and cause the same exception.