]> git.basschouten.com Git - openhab-addons.git/commitdiff
[openwebnet] Add support for sending Auxiliary (AUX) commands/messages to the bus...
authorGiovanni Fabiani <fabiani.giovanni@gmail.com>
Sun, 8 May 2022 19:02:42 +0000 (21:02 +0200)
committerGitHub <noreply@github.com>
Sun, 8 May 2022 19:02:42 +0000 (21:02 +0200)
Signed-off-by: Giovanni Fabiani <fabiani.giovanni@gmail.com>
bundles/org.openhab.binding.openwebnet/README.md
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetAuxiliaryHandler.java [new file with mode: 0644]
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetBridgeHandler.java
bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusAux.xml [new file with mode: 0644]
bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml
bundles/org.openhab.binding.openwebnet/src/test/java/org/openhab/binding/openwebnet/internal/handler/OwnIdTest.java

index bbccb32565c2e65a3daa5dc9c7dc794e94c99d8e..70658a2a8368cd7d2a6057e133bfda1f7a3cccf7 100644 (file)
@@ -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"
+         
+    }
 }
 ```
 
index b5a436cd9e3abfba5cf37548632d5e3737acafb3..c51acc1401d7755f41f6a51b7a369dedc6fc2c47 100644 (file)
@@ -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<ThingTypeUID> 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<ThingTypeUID> AUX_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_AUX);
     // ## Groups
     public static final Set<ThingTypeUID> 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<ThingTypeUID> 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";
index 08077109bfb19846ba9e571d71bae5b0969116d7..3f484fb79227da9afa3baf76cbd7adcdef6779a5 100644 (file)
@@ -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;
index 3065fbb39849b735199e87acf7663037db64cba8..e366671fb6e01c590b1445b2716aead83aa0d5be 100644 (file)
@@ -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 (file)
index 0000000..75ab772
--- /dev/null
@@ -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<ThingTypeUID> 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();
+    }
+}
index f28de749ab064331f15b84c40e52f64a335f344f..f7c58014c97228aa3df41a32fb5779d088208a95 100644 (file)
@@ -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 (file)
index 0000000..afc3092
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<thing:thing-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" bindingId="openwebnet"
+       xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
+
+       <!-- Thing for BUS Auxiliary commands -->
+       <thing-type id="bus_aux">
+               <supported-bridge-type-refs>
+                       <bridge-type-ref id="bus_gateway"/>
+               </supported-bridge-type-refs>
+
+               <label>Auxiliary</label>
+               <description>A OpenWebNet BUS/SCS Auxiliary command</description>
+
+               <channels>
+                       <channel id="aux" typeId="aux"/>
+               </channels>
+
+               <properties>
+                       <property name="vendor">BTicino/Legrand</property>
+                       <property name="ownDeviceType">272</property>
+               </properties>
+
+               <representation-property>ownId</representation-property>
+
+               <config-description>
+                       <parameter name="where" type="text" required="true">
+                               <label>OpenWebNet Address (where)</label>
+                               <description>Example: Where=1</description>
+                       </parameter>
+               </config-description>
+
+       </thing-type>
+</thing:thing-descriptions>
index c8b91b615cfc0e2cfd0127f69b6c509dda9b6a6a..698a7cc0d1c3d2b82a80bb70bb4592992929b9fc 100644 (file)
                </tags>
        </channel-type>
 
+       <!-- Aux channel -->
+       <!--Only ON and OFF options are supported -->
+       <channel-type id="aux">
+               <item-type>String</item-type>
+               <label>Auxiliary</label>
+               <description>Controls an Auxiliary command (read/write)</description>
+               <state>
+                       <options>
+                               <option value="OFF">Off</option>
+                               <option value="ON">On</option>
+                               <option value="TOGGLE">Toggle</option>
+                               <option value="STOP">Stop</option>
+                               <option value="UP">Up</option>
+                               <option value="DOWN">Down</option>
+                               <option value="ENABLED">Enabled</option>
+                               <option value="DISABLED">Disabled</option>
+                               <option value="RESET_GEN">Reset gen</option>
+                               <option value="RESET_BI">Reset bi</option>
+                               <option value="RESET_TRI">Reset tri</option>
+                       </options>
+               </state>
+       </channel-type>
+
        <!-- Brightness Channel -->
        <channel-type id="brightness">
                <item-type>Dimmer</item-type>
index 3ed1724b8c7b8c9dfc84b22bddbde1d5ddc5fafd..87f02831ea9543b63cc0a9be45596cccdb2107a0 100644 (file)
@@ -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