From: Daniel Rosengarten Date: Sat, 31 Dec 2022 16:25:03 +0000 (+0100) Subject: [velbus] Add modules VMBKP, VMBIN, VMB4PB (#13939) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=377dc8645286f01c5df6d6a043a7ee3efd3212a8;p=openhab-addons.git [velbus] Add modules VMBKP, VMBIN, VMB4PB (#13939) * [velbus] Add new functionality PRESSED and LONG PRESSED and fix bug New functionnality : Add the the possibility to simulate the PRESSED and LONG PRESSED message of an input. Module supported with button simulation : VMB1RYS (button : CH6) VMB6IN (buttons : CH1 ... CH6) VMB2PBN, VMB6PBN, VMB7IN, VMB8IR, VMB8PB, VMB8PBU, VMBEL1, VMBEL2, VMBEL4, VMBGP1, VMBGP1-2, VMBGP2, VMBGP2-2, VMBGP4, VMBGP4-2, VMBGP4PIR, VMBGP4PIR-2 (buttons : CH1 ... CH8) VMBELO, VMBGPOD, VMBGPOD-2 (buttons : CH1 ... CH32) Fix bug : The channels names were not correctly assigned to the thing properties. The last channel had the default name, not the one retrieved from the module. Signed-off-by: Daniel Rosengarten * Update bundles/org.openhab.binding.velbus/README.md Co-authored-by: cedricboon Signed-off-by: Daniel Rosengarten * Update bundles/org.openhab.binding.velbus/README.md Co-authored-by: cedricboon Signed-off-by: Daniel Rosengarten * Update bundles/org.openhab.binding.velbus/README.md Co-authored-by: cedricboon Signed-off-by: Daniel Rosengarten * Add trigger on channel when using button simulation Remove uneeded Thread.sleep in code. Trigger the events PRESSED, LONG_PRESSED, RELEASED on the linked trigger channel when using the button simulation. Signed-off-by: Daniel Rosengarten * Fix redundant superinterface DiscoveryService Redundant superinterface DiscoveryService for the type VelbusThingDiscoveryService, already defined by AbstractDiscoveryService. Signed-off-by: Daniel Rosengarten * Fix bug #11521 Typo in the Counter Channel name for VMB7IN. Signed-off-by: Daniel Rosengarten * [velbus] Add VMBELPIR module Add the module VMBELPIR Signed-off-by: Daniel Rosengarten * [velbus] VMBELPIR added to discovery service Forgot to add the module VMBELPIR in the discovery service. Signed-off-by: Daniel Rosengarten * [velbus] Updates clock alarms management Changes the clocks alarm management : - Global alarms are now set from the bridge thing. - Local alarms are still set from the module thing, but the alarm type channels on modules are now readonly. Reduces the flooding of the bus by adding a delay of 10 seconds before sending the update on the bus : - Removes the send on the bus after each update of a clock alarm value. - Sends only the values of the last update after 10 seconds. Signed-off-by: Daniel Rosengarten * [velbus] PR modifications Modifications asked in PR review. Signed-off-by: Daniel Rosengarten * [velbus] PR modifications 2 Modifications asked in PR review 2. Signed-off-by: Daniel Rosengarten * [velbus] Add modules VMBKP, VMBIN, VMB4PB New functionnality : Add the support of the modules VMBKP, VMBIN, VMB4PB Signed-off-by: Daniel Rosengarten * [velbus] Fix code style error Fix code style error in VelbusSensorWithAlarmClockHandler.java Signed-off-by: Daniel Rosengarten Signed-off-by: Daniel Rosengarten Co-authored-by: cedricboon --- diff --git a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/VelbusBindingConstants.java b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/VelbusBindingConstants.java index df98433e5d..ff13ebdf75 100644 --- a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/VelbusBindingConstants.java +++ b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/VelbusBindingConstants.java @@ -84,22 +84,25 @@ public class VelbusBindingConstants { public static final ThingTypeUID THING_TYPE_VMBPIRO = new ThingTypeUID(BINDING_ID, "vmbpiro"); public static final ThingTypeUID THING_TYPE_VMBRFR8S = new ThingTypeUID(BINDING_ID, "vmbrfr8s"); public static final ThingTypeUID THING_TYPE_VMBVP1 = new ThingTypeUID(BINDING_ID, "vmbvp1"); + public static final ThingTypeUID THING_TYPE_VMBKP = new ThingTypeUID(BINDING_ID, "vmbkp"); + public static final ThingTypeUID THING_TYPE_VMBIN = new ThingTypeUID(BINDING_ID, "vmbin"); + public static final ThingTypeUID THING_TYPE_VMB4PB = new ThingTypeUID(BINDING_ID, "vmb4pb"); // thing type sets public static final Set BRIDGE_THING_TYPES_UIDS = Collections .unmodifiableSet(new HashSet<>(Arrays.asList(BRIDGE_THING_TYPE, NETWORK_BRIDGE_THING_TYPE))); - public static final Set SUPPORTED_THING_TYPES_UIDS = Collections - .unmodifiableSet(new HashSet<>(Arrays.asList(THING_TYPE_VMB1BL, THING_TYPE_VMB1BLS, THING_TYPE_VMB1DM, - THING_TYPE_VMB1LED, THING_TYPE_VMB1RY, THING_TYPE_VMB1RYNO, THING_TYPE_VMB1RYNOS, - THING_TYPE_VMB1RYS, THING_TYPE_VMB1TS, THING_TYPE_VMB2BL, THING_TYPE_VMB2BLE, THING_TYPE_VMB2PBN, - THING_TYPE_VMB4AN, THING_TYPE_VMB4DC, THING_TYPE_VMB4RY, THING_TYPE_VMB4RYLD, THING_TYPE_VMB4RYNO, - THING_TYPE_VMB6IN, THING_TYPE_VMB6PBN, THING_TYPE_VMB7IN, THING_TYPE_VMB8IR, THING_TYPE_VMB8PB, - THING_TYPE_VMB8PBU, THING_TYPE_VMBDME, THING_TYPE_VMBDMI, THING_TYPE_VMBDMIR, THING_TYPE_VMBEL1, - THING_TYPE_VMBEL2, THING_TYPE_VMBEL4, THING_TYPE_VMBELO, THING_TYPE_VMBELPIR, THING_TYPE_VMBGP1, - THING_TYPE_VMBGP1_2, THING_TYPE_VMBGP2, THING_TYPE_VMBGP2_2, THING_TYPE_VMBGP4, THING_TYPE_VMBGP4_2, - THING_TYPE_VMBGP4PIR, THING_TYPE_VMBGP4PIR_2, THING_TYPE_VMBGPO, THING_TYPE_VMBGPOD, - THING_TYPE_VMBGPOD_2, THING_TYPE_VMBMETEO, THING_TYPE_VMBPIRC, THING_TYPE_VMBPIRM, - THING_TYPE_VMBPIRO, THING_TYPE_VMBRFR8S, THING_TYPE_VMBVP1))); + public static final Set SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet( + new HashSet<>(Arrays.asList(THING_TYPE_VMB1BL, THING_TYPE_VMB1BLS, THING_TYPE_VMB1DM, THING_TYPE_VMB1LED, + THING_TYPE_VMB1RY, THING_TYPE_VMB1RYNO, THING_TYPE_VMB1RYNOS, THING_TYPE_VMB1RYS, THING_TYPE_VMB1TS, + THING_TYPE_VMB2BL, THING_TYPE_VMB2BLE, THING_TYPE_VMB2PBN, THING_TYPE_VMB4AN, THING_TYPE_VMB4DC, + THING_TYPE_VMB4RY, THING_TYPE_VMB4RYLD, THING_TYPE_VMB4RYNO, THING_TYPE_VMB6IN, THING_TYPE_VMB6PBN, + THING_TYPE_VMB7IN, THING_TYPE_VMB8IR, THING_TYPE_VMB8PB, THING_TYPE_VMB8PBU, THING_TYPE_VMBDME, + THING_TYPE_VMBDMI, THING_TYPE_VMBDMIR, THING_TYPE_VMBEL1, THING_TYPE_VMBEL2, THING_TYPE_VMBEL4, + THING_TYPE_VMBELO, THING_TYPE_VMBELPIR, THING_TYPE_VMBGP1, THING_TYPE_VMBGP1_2, THING_TYPE_VMBGP2, + THING_TYPE_VMBGP2_2, THING_TYPE_VMBGP4, THING_TYPE_VMBGP4_2, THING_TYPE_VMBGP4PIR, + THING_TYPE_VMBGP4PIR_2, THING_TYPE_VMBGPO, THING_TYPE_VMBGPOD, THING_TYPE_VMBGPOD_2, + THING_TYPE_VMBMETEO, THING_TYPE_VMBPIRC, THING_TYPE_VMBPIRM, THING_TYPE_VMBPIRO, + THING_TYPE_VMBRFR8S, THING_TYPE_VMBVP1, THING_TYPE_VMBKP, THING_TYPE_VMBIN, THING_TYPE_VMB4PB))); // Velbus module types public static final byte MODULE_TYPE_VMB8PB = 0x01; @@ -150,6 +153,9 @@ public class VelbusBindingConstants { public static final byte MODULE_TYPE_VMBGPOD_2 = 0x3D; public static final byte MODULE_TYPE_VMBGP4PIR_2 = 0x3E; public static final byte MODULE_TYPE_VMB1RYS = 0x41; + public static final byte MODULE_TYPE_VMBKP = 0x42; + public static final byte MODULE_TYPE_VMBIN = 0x43; + public static final byte MODULE_TYPE_VMB4PB = 0x44; // Velbus commands public static final byte COMMAND_PUSH_BUTTON_STATUS = 0x00; diff --git a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/discovery/VelbusThingDiscoveryService.java b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/discovery/VelbusThingDiscoveryService.java index 3ae22ce65b..0697d4c87b 100644 --- a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/discovery/VelbusThingDiscoveryService.java +++ b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/discovery/VelbusThingDiscoveryService.java @@ -311,6 +311,18 @@ public class VelbusThingDiscoveryService extends AbstractDiscoveryService velbusModule = new VelbusModule(new VelbusModuleAddress(address, 0), moduleType, highByteOfSerialNumber, lowByteOfSerialNumber, memoryMapVersion, buildYear, buildWeek, THING_TYPE_VMBVP1, 8); break; + case MODULE_TYPE_VMBKP: + velbusModule = new VelbusModule(new VelbusModuleAddress(address, 0), moduleType, highByteOfSerialNumber, + lowByteOfSerialNumber, memoryMapVersion, buildYear, buildWeek, THING_TYPE_VMBKP, 8); + break; + case MODULE_TYPE_VMBIN: + velbusModule = new VelbusModule(new VelbusModuleAddress(address, 0), moduleType, highByteOfSerialNumber, + lowByteOfSerialNumber, memoryMapVersion, buildYear, buildWeek, THING_TYPE_VMBIN, 8); + break; + case MODULE_TYPE_VMB4PB: + velbusModule = new VelbusModule(new VelbusModuleAddress(address, 0), moduleType, highByteOfSerialNumber, + lowByteOfSerialNumber, memoryMapVersion, buildYear, buildWeek, THING_TYPE_VMB4PB, 8); + break; } if (velbusModule != null) { diff --git a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusSensorWithAlarmClockHandler.java b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusSensorWithAlarmClockHandler.java index 6e1eab2544..82ae4fe990 100644 --- a/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusSensorWithAlarmClockHandler.java +++ b/bundles/org.openhab.binding.velbus/src/main/java/org/openhab/binding/velbus/internal/handler/VelbusSensorWithAlarmClockHandler.java @@ -41,14 +41,14 @@ import org.openhab.core.types.RefreshType; * sent to one of the channels. * * @author Cedric Boon - Initial contribution - * @author Daniel Rosengarten - Add VMBELPIR support, removes global alarm configuration from module (moved on bridge), - * reduces bus flooding on alarm value update + * @author Daniel Rosengarten - Add new module support, removes global alarm configuration from module (moved on + * bridge), reduces bus flooding on alarm value update */ @NonNullByDefault public class VelbusSensorWithAlarmClockHandler extends VelbusSensorHandler { - public static final Set SUPPORTED_THING_TYPES = new HashSet<>( - Arrays.asList(THING_TYPE_VMB2PBN, THING_TYPE_VMB6PBN, THING_TYPE_VMB8PBU, THING_TYPE_VMBPIRC, - THING_TYPE_VMBPIRM, THING_TYPE_VMBRFR8S, THING_TYPE_VMBVP1)); + public static final Set SUPPORTED_THING_TYPES = new HashSet<>(Arrays.asList(THING_TYPE_VMB2PBN, + THING_TYPE_VMB6PBN, THING_TYPE_VMB8PBU, THING_TYPE_VMBPIRC, THING_TYPE_VMBPIRM, THING_TYPE_VMBRFR8S, + THING_TYPE_VMBVP1, THING_TYPE_VMBKP, THING_TYPE_VMBIN, THING_TYPE_VMB4PB)); private static final HashMap ALARM_CONFIGURATION_MEMORY_ADDRESSES = new HashMap(); static { @@ -79,6 +79,9 @@ public class VelbusSensorWithAlarmClockHandler extends VelbusSensorHandler { ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMBGPOD_2, 0x0284); ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMBRFR8S, 0x0093); ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMBVP1, 0x002B); + ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMBKP, 0x00A7); + ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMBIN, 0x00A7); + ALARM_CONFIGURATION_MEMORY_ADDRESSES.put(THING_TYPE_VMB4PB, 0x00A7); } private static final byte ALARM_CONFIGURATION_MEMORY_SIZE = 0x09; diff --git a/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/i18n/velbus.properties b/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/i18n/velbus.properties index e53696cff1..6010701dfd 100644 --- a/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/i18n/velbus.properties +++ b/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/i18n/velbus.properties @@ -37,6 +37,8 @@ thing-type.velbus.vmb4an.label = VMB4AN thing-type.velbus.vmb4an.description = Analog I/O module thing-type.velbus.vmb4dc.label = VMB4DC thing-type.velbus.vmb4dc.description = 4-channel 0/1-10V dimmer controller +thing-type.velbus.vmb4pb.label = VMB4PB +thing-type.velbus.vmb4pb.description = 4 button interface module thing-type.velbus.vmb4ry.label = VMB4RY thing-type.velbus.vmb4ry.description = 4-channel relay module thing-type.velbus.vmb4ryld.label = VMB4RYLD @@ -93,6 +95,10 @@ thing-type.velbus.vmbgpod-2.label = VMBGPOD-2 thing-type.velbus.vmbgpod-2.description = Glass control module with oled display and temperature controller (Edition 2) thing-type.velbus.vmbgpod.label = VMBGPOD thing-type.velbus.vmbgpod.description = Glass control module with oled display and temperature controller +thing-type.velbus.vmbin.label = VMBIN +thing-type.velbus.vmbin.description = 1-channel input module +thing-type.velbus.vmbkp.label = VMBKP +thing-type.velbus.vmbkp.description = Keypad interface module thing-type.velbus.vmbmeteo.label = VMBMETEO thing-type.velbus.vmbmeteo.description = Weather station with thermometer, anemometer, rain sensor and light sensor thing-type.velbus.vmbpirc.label = VMBPIRC @@ -435,6 +441,8 @@ channel-group-type.velbus.4channelCounterModule.label = Counters channel-group-type.velbus.4channelCounterModule.description = This is a generic module with 4 counter channels. channel-group-type.velbus.4channelFeedbackModule.label = Feedback channel-group-type.velbus.4channelFeedbackModule.description = This is a generic module with 4 feedback channels. +channel-group-type.velbus.5SubchannelButtonModule.label = Button +channel-group-type.velbus.5SubchannelButtonModule.description = This is a generic module with 5 button channels. Starting at channel 4. channel-group-type.velbus.6channelButtonModule.label = Button channel-group-type.velbus.6channelButtonModule.description = This is a generic module with 6 button channels. channel-group-type.velbus.6channelFeedbackModule.label = Feedback diff --git a/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/thing/thing-types.xml index b5fc046345..a4633a69f9 100644 --- a/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.velbus/src/main/resources/OH-INF/thing/thing-types.xml @@ -867,6 +867,58 @@ + + + + + + + + Keypad interface module + + + + + + + + + + + + + + + + + 1-channel input module + + + + + + + + + + + + + + + + + 4 button interface module + + + + + + + + + + String @@ -1327,6 +1379,19 @@ + + + + This is a generic module with 5 button channels. Starting at channel 4. + + + + + + + + +