OH3 Can't add a Thing' trigger channel event to a rule

Tags: #<Tag:0x00007f433dd6b848> #<Tag:0x00007f433dd6b780> #<Tag:0x00007f433dd6b6b8>

Hi,

Why I cannot add a channel trigger to a rule in OH?

Preconditions:

  1. There is a Thing with a Trigger channel. It’s Aqara wireless button, created as Generic MQTT thing, it’s communicates with the OH via Zigbee2MQTT. The channel is named “Action”, it was created in the OH3 Basic UI and it’s definitely a Trigger channel.
  2. In the OH3 Rules UI it’s created a simple rule, that for now only writes something to the log.
  3. I would like to create a “When” trigger to execute this rule. The OH3 opens a dialog where, between other options, it offers the "Thing Event’ button.
  4. By press on this button another dialog to pick up a Thing is shown. So far so good.
  5. When the Thing is chosen, the new dialog is shown, where I should choose a Channel.But here I have an empty list without any channels. However, as I said before, the chosen Thing has a few Channels, and one of them is the Action channel…

An attempt to press that Aqara button, i.e. fire a nevent, causes an exception in the openhab.log:

2021-01-26 00:27:29.249 [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:?]

The rule created in the OH2 way, as a file in the rules folder, is triggered perfectly fine. It’s even seen in the OH3 Rules lisk, of couse with a lock icon because it’s provisioned from a file.

Any suggestions, advice, idea?

This looks like a bug and an issue should be filed on the openhab-webui repo. How to file an Issue

@rlkoshak Thank you! Your support is excellent, as usual. And many-many thanks for your Sensor Reporter!

I will fill an issue soon.

BTW, for anyone who may face with the same trouble. The OH2 way to create a rule as .rules file could be a good workaround.

Sounds like this problem to me

Hi,

It seems so. It was already reported and repaired in dev. You can try the snapshot of mqtt.generic if you wish to confirm:

 $ openhab-cli console

openhab> bundle:update 236 https://openhab.jfrog.io/artifactory/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.mqtt.generic/3.1.0-SNAPSHOT/org.openhab.binding.mqtt.generic-3.1.0-SNAPSHOT.jar

 $  sudo systemctl restart openhab.service

I haven’t noticed any significant changes between prod and that snapshot (besides triggers now working) but still consider the risk on your own.

kind regards

1 Like