From 3187b0110fd1ed6f78d39838b7808c37a75a1790 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sat, 30 Nov 2024 22:38:49 +0100 Subject: [PATCH] [ism8] Prevent sending for read-only channel types (#17760) * [ism8] Prevent sending for read-only channel types Signed-off-by: Holger Friedrich --- .../org/openhab/binding/ism8/internal/Ism8Handler.java | 9 +++++++++ .../src/main/resources/OH-INF/thing/thing-types.xml | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/bundles/org.openhab.binding.ism8/src/main/java/org/openhab/binding/ism8/internal/Ism8Handler.java b/bundles/org.openhab.binding.ism8/src/main/java/org/openhab/binding/ism8/internal/Ism8Handler.java index b36d857440b..53713712fd3 100644 --- a/bundles/org.openhab.binding.ism8/src/main/java/org/openhab/binding/ism8/internal/Ism8Handler.java +++ b/bundles/org.openhab.binding.ism8/src/main/java/org/openhab/binding/ism8/internal/Ism8Handler.java @@ -29,6 +29,7 @@ import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.Thing; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.binding.BaseThingHandler; +import org.openhab.core.thing.type.ChannelTypeUID; import org.openhab.core.types.Command; import org.openhab.core.types.RefreshType; import org.slf4j.Logger; @@ -86,6 +87,14 @@ public class Ism8Handler extends BaseThingHandler implements IDataPointChangeLis if (command == RefreshType.REFRESH) { updateChannel(dataPoint); } else { + ChannelTypeUID channelType = channel.getChannelTypeUID(); + if (channelType != null) { + if (channelType.getId().endsWith("-r")) { + logger.warn("Ism8: channel {} of type {} is read-only, cannot send command", channelUID.getId(), + channelType.toString()); + return; + } + } setDataPoint(dataPoint, command); } } diff --git a/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml index cb7d5b8603c..17471acee28 100644 --- a/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.ism8/src/main/resources/OH-INF/thing/thing-types.xml @@ -43,6 +43,7 @@ Switch + veto @@ -65,6 +66,7 @@ Number:Dimensionless + veto @@ -102,6 +104,7 @@ Number:Dimensionless + veto @@ -122,6 +125,7 @@ Number:Temperature + veto @@ -162,6 +166,7 @@ Number:Pressure + veto @@ -181,6 +186,7 @@ Number:Power + veto @@ -200,6 +206,7 @@ Number:VolumetricFlowRate + veto @@ -220,6 +227,7 @@ Number:Energy + veto @@ -239,6 +247,8 @@ Number:Dimensionless + + veto