From 21044f66f7506996b96b14fa5ff50ef2b0b3336c Mon Sep 17 00:00:00 2001 From: Chiuaua79 <39282804+Chiuaua79@users.noreply.github.com> Date: Tue, 27 Jun 2023 23:00:32 +0200 Subject: [PATCH] [velux] Fix limit minimum bug (#15088) Also-by: Andrew Fiddian-Green Signed-off-by: Cor Hoogendoorn --- bundles/org.openhab.binding.velux/README.md | 10 ++++++---- .../binding/velux/internal/VeluxBindingConstants.java | 3 +++ .../velux/internal/handler/VeluxBridgeHandler.java | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.velux/README.md b/bundles/org.openhab.binding.velux/README.md index ea7c8a561..074d46f04 100644 --- a/bundles/org.openhab.binding.velux/README.md +++ b/bundles/org.openhab.binding.velux/README.md @@ -235,10 +235,12 @@ The supported Channel and its associated channel type is shown below. ## Rain Sensor -Unfortunately Velux has decided to closely integrate the rain sensor into the window device. -The rain sensor is therefore not displayed in the device list. -On the other hand, the 'limitMinimum' channel of a roof window provides information about rainy weather: -If it is set internally by the Velux control unit to a value other than zero, it rains. (Joke!!) +Unfortunately the rain sensor is closely integrated into the window device and it is therefore not possible to display its state via a channel. +However, the 'limitMinimum' channel can provide information about rainy weather. +The rain sensor, when triggered, overrides the window position so it cannot open more than the ventilation position. +(Normally 5% .. 10% depending on the window type, resp. 90% .. 95% inverted). +So if 'limitMinimum' changes from its normal value (usually 100% resp. 0% inverted) to this ventilation position value, it is an indication that the rain sensor has probably been triggered. + ## Properties of the "bridge" Thing diff --git a/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/VeluxBindingConstants.java b/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/VeluxBindingConstants.java index 4264778e3..5539df99c 100644 --- a/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/VeluxBindingConstants.java +++ b/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/VeluxBindingConstants.java @@ -147,6 +147,9 @@ public class VeluxBindingConstants { // List of all virtual shutter channel ids public static final String CHANNEL_VSHUTTER_POSITION = "vposition"; + public static final Set POSITION_CHANNELS = Set.of(CHANNEL_ACTUATOR_POSITION, CHANNEL_ACTUATOR_STATE, + CHANNEL_VANE_POSITION, CHANNEL_VSHUTTER_POSITION); + // Helper definitions public static final String BINDING_VALUES_SEPARATOR = ","; public static final String OUTPUT_VALUE_SEPARATOR = ","; diff --git a/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/handler/VeluxBridgeHandler.java b/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/handler/VeluxBridgeHandler.java index c85fca7a8..5d096d02f 100644 --- a/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/handler/VeluxBridgeHandler.java +++ b/bundles/org.openhab.binding.velux/src/main/java/org/openhab/binding/velux/internal/handler/VeluxBridgeHandler.java @@ -574,6 +574,10 @@ public class VeluxBridgeHandler extends ExtendedBaseBridgeHandler implements Vel ProductBridgeIndex productPbi = product.getBridgeProductIndex(); logger.trace("syncChannelsWithProducts(): bridge index is {}.", productPbi); for (ChannelUID channelUID : BridgeChannels.getAllLinkedChannelUIDs(this)) { + if (!VeluxBindingConstants.POSITION_CHANNELS.contains(channelUID.getId())) { + logger.trace("syncChannelsWithProducts(): skipping channel {}.", channelUID); + continue; + } if (!channel2VeluxActuator.containsKey(channelUID)) { logger.trace("syncChannelsWithProducts(): channel {} not found.", channelUID); continue;