diff --git a/ESH-INF/binding/binding.xml b/ESH-INF/binding/binding.xml index a7b10cd..d69fa89 100644 --- a/ESH-INF/binding/binding.xml +++ b/ESH-INF/binding/binding.xml @@ -1,10 +1,10 @@ - OpenWebNet Binding (beta5) + OpenWebNet Binding (beta6) The OpenWebNet Binding integrates the BTicino/Legrand 'MyHOME' connected home system using the OpenWebNet protocol. It supports BUS (SCS) and ZigBee USB gateways to control BTicino/Legrand switches, dimmers, shutters, etc. More info: http://www.bticino.com/products-catalogue/management-of-connected-lights-and-shutters/ Massimo Valla diff --git a/ESH-INF/thing/Automation.xml b/ESH-INF/thing/Automation.xml index 462d5e8..5d105b4 100644 --- a/ESH-INF/thing/Automation.xml +++ b/ESH-INF/thing/Automation.xml @@ -10,7 +10,7 @@ - + A OpenWebNet ZigBee automation device to control roller shutters, blinds, etc. BTicino models: xxx/yyyy/etc. @@ -25,15 +25,15 @@ - - Time (in ms) to go from max position (e.g. CLOSED) to the other position (e.g. OPEN). Example: 12000 (=12sec). - Use AUTO (default) to calibrate the shutter automatically (UP->DOWN->Position%) the first time a Position command (%) is sent. - true - AUTO - - + + Time (in ms) to go from max position (e.g. CLOSED) to the other position (e.g. OPEN). Example: 12000 (=12sec). + Use AUTO (default) to calibrate the shutter automatically (UP->DOWN->Position%) the first time a Position command (%) is sent. + true + AUTO + + - It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 + It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 true diff --git a/ESH-INF/thing/BusAutomation.xml b/ESH-INF/thing/BusAutomation.xml index 7a9e7c1..371dbae 100644 --- a/ESH-INF/thing/BusAutomation.xml +++ b/ESH-INF/thing/BusAutomation.xml @@ -9,7 +9,7 @@ - + A OpenWebNet BUS/SCS automation device to control roller shutters, blinds, etc. BTicino models: xxx/yyyy/etc. @@ -21,16 +21,16 @@ - - Time (in ms) to go from max position (e.g. CLOSED) to the other position (e.g. OPEN). Example: 12000 (=12sec). - Use AUTO (default) to calibrate the shutter automatically (UP->DOWN->Position%) the first time a Position command (%) is sent. - true - AUTO - - - - - Example: A/PL address: A=1 PL=1 --> WHERE=11. On local bus: WHERE=11#4#01 + + Time (in ms) to go from max position (e.g. CLOSED) to the other position (e.g. OPEN). Example: 12000 (=12sec). + Use AUTO (default) to calibrate the shutter automatically (UP->DOWN->Position%) the first time a Position command (%) is sent. + true + AUTO + + + + + Example: A/PL address: A=1 PL=3 --> WHERE=13. On local bus: WHERE=13#4#01 true diff --git a/ESH-INF/thing/BusDimmer.xml b/ESH-INF/thing/BusDimmer.xml index 759a987..21de201 100644 --- a/ESH-INF/thing/BusDimmer.xml +++ b/ESH-INF/thing/BusDimmer.xml @@ -11,26 +11,26 @@ - + A OpenWebNet BUS/SCS dimmer for the dimmer control of 1 light. BTicino models: yyyy/zzzz/etc. - - - - - + + + + + - BTicino/Legrand - BTI-yyyy/zzzz/etc. - 258 - - - - - - Example: A/PL address: A=1 PL=1 --> WHERE=11. On local bus: WHERE=11#4#01 - true - - + BTicino/Legrand + BTI-yyyy/zzzz/etc. + 258 + + + + + + Example: A/PL address: A=1 PL=3 --> WHERE=13. On local bus: WHERE=13#4#01 + true + + diff --git a/ESH-INF/thing/BusGateway.xml b/ESH-INF/thing/BusGateway.xml index 8056f06..5865558 100644 --- a/ESH-INF/thing/BusGateway.xml +++ b/ESH-INF/thing/BusGateway.xml @@ -1,44 +1,44 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" + xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> - - - - + + + + - - BTicino - Unknown - - - - - - - network-address - - OpenWebNet gateway IP address / hostname (example: 192.168.1.35) - true - - - - - OpenWebNet gateway port (default: 20000) - false - - - - password-create - - OpenWebNet gateway password (default: 12345) - false - - - - - + + BTicino + Unknown + + + + + + + network-address + + OpenWebNet gateway IP address / hostname (example: 192.168.1.35) + true + + + + + OpenWebNet gateway port (default: 20000) + false + + + + password-create + + OpenWebNet gateway password (default: 12345) + false + + + + + diff --git a/ESH-INF/thing/BusOnOffSwitch.xml b/ESH-INF/thing/BusOnOffSwitch.xml index 6650c3a..29f4490 100644 --- a/ESH-INF/thing/BusOnOffSwitch.xml +++ b/ESH-INF/thing/BusOnOffSwitch.xml @@ -11,26 +11,26 @@ - + A OpenWebNet BUS/SCS switch for the control of 1 light/load. BTicino models: xxx/yyyy/etc. - - + + - BTicino/Legrand - BTI-xxxx/yyyy/etc. - 261 - - - - - - Example: A/PL address: A=1 PL=1 --> WHERE=11. On local bus: WHERE=11#4#01 - true - - + BTicino/Legrand + BTI-xxxx/yyyy/etc. + 261 + + + + + + Example: A/PL address: A=1 PL=3 --> WHERE=13. On local bus: WHERE=13#4#01 + true + + diff --git a/ESH-INF/thing/Device.xml b/ESH-INF/thing/Device.xml index 2def412..fb67968 100644 --- a/ESH-INF/thing/Device.xml +++ b/ESH-INF/thing/Device.xml @@ -11,23 +11,22 @@ - + An OpenWebNet Generic Device. - - - - BTicino/Legrand - Unknown - 0 - - - - - - It identifies one OpenWebNet device - true - - + + BTicino/Legrand + Unknown + 0 + + + + + + It identifies one OpenWebNet device + true + + + diff --git a/ESH-INF/thing/Dimmer.xml b/ESH-INF/thing/Dimmer.xml index 4a16cb3..871c7a4 100644 --- a/ESH-INF/thing/Dimmer.xml +++ b/ESH-INF/thing/Dimmer.xml @@ -11,27 +11,27 @@ - + A OpenWebNet ZigBee dimmer for the dimmer control of 1 light. BTicino models: 4585/4594/etc. - - - - - - + + + + + + - BTicino/Legrand - BTI-4585/4594/etc. - 258 - - - - - - It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 - true - - + BTicino/Legrand + BTI-4585/4594/etc. + 258 + + + + + + It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 + true + + diff --git a/ESH-INF/thing/Dongle.xml b/ESH-INF/thing/Dongle.xml index a6848b5..2d78c17 100644 --- a/ESH-INF/thing/Dongle.xml +++ b/ESH-INF/thing/Dongle.xml @@ -1,28 +1,28 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" + xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> - - - - For more information see:
  • http://www.catalogue.bticino.com/BTI-3578-EN
  • http://ecatalogue.legrand.fr/088328-interface-open-radio-permet-piloter-installation.html
  • ]]>
    + + + + For more information see:
  • http://www.catalogue.bticino.com/BTI-3578-EN
  • http://ecatalogue.legrand.fr/088328-interface-open-radio-permet-piloter-installation.html
  • ]]>
    - - BTicino/Legrand - BTI-3578/088328 - - - - - - - Serial port to which the USB dongle is connected. Example: COM3 (Win), /dev/ttyUSB0 (Linux), etc. - true - - - -
    + + BTicino/Legrand + BTI-3578/088328 + + + + + + + Serial port to which the USB dongle is connected. Example: COM3 (Win), /dev/ttyUSB0 (Linux), etc. + true + + + +
    diff --git a/ESH-INF/thing/OnOffSwitch.xml b/ESH-INF/thing/OnOffSwitch.xml index c7bfc2b..650d522 100644 --- a/ESH-INF/thing/OnOffSwitch.xml +++ b/ESH-INF/thing/OnOffSwitch.xml @@ -11,26 +11,26 @@ - + A OpenWebNet ZigBee switch (actuator) for the control of 1 load/light. BTicino models: 4591/3684/etc. - - + + - BTicino/Legrand - BTI-4591/3684/etc. - 256 - - - - - - It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 - true - - + BTicino/Legrand + BTI-4591/3684/etc. + 256 + + + + + + It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 + true + + diff --git a/ESH-INF/thing/OnOffSwitch2Units.xml b/ESH-INF/thing/OnOffSwitch2Units.xml index 0cdfe1f..1985da7 100644 --- a/ESH-INF/thing/OnOffSwitch2Units.xml +++ b/ESH-INF/thing/OnOffSwitch2Units.xml @@ -11,27 +11,27 @@ - + A OpenWebNet ZigBee 2-units switch (actuator) for the control of 2 loads/lights. BTicino model: 4592 - - + + - BTicino/Legrand - BTI-4592 - 256 - - - - - - It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 - true - - + BTicino/Legrand + BTI-4592 + 256 + + + + + + It identifies one ZigBee device. Use decimal format address without the UNIT part and network: ZigBee WHERE=414122201#9 -> OpenWebNet Device Address = 4141222 + true + + diff --git a/ESH-INF/thing/channels.xml b/ESH-INF/thing/channels.xml index 02177b6..06f191c 100644 --- a/ESH-INF/thing/channels.xml +++ b/ESH-INF/thing/channels.xml @@ -1,47 +1,80 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" + xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> - - Switch - - Switch the power ON and OFF - Light - - Lighting - - + + Switch + + Switch the power ON and OFF + Light + + Lighting + + - - - Dimmer - - Control the brightness and switch the light ON and OFF - DimmableLight - - Lighting - - - - - Number - - Control the dimmer level - DimmableLight - - Lighting - + + + Dimmer + + Control the brightness and switch the light ON and OFF + DimmableLight + + Lighting + + + + + Number + + Control the dimmer level + DimmableLight + + Lighting + + + + + + + Rollershutter + + Control the shutter position + Blinds + + + + + Number:Temperature + + Current temperature + Temperature + + + + + Number:Temperature + + The set point temperature + Temperature + - - - - Rollershutter - - Blinds + + String + + Current mode of the thermostat + + + + + + + + + - + diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index d98bec8..144b871 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -1,21 +1,24 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: OpenWebNet Binding (beta5) +Bundle-Name: OpenWebNet Binding Bundle-SymbolicName: org.openhab.binding.openwebnet;singleton:=true Bundle-Vendor: openHAB -Bundle-Version: 2.3.0.b5 +Bundle-Version: 2.4.0.b6 Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ClassPath: ., - lib/openwebnet-lib-0.9.4.jar + lib/openwebnet-lib-0.9.7.jar Import-Package: com.google.common.base, com.google.common.collect, gnu.io, + javax.measure, + javax.measure.quantity, org.eclipse.jdt.annotation;resolution:=optional, org.eclipse.smarthome.config.core, org.eclipse.smarthome.config.core.status, org.eclipse.smarthome.config.discovery, org.eclipse.smarthome.core.library.types, + org.eclipse.smarthome.core.library.unit, org.eclipse.smarthome.core.thing, org.eclipse.smarthome.core.thing.binding, org.eclipse.smarthome.core.thing.binding.builder, @@ -31,6 +34,6 @@ Service-Component: OSGI-INF/*.xml Export-Package: org.openhab.binding.openwebnet, org.openhab.binding.openwebnet.handler Bundle-ActivationPolicy: lazy -COMMENT: COMMENT the following line to release, UNCOMMENT for development +COMMENT-INFO: COMMENT the following line to release, UNCOMMENT for development COMMENT: Require-Bundle: openwebnet-lib diff --git a/OSGI-INF/BusGatewayDiscoveryParticipant.xml b/OSGI-INF/BusGatewayDiscoveryParticipant.xml index 606654d..000034a 100644 --- a/OSGI-INF/BusGatewayDiscoveryParticipant.xml +++ b/OSGI-INF/BusGatewayDiscoveryParticipant.xml @@ -1,7 +1,7 @@ - - - - + + + + \ No newline at end of file diff --git a/OSGI-INF/OpenWebNetBridgeDiscovery.xml b/OSGI-INF/OpenWebNetBridgeDiscovery.xml index e702823..1e78682 100644 --- a/OSGI-INF/OpenWebNetBridgeDiscovery.xml +++ b/OSGI-INF/OpenWebNetBridgeDiscovery.xml @@ -1,17 +1,17 @@ - - - - + + + + diff --git a/OSGI-INF/OpenWebNetHandlerFactory.xml b/OSGI-INF/OpenWebNetHandlerFactory.xml index d1dd39e..6d09ca0 100644 --- a/OSGI-INF/OpenWebNetHandlerFactory.xml +++ b/OSGI-INF/OpenWebNetHandlerFactory.xml @@ -1,7 +1,7 @@ diff --git a/README.md b/README.md index eba2437..6bab4ac 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,10 @@ The following Things and OpenWebNet `WHOs` are supported: | Category | WHO | Thing Type IDs | Discovery? | Feedback from BUS? | Description | Status | | ---------- | :---: | :-------------------------------: | :----------------: | :----------------: | --------------------------------------------------------------------------------------- | ---------------- | | Gateway | `13` | `bus_gateway` | *work in progress* | n/a | Any IP gateway supporting OpenWebNet protocol should work (e.g. F454/MyHOMEServer1/MH202/F455/MH200N,...) | Successfully tested: F454, MyHOMEServer1, MH202, F455 | -| Lightning| `1` | `bus_on_off_switch`, `bus_dimmer` | Yes | Yes | BUS switches and dimmers | Successfully tested: F411/2, F411/4, F411U2 | -| Automation | `2` | `bus_automation` | Yes | Yes | BUS shutters, with position feedback and auto-calibration via a *UP >> DOWN >> Position%* cycle | Successfully tested: LN4672M2 | -| Temperature Control| `4` | *work in progress* | - | -| - | - | +| Lightning | `1` | `bus_on_off_switch`, `bus_dimmer` | Yes | Yes | BUS switches and dimmers | Successfully tested: F411/2, F411/4, F411U2, F429 | +| Automation | `2` | `bus_automation` | Yes | Yes | BUS roller shutters, with position feedback and auto-calibration via a *UP >> DOWN >> Position%* cycle | Successfully tested: LN4672M2 | +| Temperature Control | `4` | *work in progress* | | | | + ### ZigBee (Radio) @@ -39,22 +40,22 @@ The following Things and OpenWebNet `WHOs` are supported: | ---------- | :---: | :------------------------------------------: | :----------------: | :--------: | ----------------------------------------------------------- | ------------------------------------ | | Gateway | `13` | `dongle` | Yes | n/a | ZigBee USB Dongle (BTicino/Legrand models: BTI-3578/088328) | Tested: BTI-3578 | | Lightning| `1` | `dimmer`, `on_off_switch`, `on_off_switch2u` | Yes | Yes | ZigBee dimmers, switches and 2-unit switches | Tested: BTI-4591, BTI-3584, BTI-4585 | -| Automation | `2` | `automation` | Yes | Yes | ZigBee shutters, with position feedback and auto-calibration via a *UP >> DOWN >> Position%* cycle | *To be tested* | -| Temperature Control| `4` | *work in progress* | - | -| - | - | +| Automation | `2` | `automation` | Yes | Yes | ZigBee roller shutters, with position feedback and auto-calibration via a *UP >> DOWN >> Position%* cycle | *To be tested* | + ## Installation Since it's still in development stage and not part of the official distribution, to install the binding copy the jar file to your openHAB2 addons folder, on Linux or RaspberryPi is under: `/usr/share/openhab2/addons/` -Also, from **openHAB 2.3.0** and afterwards the serial feature dependency must be activated manually from Karaf console: +Also, from **openHAB 2.3.0** onwards the serial feature dependency must be activated manually from Karaf console: 1. go to [Karaf console](https://www.openhab.org/docs/administration/console.html) 1. Type `feature:install openhab-transport-serial` The binding should now be installed: check in *PaperUI > Configuration > Bindings*. -### Upgrade from previous release +### Upgrade from previous release version The previous version of the binding must be uninstalled using Karaf console (is not enough update the binding jar file). It is suggested also to remove BTicino Things before uninstalling the old binding, and discover/configure them again after binding has been updated. @@ -65,7 +66,7 @@ from Karaf console: 1. `bundle:uninstall ` to remove previous version of the binding 1. copy the new binding jar file to `addons/` folder -The new version of the binding should now be installed. +The new version of the binding should now be installed, check the version number in *PaperUI > Configuration > Bindings*. ## Discovery @@ -128,15 +129,17 @@ For all OpenWebNet devices it must be configured: - example for BUS/SCS: Point to Point `A=6 PL=4` on local bus --> `where="64#4#01"` - example for ZigBee/Radio: use decimal format address without the UNIT part and network: ZigBee `WHERE=414122201#9` --> `where="4141222"` + ## Channels Devices support some of the following channels: -| Channel Type ID | Item Type | Description | -| ----------------------------- | ------------- | -------------------------------------------------------------------- | -| switch | Switch | This channel supports switching the device `ON` and `OFF` | -| brightness | Dimmer | This channel supports adjusting the brightness value (Percent) | -| shutter | Rollershutter | This channel supports activation of roller shutters (`UP`, `DOWN`, `STOP`, Percent). For Percent and position feedback to work the `shutterRun` parameter must be configured equal to the time (in ms) to go from full UP to full DOWN. Use `shutterRun=AUTO` (default) to calibrate the shutter automatically the first time a Percent command is sent to the shutter: a *UP >> DOWN >> Position%* cycle will be performed automatically to calibrate the shutter. | +| Channel Type ID | Item Type | Description | Read/Write | +|-------------------------------|--------------------|------------------------------------------------------------------------|:----------:| +| switch | Switch | To switch the device `ON` and `OFF` | R/W | +| brightness | Dimmer | To adjust the brightness value (Percent) | R/W | +| shutter | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent). For Percent and position feedback to work the `shutterRun` parameter must be configured equal to the time (in ms) to go from full UP to full DOWN. Use `shutterRun=AUTO` (default) to calibrate the shutter automatically the first time a Percent command is sent to the shutter: a *UP >> DOWN >> Position%* cycle will be performed automatically to calibrate the shutter. Before adding/configuring roller shutter Things (or installing a binding update) it is suggested to have all roller shutter `UP`, otherwise the Percent command won’t work until the roller shutter is fully rolled up | R/W | + ## Full Example @@ -187,22 +190,21 @@ Rollershutter BUS_Shutter { channel="openwebnet:bus_automation:mybridge1:myshut ## Changelog -**v2.4.0-b6** *NOT YET RELEASED* +**v2.4.0-b6** - 02/07/2018 -- **[NEW]** Initial support for `WHO=4` Thermoregulation on BUS. In this version only Temperature sensors are supported +- updated to openHAB 2.4.0 dev branch. The bundle should work with both 2.2 and 2.3 versions of openHAB. - **[FIX #7]** added support for inverted UP/DOWN automation commands for older USB ZigBee dongles - **[BUG]** some switches were wrongly discovered as dimmers (now use only commands for device discovery) - **[FIX]** added support for SCS/ZIGBEE_SHUTTER_SWITCH (515/513) device types -- **[FIX]** added support for F455 gateway using `*99*0##` command session -- updated to openHAB 2.4.0 dev branch +- **[FIX]** added support for F455 gateways using `*99*0##` command session -**v2.3.0-b5** +**v2.3.0-b5** - 26/05/2018 -- **[BUG #1]** state monitoring from BUS (feedback) is no longer stopped if unsupported messages are received from BUS -- **[FIX]** automatic reconnect to BUS when connection is lost -- **[NEW]** support for Gateways with string passwords (HMAC authentication), like MyHOMEServer1 -- **[NEW]** support for `WHO=2` Automation (shutters), both on BUS and ZigBee, with position feedback and goto Percent. It requires setting the shutter run-time in the thing configuration. Experimental auto-calibration of the run-time is also supported! +- [BUG #1] state monitoring from BUS (feedback) is no longer stopped if unsupported messages are received from BUS +- [FIX] automatic reconnect to BUS when connection is lost +- [NEW] support for Gateways with string passwords (HMAC authentication), like MyHOMEServer1 +- [NEW] support for `WHO=2` Automation (shutters), both on BUS and ZigBee, with position feedback and goto Percent. It requires setting the shutter run-time in the thing configuration. Experimental auto-calibration of the run-time is also supported! -**v2.3.0-b4** +**v2.3.0-b4** - 09/04/2018 - first public release diff --git a/build.properties b/build.properties index 7cd564b..d67b4e9 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ -source..=src/main/java/ +source..=src/main/java/, src/test/java output..=target/classes bin.includes = META-INF/,\ .,\ diff --git a/lib/openwebnet-lib-0.9.4.jar b/lib/openwebnet-lib-0.9.4.jar deleted file mode 100644 index 761d4d7..0000000 Binary files a/lib/openwebnet-lib-0.9.4.jar and /dev/null differ diff --git a/lib/openwebnet-lib-0.9.7.jar b/lib/openwebnet-lib-0.9.7.jar new file mode 100644 index 0000000..0ed3f95 Binary files /dev/null and b/lib/openwebnet-lib-0.9.7.jar differ diff --git a/pom.xml b/pom.xml index 69f39b8..7cfc1de 100644 --- a/pom.xml +++ b/pom.xml @@ -4,13 +4,13 @@ org.openhab.binding pom - 2.3.0-SNAPSHOT + 2.4.0-SNAPSHOT ../../git/openhab2-addons/addons/binding org.openhab.binding org.openhab.binding.openwebnet - 2.3.0-SNAPSHOT + 2.4.0-SNAPSHOT OpenWebNet (BTicino/Legrand) Binding eclipse-plugin diff --git a/src/main/java/org/openhab/binding/openwebnet/OpenWebNetBindingConstants.java b/src/main/java/org/openhab/binding/openwebnet/OpenWebNetBindingConstants.java index d9ffd9c..6551eea 100644 --- a/src/main/java/org/openhab/binding/openwebnet/OpenWebNetBindingConstants.java +++ b/src/main/java/org/openhab/binding/openwebnet/OpenWebNetBindingConstants.java @@ -44,6 +44,10 @@ public class OpenWebNetBindingConstants { public static final String THING_LABEL_BUS_DIMMER = "BUS Dimmer"; public static final ThingTypeUID THING_TYPE_BUS_AUTOMATION = new ThingTypeUID(BINDING_ID, "bus_automation"); public static final String THING_LABEL_BUS_AUTOMATION = "BUS Automation"; + public static final ThingTypeUID THING_TYPE_BUS_TEMP_SENSOR = new ThingTypeUID(BINDING_ID, "bus_temp_sensor"); + public static final String THING_LABEL_BUS_TEMP_SENSOR = "BUS Temperature Sensor"; + public static final ThingTypeUID THING_TYPE_BUS_THERMOSTAT = new ThingTypeUID(BINDING_ID, "bus_thermostat"); + public static final String THING_LABEL_BUS_THERMOSTAT = "BUS Thermostat"; // ZIGBEE public static final ThingTypeUID THING_TYPE_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "on_off_switch"); public static final String THING_LABEL_ON_OFF_SWITCH = "ZigBee Switch"; @@ -53,6 +57,10 @@ public class OpenWebNetBindingConstants { public static final String THING_LABEL_DIMMER = "ZigBee Dimmer"; public static final ThingTypeUID THING_TYPE_AUTOMATION = new ThingTypeUID(BINDING_ID, "automation"); public static final String THING_LABEL_AUTOMATION = "ZigBee Automation"; + // public static final ThingTypeUID THING_TYPE_TEMP_SENSOR = new ThingTypeUID(BINDING_ID, "tempsensor"); + // public static final String THING_LABEL_TEMP_SENSOR = "Temperature Sensor"; + // public static final ThingTypeUID THING_TYPE_THERMOSTAT = new ThingTypeUID(BINDING_ID, "thermostat"); + // public static final String THING_LABEL_THERMOSTAT = "Thermostat"; // TODO transform these constants in enum+hashmaps // #SUPPORTED THINGS SETS @@ -64,9 +72,14 @@ public class OpenWebNetBindingConstants { public static final Set AUTOMATION_SUPPORTED_THING_TYPES = Sets.newHashSet(THING_TYPE_AUTOMATION, THING_TYPE_BUS_AUTOMATION); + // ## Thermoregulation + public static final Set THERMOREGULATION_SUPPORTED_THING_TYPES = Sets + .newHashSet(THING_TYPE_BUS_TEMP_SENSOR, THING_TYPE_BUS_THERMOSTAT); + // ## Groups public static final Set DEVICE_SUPPORTED_THING_TYPES = Sets.union( - Sets.union(LIGHTING_SUPPORTED_THING_TYPES, AUTOMATION_SUPPORTED_THING_TYPES), + Sets.union(LIGHTING_SUPPORTED_THING_TYPES, + Sets.union(AUTOMATION_SUPPORTED_THING_TYPES, THERMOREGULATION_SUPPORTED_THING_TYPES)), Sets.newHashSet(THING_TYPE_DEVICE)); public static final Set BRIDGE_SUPPORTED_THING_TYPES = Sets.newHashSet(THING_TYPE_DONGLE, @@ -81,6 +94,9 @@ public class OpenWebNetBindingConstants { public static final String CHANNEL_SWITCH_02 = "switch_02"; public static final String CHANNEL_BRIGHTNESS = "brightness"; public static final String CHANNEL_SHUTTER = "shutter"; + public static final String CHANNEL_TEMPERATURE = "temperature"; + public static final String CHANNEL_TEMP_SETPOINT = "setPoint"; + public static final String CHANNEL_ZONE_OP_MODE = "operationMode"; // config properties public static final String CONFIG_PROPERTY_SHUTTER_RUN = "shutterRun"; diff --git a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetAutomationHandler.java b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetAutomationHandler.java index 00d4985..5803058 100644 --- a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetAutomationHandler.java +++ b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetAutomationHandler.java @@ -231,7 +231,7 @@ private void handleShutterCommand(ChannelUID channel, Command command) { percent); } } else { - logger.warn("==OWN:AutomationHandler== Command {} is not supported for thing {}", command, thing.getUID()); + logger.debug("==OWN:AutomationHandler== Command {} is not supported for thing {}", command, thing.getUID()); } } @@ -289,13 +289,13 @@ private void updateStateInt(int newState) { if (internalState == STATE_STOPPED) { if (newState != STATE_STOPPED) { // move after stop startedMovingAt = System.currentTimeMillis(); - logger.debug("==OWN:AutomationHandler== startedMovingAt={}", startedMovingAt); + logger.debug("==OWN:AutomationHandler== MOVING {} - startedMovingAt={}", newState, startedMovingAt); } } else { // we were moving updatePosition(); if (newState != STATE_STOPPED) { // move after move, take new timestamp startedMovingAt = System.currentTimeMillis(); - logger.debug("==OWN:AutomationHandler== startedMovingAt={}", startedMovingAt); + logger.debug("==OWN:AutomationHandler== MOVING {} - startedMovingAt={}", newState, startedMovingAt); } // cancel the schedule if (moveSchedule != null && !moveSchedule.isDone()) { diff --git a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetBridgeHandler.java b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetBridgeHandler.java index 50b716f..6afd022 100644 --- a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetBridgeHandler.java +++ b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetBridgeHandler.java @@ -43,6 +43,7 @@ import org.openwebnet.message.Lighting; import org.openwebnet.message.OpenMessage; import org.openwebnet.message.OpenMessageFactory; +import org.openwebnet.message.Thermoregulation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -154,8 +155,14 @@ private void initBusGateway() { if (passwd == null) { passwd = CONFIG_GATEWAY_DEFAULT_PASSWD; } - logger.debug("==OWN== BridgeHandler creating new gatewayBus with config properties: {}:{}, {}", host, port, - passwd); + String passwdMasked; + if (passwd.length() >= 4) { + passwdMasked = "******" + passwd.substring(passwd.length() - 3, passwd.length() - 1); + } else { + passwdMasked = "******"; + } + logger.debug("==OWN== Creating new BUS gateway with config properties: {}:{}, pwd={}", host, port, + passwdMasked); gateway = OpenWebNet.gatewayBus(host, port, passwd); } else { logger.warn( @@ -270,6 +277,7 @@ protected void unregisterDevice(String ownId) { @Override public void onMessage(OpenMessage msg) { logger.trace("==OWN== RECEIVED <<<<< {}", msg); + // TODO provide direct methods msg.isACK() and msg.isNACK() if (OpenMessage.ACK.equals(msg.getValue()) || OpenMessage.NACK.equals(msg.getValue())) { return;// ignore } @@ -279,9 +287,9 @@ public void onMessage(OpenMessage msg) { logger.debug("==OWN== GatewayManagement WHAT = {}", gwMgmtMsg.getWhat()); return; } + BaseOpenMessage baseMsg = (BaseOpenMessage) msg; // let's try to get the thing associated with this message... - else if (msg instanceof Lighting || msg instanceof Automation) { - BaseOpenMessage baseMsg = (BaseOpenMessage) msg; + if (baseMsg instanceof Lighting || baseMsg instanceof Automation || baseMsg instanceof Thermoregulation) { String ownId = ownIdFromWhere(baseMsg.getWhere()); logger.trace("==OWN== ownId = {}", ownId); ThingUID thingUID = registeredDevices.get(ownId); @@ -298,7 +306,8 @@ else if (msg instanceof Lighting || msg instanceof Automation) { } } else { // WHO not supported by the binding logger.debug( - "==OWN== BridgeHandler ignoring frame {} (this message type is not supported by the binding)"); + "==OWN== BridgeHandler ignoring frame {}. This message type (WHO={}) is not supported by the binding", + baseMsg, baseMsg.getWho()); } } diff --git a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetLightingHandler.java b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetLightingHandler.java index fe7fc24..fbae713 100644 --- a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetLightingHandler.java +++ b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetLightingHandler.java @@ -206,8 +206,7 @@ private void dimLightTo(int whatInt, Command command) { @Override protected void handleMessage(BaseOpenMessage msg) { super.handleMessage(msg); - Lighting lightingMsg = (Lighting) msg; - updateLightState(lightingMsg); + updateLightState((Lighting) msg); } /** diff --git a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThingHandler.java b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThingHandler.java index 59b8d94..0db3cfd 100644 --- a/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThingHandler.java +++ b/src/main/java/org/openhab/binding/openwebnet/handler/OpenWebNetThingHandler.java @@ -10,8 +10,13 @@ import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.*; +import java.math.BigDecimal; import java.util.concurrent.TimeUnit; +import javax.measure.Quantity; +import javax.measure.Unit; + +import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.thing.Bridge; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; @@ -123,7 +128,7 @@ public void handleCommand(ChannelUID channel, Command command) { * @param msg BaseOpenMessage to handle */ protected void handleMessage(BaseOpenMessage msg) { - logger.debug("==OWN:ThingHandler== handleMessage() for thing: {}", getThing().getUID()); + // logger.debug("==OWN:ThingHandler== handleMessage() for thing: {}", getThing().getUID()); // update status to ONLINE if not already online if (ThingStatus.ONLINE != getThing().getStatus()) { updateStatus(ThingStatus.ONLINE); @@ -181,4 +186,10 @@ protected String toWhere(ChannelUID channel) { } } + protected > QuantityType commandToQuantityType(Command command, Unit defaultUnit) { + if (command instanceof QuantityType) { + return (QuantityType) command; + } + return new QuantityType(new BigDecimal(command.toString()), defaultUnit); + } } \ No newline at end of file diff --git a/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java b/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java index be96493..3282360 100644 --- a/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java +++ b/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetHandlerFactory.java @@ -50,7 +50,7 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { protected ThingHandler createHandler(Thing thing) { logger.debug("==OWN:HandlerFactory== createHandler()"); if (OpenWebNetBridgeHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { - logger.debug("==OWN:HandlerFactory== creating NEW Bridge Handler"); + logger.debug("==OWN:HandlerFactory== creating NEW BRIDGE Handler"); OpenWebNetBridgeHandler handler = new OpenWebNetBridgeHandler((Bridge) thing); registerDiscoveryService(handler); return handler; @@ -61,6 +61,10 @@ protected ThingHandler createHandler(Thing thing) { logger.debug("==OWN:HandlerFactory== creating NEW AUTOMATION Handler"); return new OpenWebNetAutomationHandler(thing); } + // else if (OpenWebNetThermoregulationHandler.SUPPORTED_THING_TYPES.contains(thing.getThingTypeUID())) { + // logger.debug("==OWN:HandlerFactory== creating NEW THERMO Handler"); + // return new OpenWebNetThermoregulationHandler(thing); + // } return null; } diff --git a/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetBridgeDiscoveryService.java b/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetBridgeDiscoveryService.java index 6bf51d5..2bffba9 100644 --- a/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetBridgeDiscoveryService.java +++ b/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetBridgeDiscoveryService.java @@ -155,7 +155,11 @@ public void onConnected() { @Override public void onConnectionError(OpenError error) { - logger.warn("==OWN:BridgeDiscovery== onConnectionError() - CONNECTION ERROR: errorCode = {}", error); + if (error == OpenError.NO_SERIAL_PORTS_ERROR) { + logger.info("==OWN:BridgeDiscovery== no serial ports found"); + } else { + logger.warn("==OWN:BridgeDiscovery== onConnectionError() - CONNECTION ERROR: errorCode = {}", error); + } stopScan(); // TODO handle other dongle connection problems } diff --git a/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java b/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java index 6641082..1ce4582 100644 --- a/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java +++ b/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java @@ -104,16 +104,28 @@ public void onNewDevice(String where, OpenDeviceType deviceType) { thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_DIMMER; break; } + case SCS_SHUTTER_SWITCH: case SCS_SHUTTER_CONTROL: { thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_AUTOMATION; thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_AUTOMATION; break; } + case ZIGBEE_SHUTTER_SWITCH: case ZIGBEE_SHUTTER_CONTROL: { thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_AUTOMATION; thingLabel = OpenWebNetBindingConstants.THING_LABEL_AUTOMATION; break; } + // case SCS_TEMP_SENSOR: { + // thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_TEMP_SENSOR; + // thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_TEMP_SENSOR; + // break; + // } + // case SCS_THERMOSTAT: { + // thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_THERMOSTAT; + // thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_THERMOSTAT; + // break; + // } default: logger.warn( "==OWN:DeviceDiscovery== ***** device type {} is not supported, default to generic device (WHERE={})",