From 888f9621167d8862d594197f343bf18c2e90eb7f Mon Sep 17 00:00:00 2001 From: Giovanni Fabiani Date: Sun, 8 May 2022 21:02:42 +0200 Subject: [PATCH] [openwebnet] Add support for sending Auxiliary (AUX) commands/messages to the bus (WHO=9) (#12468) Signed-off-by: Giovanni Fabiani --- .../org.openhab.binding.openwebnet/README.md | 63 ++++++--- .../internal/OpenWebNetBindingConstants.java | 11 +- .../internal/OpenWebNetHandlerFactory.java | 5 + .../OpenWebNetDeviceDiscoveryService.java | 7 + .../handler/OpenWebNetAuxiliaryHandler.java | 131 ++++++++++++++++++ .../handler/OpenWebNetBridgeHandler.java | 3 +- .../main/resources/OH-INF/thing/BusAux.xml | 34 +++++ .../main/resources/OH-INF/thing/channels.xml | 23 +++ .../internal/handler/OwnIdTest.java | 8 +- 9 files changed, 263 insertions(+), 22 deletions(-) create mode 100644 bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java create mode 100644 bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml diff --git a/bundles/org.openhab.binding.openwebnet/README.md b/bundles/org.openhab.binding.openwebnet/README.md index bbccb32565c..70658a2a836 100644 --- a/bundles/org.openhab.binding.openwebnet/README.md +++ b/bundles/org.openhab.binding.openwebnet/README.md @@ -38,15 +38,16 @@ The following Things and OpenWebNet `WHOs` are supported: ### For BUS/SCS -| Category | WHO | Thing Type IDs | Description | Status | -| ----------------------------- | :----------: | :--------------------------------------------------------: | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Gateway Management | `13` | `bus_gateway` | Any IP gateway supporting OpenWebNet protocol should work | Successfully tested: F452, F453, F453AV,F454, F455, MyHOMEServer1, MyHOME_Screen10, MyHOME_Screen3,5, MH201, MH202, MH200N. Some connection stability issues/gateway resets reported with MH202  | -| Lighting | `1` | `bus_on_off_switch`, `bus_dimmer` | BUS switches and dimmers | Successfully tested: F411/2, F411/4, F411U2, F422, F429. Some discovery issues reported with F429 (DALI Dimmers) | -| Automation | `2` | `bus_automation` | BUS roller shutters, with position feedback and auto-calibration | Successfully tested: LN4672M2 | -| Temperature Control | `4` | `bus_thermo_zone`, `bus_thermo_sensor`, `bus_thermo_cu` | Thermo zones management and temperature sensors (probes). | Successfully tested: H/LN4691, HS4692, KG4691; thermo sensors: L/N/NT4577 + 3455; Central Units (4 or 99 zones) are not fully supported yet. See [Channels - Thermo](#configuring-thermo) for more details | -| CEN & CEN+ Scenarios | `15` & `25` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | CEN/CEN+ scenarios events and virtual activation | Successfully tested: scenario buttons: HC/HD/HS/L/N/NT4680 | -| Dry Contact and IR Interfaces | `25` | `bus_dry_contact_ir` | Dry Contacts and IR Interfaces | Successfully tested: contact interfaces F428 and 3477; IR sensors: HC/HD/HS/L/N/NT4610 | -| Energy Management | `18` | `bus_energy_meter` | Energy Management | Successfully tested: F520, F521 | +| Category | WHO | Thing Type IDs | Description | Status | +|-------------------------------|:-----------:|:----------------------------------------------------------:|------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Gateway Management | `13` | `bus_gateway` | Any IP gateway supporting OpenWebNet protocol should work | Successfully tested: F452, F453, F453AV,F454, F455, MyHOMEServer1, MyHOME_Screen10, MyHOME_Screen3,5, MH201, MH202, MH200N. Some connection stability issues/gateway resets reported with MH202  | +| Lighting | `1` | `bus_on_off_switch`, `bus_dimmer` | BUS switches and dimmers | Successfully tested: F411/2, F411/4, F411U2, F422, F429. Some discovery issues reported with F429 (DALI Dimmers) | +| Automation | `2` | `bus_automation` | BUS roller shutters, with position feedback and auto-calibration | Successfully tested: LN4672M2 | +| Temperature Control | `4` | `bus_thermo_zone`, `bus_thermo_sensor`, `bus_thermo_cu` | Thermo zones management and temperature sensors (probes). | Successfully tested: H/LN4691, HS4692, KG4691; thermo sensors: L/N/NT4577 + 3455; Central Units (4 or 99 zones) are not fully supported yet. See [Channels - Thermo](#configuring-thermo) for more details | +| Auxiliary (AUX) | `9` | `bus_aux` | AUX commands | Successfully tested: AUX configured for bulgrar-alarm unit 3486. Only sending AUX commands is supported | +| CEN & CEN+ Scenarios | `15` & `25` | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | CEN/CEN+ scenarios events and virtual activation | Successfully tested: scenario buttons: HC/HD/HS/L/N/NT4680 | +| Dry Contact and IR Interfaces | `25` | `bus_dry_contact_ir` | Dry Contacts and IR Interfaces | Successfully tested: contact interfaces F428 and 3477; IR sensors: HC/HD/HS/L/N/NT4610 | +| Energy Management | `18` | `bus_energy_meter` | Energy Management | Successfully tested: F520, F521 | ### For ZigBee (Radio) @@ -152,6 +153,21 @@ Temperature sensors can be configured defining a `bus_thermo_sensor` Thing with The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing. +#### Configuring Auxiliary (AUX) + +BUS Auxiliary commands (WHO=9) can be used to send on the BUS commands to control, for example, external devices or a BTcino Alarm system. + +To control a BTicino alarm system the alarm unit should be configured for example as follows: + +Antitheft -> Automations -> then toggle the Event option -> then select OPEN code + +- Type in the AUX command you want to set, e.g.\*9\*1\*4\## (where=4) +- Type in the associated Open Web Net code you want to execute, e.g.\*5\*8*#1234## (engage alarm on zones 1,2,3,4). + +Please note that receiving AUX messages originating from the bus is not supported yet, only sending messages to the bus is supported. + + + ### Central Unit integration missing points - Read setPoint temperature and current mode @@ -162,14 +178,15 @@ The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing. ### Lighting, Automation, Power meter, CEN/CEN+ Scenario Events and Dry Contact / IR Interfaces channels -| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write | -| ---------------------------------------- | ------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------- | :---------: | -| `switch` or `switch_01`/`02` for ZigBee | `bus_on_off_switch`, `zb_on_off_switch`, `zb_on_off_switch2u` | Switch | To switch the device `ON` and `OFF` | R/W | -| `brightness` | `bus_dimmer`, `zb_dimmer` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W | -| `shutter` | `bus_automation` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W | -| `button#X`   | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | String | Trigger channel for CEN/CEN+ scenario events [see possible values](#cen-cen-channels) | R (TRIGGER) | -| `sensor` | `bus_dry_contact_ir` | Switch | Indicates if a Dry Contact Interface is `ON`/`OFF`, or if a IR Sensor is detecting movement (`ON`), or not (`OFF`) | R | -| `power` | `bus_energy_meter` | Number:Power | The current active power usage from Energy Meter | R | +| Channel Type ID (channel ID) | Applies to Thing Type IDs | Item Type | Description | Read/Write | +|-----------------------------------------|---------------------------------------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------|:-----------:| +| `switch` or `switch_01`/`02` for ZigBee | `bus_on_off_switch`, `zb_on_off_switch`, `zb_on_off_switch2u` | Switch | To switch the device `ON` and `OFF` | R/W | +| `brightness` | `bus_dimmer`, `zb_dimmer` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W | +| `shutter` | `bus_automation` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W | +| `button#X`   | `bus_cen_scenario_control`, `bus_cenplus_scenario_control` | String | Trigger channel for CEN/CEN+ scenario events [see possible values](#cen-cen-channels) | R (TRIGGER) | +| `sensor` | `bus_dry_contact_ir` | Switch | Indicates if a Dry Contact Interface is `ON`/`OFF`, or if a IR Sensor is detecting movement (`ON`), or not (`OFF`) | R | +| `power` | `bus_energy_meter` | Number:Power | The current active power usage from Energy Meter | R | +| `aux` | `bus_aux` | String | Possible commands: ON,OFF,TOGGLE, STOP, UP,DOWN,ENABLED, DISABLED, RESET_GEN, RESET_BI, RESET_TRI. Only 'ON' and `OFF' are supported for now | R/W | ### Thermo channels @@ -263,6 +280,7 @@ Bridge openwebnet:bus_gateway:mybridge "MyHOMEServer1" [ host="192.168.1.35", pa bus_cen_scenario_control LR_CEN_scenario "Living Room CEN" [ where="51", buttons="4,3,8"] bus_cenplus_scenario_control LR_CENplus_scenario "Living Room CEN+" [ where="212", buttons="1,5,18" ] bus_dry_contact_ir LR_IR_sensor "Living Room IR Sensor" [ where="399" ] + bus_aux Alarm_activation "Alarm activation" [ where="4" ] } ``` @@ -320,7 +338,10 @@ Number:Temperature iEXT_temp "Temperature [%.1f %unit%]" (g String iCENPlusProxyItem "CEN+ Proxy Item" -Switch iLR_IR_sensor "Sensor" { channel="openwebnet:bus_dry_contact_ir:mybridge:LR_IR_sensor:sensor" } +String iAlarm_activation "Alarm Activation" { channel="openwebnet:bus_aux:mybridge:Alarm_activation:aux"} + +Switch iLR_IR_sensor "Sensor" { channel="openwebnet:bus_dry_contact_ir:mybridge:LR_IR_sensor:sensor" } + ``` @@ -368,6 +389,12 @@ sitemap openwebnet label="OpenWebNet Binding Example Sitemap" { Switch item=iCENPlusProxyItem label="My CEN+ scenario" icon="movecontrol" mappings=[ON="Activate"] } + + Frame label="Alarm activation via AUX command" + { + Switch item=iAlarm_activation icon="siren" + + } } ``` diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java index b5a436cd9e3..c51acc1401d 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java @@ -27,6 +27,7 @@ import org.openhab.core.thing.ThingTypeUID; * @author Massimo Valla - Initial contribution * @author Gilberto Cocchi - Thermoregulation * @author Andrea Conte - Energy management, Thermoregulation + * @author Giovanni Fabiani - Aux support */ @NonNullByDefault @@ -70,6 +71,8 @@ public class OpenWebNetBindingConstants { "bus_cenplus_scenario_control"); public static final String THING_LABEL_BUS_CENPLUS_SCENARIO_CONTROL = "CEN+ Control"; + public static final ThingTypeUID THING_TYPE_BUS_AUX = new ThingTypeUID(BINDING_ID, "bus_aux"); + public static final String THING_LABEL_BUS_AUX = "Auxiliary"; // ZIGBEE public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "zb_on_off_switch"); public static final String THING_LABEL_ZB_ON_OFF_SWITCH = "ZigBee Switch"; @@ -99,11 +102,14 @@ public class OpenWebNetBindingConstants { // ## CEN/CEN+ Scenario public static final Set SCENARIO_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_CEN_SCENARIO_CONTROL, THING_TYPE_BUS_CENPLUS_SCENARIO_CONTROL, THING_TYPE_BUS_DRY_CONTACT_IR); + + // ## Aux + public static final Set AUX_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_AUX); // ## Groups public static final Set DEVICE_SUPPORTED_THING_TYPES = Stream .of(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES, THERMOREGULATION_SUPPORTED_THING_TYPES, ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES, - SCENARIO_SUPPORTED_THING_TYPES, GENERIC_SUPPORTED_THING_TYPES) + SCENARIO_SUPPORTED_THING_TYPES, GENERIC_SUPPORTED_THING_TYPES, AUX_SUPPORTED_THING_TYPES) .flatMap(Collection::stream).collect(Collectors.toCollection(HashSet::new)); public static final Set BRIDGE_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_ZB_GATEWAY, THING_TYPE_BUS_GATEWAY); @@ -146,6 +152,9 @@ public class OpenWebNetBindingConstants { public static final String CHANNEL_TYPE_CEN_PLUS_BUTTON_EVENT = "cenPlusButtonEvent"; public static final String CHANNEL_DRY_CONTACT_IR = "sensor"; + // Aux + public static final String CHANNEL_AUX = "aux"; + // devices config properties public static final String CONFIG_PROPERTY_WHERE = "where"; public static final String CONFIG_PROPERTY_SHUTTER_RUN = "shutterRun"; diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java index 08077109bfb..3f484fb7922 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java @@ -17,6 +17,7 @@ import static org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetAutomationHandler; +import org.openhab.binding.openwebnet.internal.handler.OpenWebNetAuxiliaryHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetBridgeHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetEnergyHandler; import org.openhab.binding.openwebnet.internal.handler.OpenWebNetGenericHandler; @@ -39,6 +40,7 @@ import org.slf4j.LoggerFactory; * @author Massimo Valla - Initial contribution * @author Andrea Conte - Energy management, Thermoregulation * @author Gilberto Cocchi - Thermoregulation + * @author Giovanni Fabiani - Auxiliary support */ @NonNullByDefault @Component(configurationPid = "binding.openwebnet", service = ThingHandlerFactory.class) @@ -74,6 +76,9 @@ public class OpenWebNetHandlerFactory extends BaseThingHandlerFactory { } else if (OpenWebNetScenarioHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { logger.debug("creating NEW SCENARIO Handler --- {}", thing.getUID()); return new OpenWebNetScenarioHandler(thing); + } else if (OpenWebNetAuxiliaryHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { + logger.debug("Creating NEW AUXILIARY Handler"); + return new OpenWebNetAuxiliaryHandler(thing); } logger.warn("ThingType {} is not supported by this binding", thing.getThingTypeUID()); return null; diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java index 3065fbb3984..e366671fb6e 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java @@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory; * @author Massimo Valla - Initial contribution * @author Andrea Conte - Energy management, Thermoregulation * @author Gilberto Cocchi - Thermoregulation + * @author Giovanni Fabiani - Aux support */ @NonNullByDefault public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService @@ -173,6 +174,12 @@ public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService deviceWho = Who.CEN_PLUS_SCENARIO_SCHEDULER; break; } + case SCS_AUXILIARY_TOGGLE_CONTROL: { + thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_AUX; + thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_AUX; + deviceWho = Who.AUX; + break; + } default: logger.warn("Device type {} is not supported, default to GENERIC device (WHERE={})", deviceType, where); if (where instanceof WhereZigBee) { diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java new file mode 100644 index 00000000000..75ab772b884 --- /dev/null +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.openwebnet.internal.handler; + +import static org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants.CHANNEL_AUX; + +import java.util.Set; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.openwebnet.internal.OpenWebNetBindingConstants; +import org.openhab.core.library.types.StringType; +import org.openhab.core.thing.ChannelUID; +import org.openhab.core.thing.Thing; +import org.openhab.core.thing.ThingStatus; +import org.openhab.core.thing.ThingStatusDetail; +import org.openhab.core.thing.ThingTypeUID; +import org.openhab.core.types.Command; +import org.openwebnet4j.communication.OWNException; +import org.openwebnet4j.message.Auxiliary; +import org.openwebnet4j.message.BaseOpenMessage; +import org.openwebnet4j.message.MalformedFrameException; +import org.openwebnet4j.message.OpenMessage; +import org.openwebnet4j.message.UnsupportedFrameException; +import org.openwebnet4j.message.Where; +import org.openwebnet4j.message.WhereAuxiliary; +import org.openwebnet4j.message.Who; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The {@link OpenWebNetAuxiliaryHandler} is responsible for sending Auxiliary (AUX) commands/messages to the bus + * It extends the abstract {@link OpenWebNetThingHandler}. + * + * NOTICE: Support for handling messages from the bus regarding alarm control has to be implemented + * + * @author Giovanni Fabiani - Initial contribution + * + */ +@NonNullByDefault +public class OpenWebNetAuxiliaryHandler extends OpenWebNetThingHandler { + + public static final Set SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.AUX_SUPPORTED_THING_TYPES; + private final Logger logger = LoggerFactory.getLogger(OpenWebNetAuxiliaryHandler.class); + + public OpenWebNetAuxiliaryHandler(Thing thing) { + super(thing); + } + + /** + * Handles Auxiliary command for a channel + * + * @param channel the channel + * @param command the Command + */ + @Override + protected void handleChannelCommand(ChannelUID channel, Command command) { + logger.debug("handleAuxiliaryCommand() (command={} - channel={})", command, channel); + Where w = deviceWhere; + if (w != null) { + if (channel.getId().equals(CHANNEL_AUX)) { + if (command instanceof StringType) { + try { + if (command.toString().equals(Auxiliary.WhatAuxiliary.ON.name())) { + send(Auxiliary.requestTurnOn(w.value())); + } else if (command.toString().equals(Auxiliary.WhatAuxiliary.OFF.name())) { + send(Auxiliary.requestTurnOff(w.value())); + } + } catch (OWNException e) { + logger.debug("Exception while processing command {}: {}", command, e.getMessage()); + } + } else { + logger.debug("Unsupported command {} for channel {}", command, channel); + } + } else { + logger.debug("Unsupported ChannelUID {}", channel); + } + } + } + + @Override + protected void requestChannelState(ChannelUID channel) { + /* + * NOTICE: It is not possible to get the state of a + * WHO=9 command. To get state of the Alarm system use WHO=5 instead + */ + + super.requestChannelState(channel); + Where w = deviceWhere; + if (w != null) { + try { + OpenMessage msg = BaseOpenMessage.parse("*#9##"); + // initializing + send(msg); + } catch (MalformedFrameException | UnsupportedFrameException | OWNException e) { + logger.debug("Exception while processing command: {}", e.getMessage()); + updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); + } + } + } + + @Override + protected void refreshDevice(boolean refreshAll) { + /* + * NOTICE: It is not possible to refresh the state of a + * WHO=9 command. To refresh the state of the Alarm system use WHO=5 instead + */ + + logger.debug("--- refreshDevice() : refreshing SINGLE... ({})", thing.getUID()); + requestChannelState(new ChannelUID(thing.getUID(), CHANNEL_AUX)); + } + + @Override + protected Where buildBusWhere(String wStr) throws IllegalArgumentException { + return new WhereAuxiliary(wStr); + } + + @Override + protected String ownIdPrefix() { + return Who.AUX.value().toString(); + } +} diff --git a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java index f28de749ab0..f7c58014c97 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java +++ b/bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java @@ -49,6 +49,7 @@ import org.openwebnet4j.USBGateway; import org.openwebnet4j.communication.OWNAuthException; import org.openwebnet4j.communication.OWNException; import org.openwebnet4j.message.Automation; +import org.openwebnet4j.message.Auxiliary; import org.openwebnet4j.message.BaseOpenMessage; import org.openwebnet4j.message.CEN; import org.openwebnet4j.message.EnergyManagement; @@ -497,7 +498,7 @@ public class OpenWebNetBridgeHandler extends ConfigStatusBridgeHandler implement BaseOpenMessage baseMsg = (BaseOpenMessage) msg; // let's try to get the Thing associated with this message... if (baseMsg instanceof Lighting || baseMsg instanceof Automation || baseMsg instanceof EnergyManagement - || baseMsg instanceof Thermoregulation || baseMsg instanceof CEN) { + || baseMsg instanceof Thermoregulation || baseMsg instanceof CEN || baseMsg instanceof Auxiliary) { String ownId = ownIdFromMessage(baseMsg); logger.debug("ownIdFromMessage({}) --> {}", baseMsg, ownId); OpenWebNetThingHandler deviceHandler = registeredDevices.get(ownId); diff --git a/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml new file mode 100644 index 00000000000..afc30924b11 --- /dev/null +++ b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + A OpenWebNet BUS/SCS Auxiliary command + + + + + + + BTicino/Legrand + 272 + + + ownId + + + + + Example: Where=1 + + + + + diff --git a/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml index c8b91b615cf..698a7cc0d1c 100644 --- a/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml @@ -16,6 +16,29 @@ + + + + String + + Controls an Auxiliary command (read/write) + + + + + + + + + + + + + + + + + Dimmer diff --git a/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java b/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java index 3ed1724b8c7..87f02831ea9 100644 --- a/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java +++ b/bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java @@ -22,6 +22,7 @@ import org.openhab.core.thing.Bridge; import org.openwebnet4j.message.BaseOpenMessage; import org.openwebnet4j.message.FrameException; import org.openwebnet4j.message.Where; +import org.openwebnet4j.message.WhereAuxiliary; import org.openwebnet4j.message.WhereCEN; import org.openwebnet4j.message.WhereEnergyManagement; import org.openwebnet4j.message.WhereLightAutom; @@ -38,6 +39,7 @@ import org.slf4j.LoggerFactory; * * @author Massimo Valla - Initial contribution * @author Andrea Conte - Energy management + * @author Giovanni Fabiani - AAuxiliary message support */ @NonNullByDefault public class OwnIdTest { @@ -64,7 +66,7 @@ public class OwnIdTest { * BUS CEN 51 51 15.51 51 * BUS CEN+ 212 212 25.212 212 * BUS DryContact 399 399 25.399 399 - * + * BUS AUX 4 4 9.4 4 */ // @formatter:on @@ -83,7 +85,9 @@ public class OwnIdTest { bus_energy(new WhereEnergyManagement("51"), Who.fromValue(18), "*#18*51*113##", "51", "18.51", "51"), bus_cen(new WhereCEN("51"), Who.fromValue(15), "*15*31*51##", "51", "15.51", "51"), bus_cen_plus(new WhereCEN("212"), Who.fromValue(25), "*25*21#31*212##", "212", "25.212", "212"), - bus_drycontact(new WhereCEN("399"), Who.fromValue(25), "*25*32#1*399##", "399", "25.399", "399"); + bus_drycontact(new WhereCEN("399"), Who.fromValue(25), "*25*32#1*399##", "399", "25.399", "399"), + bus_aux(new WhereAuxiliary("4"), Who.fromValue(9), "*9*1*4##","4","9.4","4"); + // @formatter:on