openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[openthermgateway] warning that channel UID contains invalid characters #15346

Closed ArjenKorevaar closed 1 year ago

ArjenKorevaar commented 1 year ago

Also see this post.

After updating openHAB to version 4.0.1, the OpenTherm Gateway binding generates warnings that are caused by invalid characters in channel UID's:

2023-07-30 13:35:03.533 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.IllegalArgumentException: UID segment '0x00:5' contains invalid characters. The last segment of the channel UID must match the pattern '[\w-]*|[\w-]*#[\w-]*'.
        at org.openhab.core.thing.ChannelUID.validateSegment(ChannelUID.java:136) ~[?:?]
        at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:76) ~[?:?]
        at org.openhab.core.thing.UID.<init>(UID.java:66) ~[?:?]
        at org.openhab.core.thing.ChannelUID.<init>(ChannelUID.java:59) ~[?:?]
        at org.openhab.core.thing.internal.ThingImpl.getChannel(ThingImpl.java:126) ~[?:?]
        at org.openhab.binding.openthermgateway.handler.BaseDeviceHandler.receiveMessage(BaseDeviceHandler.java:96) ~[?:?]
        at org.openhab.binding.openthermgateway.handler.OpenThermGatewayHandler.receiveMessageTask(OpenThermGatewayHandler.java:157) ~[?:?]
        at org.openhab.binding.openthermgateway.handler.OpenThermGatewayHandler.lambda$0(OpenThermGatewayHandler.java:142) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

The issue is most likely caused by a change in the way the BaseThingHandler.getChannel() method validates the channel UID input argument. In previous versions, channel UID's with invalid characters would result in a null value. With this version a warning is shown.

The solution in this case could be to update the DataItemGroup class of the OpenTherm Gateway binding and remove or replace any invalid channel UID's, namely from the reserved channels that are not yet in use as per the OpenTherm specification.

ArjenKorevaar commented 1 year ago

Before submitting a fix for this issue, I would like to know if that should be done against main or as a bugfix on the current release branch

lolodomo commented 1 year ago

Against main branch.

jlaur commented 1 year ago

Before submitting a fix for this issue, I would like to know if that should be done against main or as a bugfix on the current release branch

Please target main, we can then cherry-pick into 4.0.x.

ArjenKorevaar commented 1 year ago

thanks! will do

openhab-bot commented 1 year ago

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/opentherm-gateway-binding/39160/336