Skip to content

[SiemensHVAC] missing sanitization in the binding’s UID generation while bridge is initializating #19505

@freichen

Description

@freichen

Expected Behavior

The SiemensHVAC OZW IP Gateway should complete initialization without throwing an exception.

Current Behavior

During initialisation, the SiemensHVAC OZW IP Gateway is throwing

java.lang.IllegalArgumentException: ID segment 'heatcurve-15°cdigital' contains invalid characters. 
Each segment of the ID must match the pattern [\w-]*

Here is the full stack trace:

Stack Trace

java.lang.IllegalArgumentException: ID segment 'heatcurve-15°cdigital' contains invalid characters. Each segment of the ID must match the pattern [\w-]*.
at org.openhab.core.common.AbstractUID.validateSegment(AbstractUID.java:105)
at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:76)
at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:59)
at org.openhab.core.thing.UID.<init>(UID.java:57)
at org.openhab.core.thing.type.ChannelTypeUID.<init>(ChannelTypeUID.java:52)
at org.openhab.binding.siemenshvac.internal.type.UidUtils.generateChannelTypeUID(UidUtils.java:156)
at org.openhab.binding.siemenshvac.internal.metadata.SiemensHvacMetadataRegistryImpl.generateThingsType(SiemensHvacMetadataRegistryImpl.java:462)
at org.openhab.binding.siemenshvac.internal.metadata.SiemensHvacMetadataRegistryImpl.generateThingsType(SiemensHvacMetadataRegistryImpl.java:432)
at org.openhab.binding.siemenshvac.internal.metadata.SiemensHvacMetadataRegistryImpl.readMeta(SiemensHvacMetadataRegistryImpl.java:396)
at org.openhab.binding.siemenshvac.internal.handler.SiemensHvacBridgeThingHandler.initializeCode(SiemensHvacBridgeThingHandler.java:161)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)

Possible Solution

The SiemensHVAC binding auto-generates channel IDs from metadata names it receives from the device OZW672.01 (e.g., “HeatCurve 15°C Digital”).

That name becomes part of the UID — and the ° symbol breaks OpenHAB’s UID validation.
Looks like a missing sanitization bug in the binding’s UID generation
Possible solution would be to sanitize all invalid characters before creating the UID

Steps to Reproduce

  1. Fresh install, openHAB 5.0.2 running in docker over WSL2
  2. Add the siemenshvac binding from the UI
  3. Add the bridge thing, the initialisation process starts and leds to the exception in the logs and hangs in state UNKNOWN

Context

I am controlling my central heater from openhab.
This bug makes the binding unusable with my siemens hardware.

Your Environment

  • openHAB 5.0.2, Release Build, Main UI Commit daad718d, running on docker over WSL2, Chrome Browser.
  • SiemensHvac Binding Version 5.0.2
  • Siemens OZW672.01, Software version | 12.00 |  Build | 12.0.0.5 | Hardware version | 3.00 | Controlling a Siements RVP350 (Central heating), UI in English
  • Windows 11, Docker compose on WSL2 ubuntu, bridge network.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior of an add-on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions