added migrated 2.x add-ons
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
32
bundles/org.openhab.binding.somfytahoma/.classpath
Normal file
32
bundles/org.openhab.binding.somfytahoma/.classpath
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
bundles/org.openhab.binding.somfytahoma/.project
Normal file
23
bundles/org.openhab.binding.somfytahoma/.project
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.openhab.binding.somfytahoma</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
13
bundles/org.openhab.binding.somfytahoma/NOTICE
Normal file
13
bundles/org.openhab.binding.somfytahoma/NOTICE
Normal file
@@ -0,0 +1,13 @@
|
||||
This content is produced and maintained by the openHAB project.
|
||||
|
||||
* Project home: https://www.openhab.org
|
||||
|
||||
== Declared Project Licenses
|
||||
|
||||
This program and the accompanying materials are made available under the terms
|
||||
of the Eclipse Public License 2.0 which is available at
|
||||
https://www.eclipse.org/legal/epl-2.0/.
|
||||
|
||||
== Source Code
|
||||
|
||||
https://github.com/openhab/openhab-addons
|
||||
271
bundles/org.openhab.binding.somfytahoma/README.md
Normal file
271
bundles/org.openhab.binding.somfytahoma/README.md
Normal file
@@ -0,0 +1,271 @@
|
||||
# Somfy Tahoma Binding
|
||||
|
||||
This binding integrates the
|
||||
[Somfy Tahoma](https://www.somfy.fr/produits/1811478/)
|
||||
and
|
||||
[Somfy Connexoon](https://www.somfy.fr/produits/1811429/)
|
||||
home automation systems.
|
||||
|
||||
## Supported Things
|
||||
|
||||
Currently these things are supported:
|
||||
|
||||
- bridge (Somfy Tahoma bridge, which can discover gateways, roller shutters, awnings, switches and action groups)
|
||||
- gateways (Somfy Tahoma gateway - gateway status)
|
||||
- gates (control gate, get state)
|
||||
- roller shutters (UP, DOWN, STOP control of a roller shutter). IO Homecontrol devices are allowed to set exact position of a shutter (0-100%)
|
||||
- blinds (UP, DOWN, STOP control of a blind). IO Homecontrol devices are allowed to set exact position of a blinds (0-100%) as well as orientation of slats (0-100%)
|
||||
- screens (UP, DOWN, STOP control of a screen). IO Homecontrol devices are allowed to set exact position of a screen (0-100%)
|
||||
- garage doors (UP, DOWN, STOP control of a garage door). IO Homecontrol devices are allowed to set exact position of a garage door (0-100%)
|
||||
- awnings (UP, DOWN, STOP control of an awning). IO Homecontrol devices are allowed to set exact position of an awning (0-100%)
|
||||
- windows (UP, DOWN, STOP control of a window). IO Homecontrol devices are allowed to set exact position of a window (0-100%)
|
||||
- pergolas (UP, DOWN, STOP control of a pergola). IO Homecontrol devices are allowed to set exact position of a pergola (0-100%)
|
||||
- on/off switches (connected by RTS, IO protocol or supported by USB stick - z-wave, enocean, ..)
|
||||
- light switches (similar to on/off)
|
||||
- dimmer lights (light switches with intensity setting)
|
||||
- light sensors (luminance value)
|
||||
- occupancy sensors (OPEN/CLOSE contact)
|
||||
- smoke sensors (OPEN/CLOSE contact, alarm check)
|
||||
- contact sensors (OPEN/CLOSE contact)
|
||||
- temperature sensors (get temperature)
|
||||
- electricity sensors (get energy consumption)
|
||||
- door locks (LOCK/UNLOCK, OPEN/CLOSE commands)
|
||||
- heating systems (control temperature, set heating level)
|
||||
- exterior heating systems (set heating level)
|
||||
- alarms (both interior/external)
|
||||
- pods
|
||||
- docks (battery info, siren control)
|
||||
- sirens (battery status full/low/normal/verylow, siren control ON/OFF, setting memorized volume)
|
||||
- action groups (scenarios which can execute predefined Tahoma group of steps, e.g. send to all roller shutters DOWN command, one by one)
|
||||
- thermostats (read status and battery level)
|
||||
|
||||
Both Somfy Tahoma and Somfy Connexoon gateways have been confirmed working.
|
||||
|
||||
## Discovery
|
||||
|
||||
To start a discovery, just
|
||||
|
||||
- install this binding
|
||||
- open Paper UI
|
||||
- add a new thing in menu Configuration/Things
|
||||
- choose SomfyTahoma Binding and select Somfy Tahoma Bridge
|
||||
- enter your email (login) and password to the TahomaLink cloud portal
|
||||
|
||||
If the supplied TahomaLink credentials are correct, the automatic discovery starts immediately and detected roller shutters, awnings, switches and action groups appear in Paper UI inbox.
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
To manually configure the thing you have to specify bridge and things in *.things file in conf/addons directory of your openHAB 2.x installation.
|
||||
To manually link the thing channels to items just use the *.items file in conf/items directory of your openHAB 2.x installation.
|
||||
To retrieve thing configuration and url parameter, just add the automatically discovered device from your inbox and copy its values from thing edit page. (the url parameter is visible on edit page only)
|
||||
Please see the example below.
|
||||
|
||||
## Channels
|
||||
|
||||
| Thing | Channel | Note |
|
||||
|-------------------------------------------------------------------------------|:---------------------:|-------------------------------------------------------------------------------------------------------------------------------|
|
||||
| bridge | N.A | bridge does not expose any channel |
|
||||
| gateway | status | status of your Tahoma gateway |
|
||||
| gate | gate_command | used for controlling your gate (open, close, stop, pedestrian) |
|
||||
| gate | gate_state | get state of your gate |
|
||||
| roller shutter, screen, venetian blind, garage door, awning, pergola, curtain | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/MY/STOP + closure 0-100 |
|
||||
| window | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/STOP + closure 0-100 |
|
||||
| silent roller shutter | silent_control | similar to control channel but in silent mode |
|
||||
| venetian blind, adjustable slats roller shutter | orientation | percentual orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) |
|
||||
| venetian blind, adjustable slats roller shutter | closure_orientation | percentual closure and orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) |
|
||||
| adjustable slats roller shutter | rocker | used for setting the rocker position of the roller shutter, the only position allowing the slats control |
|
||||
| action group | execute_action | switch which reacts to ON command and triggers the predefined Tahoma action |
|
||||
| onoff, light | switch | reacts to standard ON/OFF commands |
|
||||
| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF |
|
||||
| smoke sensor, occupancy sensor, contact sensor & water sensor | contact | normal value is CLOSE, changes to OPEN when detection triggered |
|
||||
| smoke sensor, occupancy sensor, contact sensor & water sensor | sensor_defect | indicates the health of the sensor (dead, lowBatter, maintenanceRequired, noDefect) |
|
||||
| smoke sensor | radio_battery | maintenance radio part battery state (low, normal) |
|
||||
| smoke sensor | sensor_battery | maintenance sensor part battery state (absence, low, normal) |
|
||||
| smoke sensor | short_check | triggering the smoke sensor's short check |
|
||||
| smoke sensor | long_check | triggering the smoke sensor's long check |
|
||||
| light sensor | luminance | light luminance value in luxes |
|
||||
| electricity sensor | energy_consumption | energy consumption value in watts |
|
||||
| humidity sensor | humidity | current relative humidity |
|
||||
| dock | battery_status | indicates running on battery (yes/no) |
|
||||
| dock | battery_level | remaining battery percentage |
|
||||
| dock | siren_status | used for controlling and getting siren state (on, off, cyclic) |
|
||||
| dock | short_beep | testing of dock's siren - short beep |
|
||||
| dock | long_beep | testing of dock's siren - long beep |
|
||||
| siren | battery | battery level full/low/normal/verylow |
|
||||
| siren | onoff | controlling siren status ON/OFF |
|
||||
| siren | memorized_volume | setting memorized volume (normal/highest) |
|
||||
| pod | cyclic_button | pod cyclic button state |
|
||||
| pod | battery_status | pod battery status state |
|
||||
| pod | lighting_led_pod_mode | lighting LED pod mod state |
|
||||
| interior alarm | alarm_command | used for sending commands to Somfy alarm device |
|
||||
| interior alarm | intrusion_control | used for alarm external intrusion controlling |
|
||||
| interior alarm, myfox alarm | alarm_state | state of the Somfy alarm |
|
||||
| interior alarm | target_alarm_state | target state of the Somfy alarm |
|
||||
| interior alarm, myfox alarm | intrusion_state | intrusion state of the Somfy alarm |
|
||||
| external alarm | active_zones_state | state of external alarm active zones |
|
||||
| door lock | lock | switch representing unlocked/locked state |
|
||||
| door lock | open | switch representing open/close state |
|
||||
| on/off heating system | target_heating_level | target heating level (off, eco, comfort, frostprotection) |
|
||||
| heating system | current_temperature | current temperature of the heating system |
|
||||
| heating system | current_state | current state of the heating system |
|
||||
| heating system, thermostat | target_temperature | target temperature of the heating system |
|
||||
| heating system, thermostat | battery_level | battery level of the heating system |
|
||||
| exterior heating system | heating_level | heating level of the exterior heating system or ON/OFF |
|
||||
| thermostat | heating_mode | standard heating mode of the thermostat (away, freeze, manual, ...) |
|
||||
| thermostat | derogation_heating_mode | derogation heating mode of the thermostat (away, freeze, manual, ...) |
|
||||
| thermostat | derogation_activation | derogation activation state (inactive, active) |
|
||||
| temperature sensor | temperature | temperature reported by the sensor |
|
||||
| myfox camera, myfox alarm | cloud_status | cloud connection status |
|
||||
| myfox camera | shutter | controlling of the camera shutter |
|
||||
| myfox alarm | myfox_alarm_command | used for sending commands to Somfy Myfox alarm device |
|
||||
|
||||
|
||||
### Remarks
|
||||
|
||||
All things which have a RSSI (relative received signal) state, expose a channel "rssi".
|
||||
|
||||
When a roller shutter-like thing receives STOP command, there are two possible behaviours
|
||||
|
||||
- when the roller shutter is idle then MY command is interpreted (the roller shutter/exterior screen/awning goes to your favourite position)
|
||||
- when the roller shutter is moving then STOP command is interpreted (the roller shutter/exterior screen/awning stops)
|
||||
|
||||
If you want to set the MY position of a roller shutter and you don't care the possible movement, try sending the MOVE command (OH2 does not know MY, so it stands for "move to MY position")
|
||||
|
||||
```
|
||||
CONTROL_CHANNEL.sendCommand(MOVE)
|
||||
```
|
||||
|
||||
Blinds and adjustable slats roller shutters can control their closure and orientation by sending a comma separated string consisting of closure (0-100) and orientation (0-100) to the "closure_orientaion" channel.
|
||||
|
||||
```
|
||||
CLOSURE_ORIENTATION_CHANNEL.sendCommand("50,50")
|
||||
```
|
||||
|
||||
## Full Example
|
||||
|
||||
.things file
|
||||
|
||||
```
|
||||
Bridge somfytahoma:bridge:237dbae7 "Somfy Tahoma Bridge" [ email="my@email.com", password="MyPassword", refresh=10 , statusTimeout=30] {
|
||||
Thing gateway 1214-4519-8041 "Tahoma gateway" [ id="1214-4519-8041" ]
|
||||
Thing rollershutter 31da8dac-8e09-455a-bc7a-6ed70f740001 "Bedroom" [ url="io://0204-1234-8041/6825356" ]
|
||||
Thing rollershutter 87bf0403-a45d-4037-b874-28f4ece30004 "Living room" [ url="io://0204-1234-8041/3832644" ]
|
||||
Thing rollershutter 68bee082-63ab-421d-9830-3ea561601234 "Hall" [ url="io://0204-1234-8041/4873641" ]
|
||||
Thing actiongroup 2104c46f-478d-6543-956a-10bd93b5dc54 "1st floor up" [ url="2104c46f-478d-6543-956a-10bd93b5dc54" ]
|
||||
Thing actiongroup 0b5f195a-5223-5432-b1af-f5fa1d59074f "1st floor down" [ url="0b5f195a-5223-5432-b1af-f5fa1d59074f" ]
|
||||
Thing actiongroup 712c0019-b422-1234-b4da-208e249c571b "2nd floor up" [ url="712c0019-b422-1234-b4da-208e249c571b" ]
|
||||
Thing actiongroup e201637b-de3b-1234-b7af-5693811a953b "2nd floor down" [ url="e201637b-de3b-1234-b7af-5693811a953b" ]
|
||||
Thing onoff 095d6c49-9712-4220-a4c3-d3bb7a6cc5f0 "Zwave switch" [ url="zwave://0204-4519-8041/5" ]
|
||||
Thing light 1b8e7d29-bf1e-4ae1-9432-3dfef52ef14d "Light switch" [ url="enocean://0204-4519-8041/4294453515/2" ]
|
||||
Thing lightsensor 2c90808c3a0c193f013a743f2f660f12 "Light sensor" [ url="io://0204-4519-8041/13527450" ]
|
||||
Thing occupancysensor 995e16ca-07c4-4111-9cda-504cb5120f82 "Occupancy sensor" [ url="io://0204-4519-8041/4855758" ]
|
||||
Thing smokesensor 9438e6ff-c17e-40d7-a4b4-3e797eca5bf7 "Smoke sensor" [ url="io://0204-4510-8041/13402124" ]
|
||||
Thing electricitysensor 9998e6ff-c17e-40d7-a4b4-3e797eca5bf7 "Electricity sensor" [ url="io://0204-4510-8041/288702124" ]
|
||||
Thing dock 1212f2e3-bcde-21dd-b3a6-13ef7abcd134 "Dock" [ url="io://0204-4510-8041/244402124" ]
|
||||
Thing siren 1212f2e3-aeae-21dd-b3a6-13ef7abcd134 "Siren" [ url="io://0204-4510-8041/244405678" ]
|
||||
Thing extheatingsystem 1212f2e3-aeae-21dd-b3a6-13ef7abcd155 "Ext heating system" [ url="io://0204-4510-8041/144405678" ]
|
||||
}
|
||||
```
|
||||
|
||||
Awnings, garage doors, screens, blinds, and windows things have the same notation as roller shutters. Just use "awning", "garagedoor", "screen", "blind" or "window" instead of "rolleshutter" in thing definition.
|
||||
|
||||
.items file
|
||||
|
||||
```
|
||||
String TahomaVersion "Tahoma version [%s]" { channel="somfytahoma:gateway:237dbae7:1214-4519-8041:version" }
|
||||
Rollershutter RollerShutterBedroom "Roller shutter [%d %%]" {channel="somfytahoma:rollershutter:237dbae7:31da8dac-8e09-455a-bc7a-6ed70f740001:control"}
|
||||
Dimmer RollerShutterBedroomD "Roller shutter dimmer [%.1f]" {channel="somfytahoma:rollershutter:237dbae7:31da8dac-8e09-455a-bc7a-6ed70f740001:control"}
|
||||
Rollershutter RollerShutterLiving "Roller shutter [%d %%]" {channel="somfytahoma:rollershutter:237dbae7:87bf0403-a45d-4037-b874-28f4ece30004:control" }
|
||||
Dimmer RollerShutterLivingD "Roller shutter dimmer [%.1f]" {channel="somfytahoma:rollershutter:237dbae7:87bf0403-a45d-4037-b874-28f4ece30004:control"}
|
||||
Rollershutter RollerShutterHall "Roller shutter [%d %%]" {channel="somfytahoma:rollershutter:237dbae7:68bee082-63ab-421d-9830-3ea561601234:control"}
|
||||
Dimmer RollerShutterHallD "Roller shutter dimmer [%.1f]" {channel="somfytahoma:rollershutter:237dbae7:68bee082-63ab-421d-9830-3ea561601234:control"}
|
||||
|
||||
Rollershutter AwningTerrace "Terrace awning [%d %%]" {channel="somfytahoma:awning:237dbae7:24cee082-63ab-421d-9830-3ea561601234:control"}
|
||||
Dimmer AwningTerraceD "Terrace awning dimmer [%.1f]" {channel="somfytahoma:awning:237dbae7:24cee082-63ab-421d-9830-3ea561601234:control"}
|
||||
|
||||
Switch Rollers1UP "Rollers 1st floor UP" {channel="somfytahoma:actiongroup:237dbae7:2104c46f-478d-6543-956a-10bd93b5dc54:execute_action", autoupdate="false"}
|
||||
Switch Rollers1DOWN "Rollers 1st floor DOWN" {channel="somfytahoma:actiongroup:237dbae7:0b5f195a-5223-5432-b1af-f5fa1d59074f:execute_action", autoupdate="false"}
|
||||
Switch Rollers2UP "Rollers 2nd floor UP" {channel="somfytahoma:actiongroup:237dbae7:712c0019-b422-1234-b4da-208e249c571b:execute_action", autoupdate="false"}
|
||||
Switch Rollers2DOWN "Rollers 2nd floor DOWN" {channel="somfytahoma:actiongroup:237dbae7:e201637b-de3b-1234-b7af-5693811a953b:execute_action", autoupdate="false"}
|
||||
|
||||
Switch TahomaZwaveSwitch "Switch" { channel="somfytahoma:onoff:237dbae7:095d6c49-9712-4220-a4c3-d3bb7a6cc5f0:switch" }
|
||||
Switch TahomaLightSwitch "Light Switch" { channel="somfytahoma:light:237dbae7:1b8e7d29-bf1e-4ae1-9432-3dfef52ef14d:switch" }
|
||||
|
||||
Switch DimmerLightSwitch "Dimmer Light Switch" { channel="somfytahoma:dimmerlight:237dbae7:1b8e7d29-bf1e-4ae1-9432-3dfef52ef14e:light_intensity" }
|
||||
Dimmer DimmerLightIntensity "Dimmer Light intensity [%.1f]" {channel="somfytahoma:dimmerlight:237dbae7:1b8e7d29-bf1e-4ae1-9432-3dfef52ef14e:light_intensity"}
|
||||
|
||||
Number LightSensor "Light Sensor [%.1f lux]" { channel="somfytahoma:lightsensor:237dbae7:2c90808c3a0c193f013a743f2f660f12:luminance" }
|
||||
Number:Energy EnergyConsumptionSensor "Energy Consumption [%.1f W]" { channel="somfytahoma:electricitysensor:237dbae7:9998e6ff-c17e-40d7-a4b4-3e797eca5bf7:energy_consumption" }
|
||||
|
||||
Contact OccupancySensor "Occupancy Sensor is [%s]" { channel="somfytahoma:occupancysensor:237dbae7:995e16ca-07c4-4111-9cda-504cb5120f82:contact" }
|
||||
Contact SmokeSensor "Smoke Sensor is [%s]" { channel="somfytahoma:smokesensor:237dbae7:9438e6ff-c17e-40d7-a4b4-3e797eca5bf7:contact" }
|
||||
Contact ContactSensor "Contact Sensor is [%s]" { channel="somfytahoma:contactsensor:237dbae7:6612f2e3-d23d-21dd-b3a6-13ef7abcd134:contact" }
|
||||
|
||||
Number TemperatureSensor "Temperature is [%2.1f °C]" { channel="somfytahoma:temperaturesensor:237dbae7:6612f2e3-d23d-21dd-b4a7-13ef7abcd134:temperature" }
|
||||
String HeatingSystemLevel "Heating level [%s]" { channel="somfytahoma:onoffheatingsystem:237dbae7:6612f2e3-abcd-21dd-b3a6-13ef7abcd134:target_heating_level"}
|
||||
|
||||
Switch DoorLock "Lock" { channel="somfytahoma:doorlock:237dbae7:6612f2e3-bcde-21dd-b3a6-13ef7abcd134:lock" }
|
||||
Switch DoorLockOpenClose "Open/Close" { channel="somfytahoma:doorlock:237dbae7:6612f2e3-bcde-21dd-b3a6-13ef7abcd134:open" }
|
||||
|
||||
String DockBatteryStatus "Dock battery status [%s]" { channel="somfytahoma:dock:237dbae7:1212f2e3-bcde-21dd-b3a6-13ef7abcd134:battery_status" }
|
||||
String DockBatteryLevel "Dock battery level [%s]" { channel="somfytahoma:dock:237dbae7:1212f2e3-bcde-21dd-b3a6-13ef7abcd134:battery_level" }
|
||||
String DockSiren "Dock siren [%s]" { channel="somfytahoma:dock:237dbae7:1212f2e3-bcde-21dd-b3a6-13ef7abcd134:siren" }
|
||||
Switch DockShortBeep "Dock short beep" { channel="somfytahoma:dock:237dbae7:1212f2e3-bcde-21dd-b3a6-13ef7abcd134:short_beep" }
|
||||
Switch DockLongBeep "Dock long beep" { channel="somfytahoma:dock:237dbae7:1212f2e3-bcde-21dd-b3a6-13ef7abcd134:long_beep" }
|
||||
|
||||
String SirenBattery "Siren battery [%s]" { channel="somfytahoma:siren:237dbae7:1212f2e3-aeae-21dd-b3a6-13ef7abcd134:battery" }
|
||||
Switch SirenSwitch "Siren switch" { channel="somfytahoma:siren:237dbae7:1212f2e3-aeae-21dd-b3a6-13ef7abcd134:onoff" }
|
||||
String SirenVolume "Siren volume [%s]" { channel="somfytahoma:siren:237dbae7:1212f2e3-aeae-21dd-b3a6-13ef7abcd134:memorized_volume" }
|
||||
|
||||
Dimmer HeatingLevel "Ext heating level [%.1f]" { channel="somfytahoma:exteriorheatingsystem:237dbae7:1212f2e3-aeae-21dd-b3a6-13ef7abcd155:heating_level" }
|
||||
Switch HeatingSwitch "Ext heating switch" { channel="somfytahoma:exteriorheatingsystem:237dbae7:1212f2e3-aeae-21dd-b3a6-13ef7abcd155:heating_level" }
|
||||
```
|
||||
|
||||
.sitemap file
|
||||
|
||||
```
|
||||
Text item=TahomaVersion
|
||||
Switch item=Rollers1UP label="Roller shutters 1st floor" mappings=[ON="UP"]
|
||||
Switch item=Rollers1DOWN label="Roller shutters 1st floor" mappings=[ON="DOWN"]
|
||||
Switch item=Rollers2UP label="Roller shutters 2nd floor" mappings=[ON="UP"]
|
||||
Switch item=Rollers2DOWN label="Roller shutters 2nd floor" mappings=[ON="DOWN"]
|
||||
Switch item=RollerShutterBedroom
|
||||
Slider item=RollerShutterBedroomD
|
||||
Switch item=RollerShutterLiving
|
||||
Slider item=RollerShutterLivingD
|
||||
Switch item=TahomaZwaveSwitch
|
||||
Switch item=TahomaLightSwitch
|
||||
Switch item=DimmerLightSwitch
|
||||
Slider item=DimmerLightIntensity
|
||||
Text item=LightSensor
|
||||
Text item=OccupancySensor
|
||||
Text item=SmokeSensor
|
||||
Text item=ContactSensor
|
||||
Text item=TemperatureSensor
|
||||
Text item=ElectricitySensor
|
||||
Switch item=HeatingSystemOnOff
|
||||
Selection item=HeatingSystemLevel mappings=["frostprotection"="FROST PROTECTION", "comfort"="COMFORT", "eco"="ECO", "off"="OFF"]
|
||||
Switch item=DoorLock
|
||||
Switch item=DoorLockOpenClose
|
||||
Text item=DockBatteryStatus
|
||||
Text item=DockBatteryLevel
|
||||
Selection item=DockSiren mappings=["off"="OFF", "on"="ON", "cyclic"="CYCLIC"]
|
||||
Switch item=DockShortBeep
|
||||
Switch item=DockLongBeep
|
||||
String item=SirenBattery
|
||||
Switch item=SirenSwitch
|
||||
Selection item=SirenVolume mappings=["normal"="NORMAL", "highest"="HIGHEST"]
|
||||
Slider item=HeatingLevel
|
||||
```
|
||||
|
||||
## Alexa compatibility
|
||||
|
||||
This binding is compatible with the official Alexa Smart Home Skill.
|
||||
Since Rolleshutter items are unsupported, only Dimmer with control channel can be used.
|
||||
Syntax in .item file is as follows:
|
||||
|
||||
```
|
||||
Dimmer RollerShutterLivingD "Roller shutter living [%.1f]" [ "Lighting" ] {channel="somfytahoma:rollershutter:237dbae7:87bf0403-a45d-4037-b874-28f4ece30004:control"}
|
||||
```
|
||||
|
||||
Alexa can set the roller shutter (awning, blind, ...) to a specific position as well as send ON (interpretted as UP) and OFF commands (interpretted as DOWN).
|
||||
17
bundles/org.openhab.binding.somfytahoma/pom.xml
Normal file
17
bundles/org.openhab.binding.somfytahoma/pom.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.openhab.addons.bundles</groupId>
|
||||
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.binding.somfytahoma</artifactId>
|
||||
|
||||
<name>openHAB Add-ons :: Bundles :: SomfyTahoma Binding</name>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<features name="org.openhab.binding.somfytahoma-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
|
||||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
|
||||
|
||||
<feature name="openhab-binding-somfytahoma" description="Somfy Tahoma Binding" version="${project.version}">
|
||||
<feature>openhab-runtime-base</feature>
|
||||
<feature>openhab-transport-http</feature>
|
||||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.somfytahoma/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
@@ -0,0 +1,410 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaBindingConstants} class defines common constants, which are
|
||||
* used across the whole binding.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaBindingConstants {
|
||||
|
||||
public static final String BINDING_ID = "somfytahoma";
|
||||
|
||||
// Things
|
||||
// Bridge
|
||||
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
|
||||
|
||||
// Gateway
|
||||
public static final ThingTypeUID THING_TYPE_GATEWAY = new ThingTypeUID(BINDING_ID, "gateway");
|
||||
|
||||
// Roller Shutter
|
||||
public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER = new ThingTypeUID(BINDING_ID, "rollershutter");
|
||||
|
||||
// Silent Roller Shutter
|
||||
public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER_SILENT = new ThingTypeUID(BINDING_ID,
|
||||
"rollershutter_silent");
|
||||
|
||||
// Uno Roller Shutter
|
||||
public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER_UNO = new ThingTypeUID(BINDING_ID, "rollershutter_uno");
|
||||
|
||||
// Screen
|
||||
public static final ThingTypeUID THING_TYPE_SCREEN = new ThingTypeUID(BINDING_ID, "screen");
|
||||
|
||||
// Venetian Blind
|
||||
public static final ThingTypeUID THING_TYPE_VENETIANBLIND = new ThingTypeUID(BINDING_ID, "venetianblind");
|
||||
|
||||
// Exterior Screen
|
||||
public static final ThingTypeUID THING_TYPE_EXTERIORSCREEN = new ThingTypeUID(BINDING_ID, "exteriorscreen");
|
||||
|
||||
// Exterior Venetian Blind
|
||||
public static final ThingTypeUID THING_TYPE_EXTERIORVENETIANBLIND = new ThingTypeUID(BINDING_ID,
|
||||
"exteriorvenetianblind");
|
||||
|
||||
// Garage Door
|
||||
public static final ThingTypeUID THING_TYPE_GARAGEDOOR = new ThingTypeUID(BINDING_ID, "garagedoor");
|
||||
|
||||
// Awning
|
||||
public static final ThingTypeUID THING_TYPE_AWNING = new ThingTypeUID(BINDING_ID, "awning");
|
||||
|
||||
// Actiongroup
|
||||
public static final ThingTypeUID THING_TYPE_ACTIONGROUP = new ThingTypeUID(BINDING_ID, "actiongroup");
|
||||
|
||||
// On Off
|
||||
public static final ThingTypeUID THING_TYPE_ONOFF = new ThingTypeUID(BINDING_ID, "onoff");
|
||||
|
||||
// Light
|
||||
public static final ThingTypeUID THING_TYPE_LIGHT = new ThingTypeUID(BINDING_ID, "light");
|
||||
|
||||
// DimmerLight
|
||||
public static final ThingTypeUID THING_TYPE_DIMMER_LIGHT = new ThingTypeUID(BINDING_ID, "dimmerlight");
|
||||
|
||||
// Light sensor
|
||||
public static final ThingTypeUID THING_TYPE_LIGHTSENSOR = new ThingTypeUID(BINDING_ID, "lightsensor");
|
||||
|
||||
// Smoke sensor
|
||||
public static final ThingTypeUID THING_TYPE_SMOKESENSOR = new ThingTypeUID(BINDING_ID, "smokesensor");
|
||||
|
||||
// Contact sensor
|
||||
public static final ThingTypeUID THING_TYPE_CONTACTSENSOR = new ThingTypeUID(BINDING_ID, "contactsensor");
|
||||
|
||||
// Occupancy sensor
|
||||
public static final ThingTypeUID THING_TYPE_OCCUPANCYSENSOR = new ThingTypeUID(BINDING_ID, "occupancysensor");
|
||||
|
||||
// Water sensor
|
||||
public static final ThingTypeUID THING_TYPE_WATERSENSOR = new ThingTypeUID(BINDING_ID, "watersensor");
|
||||
|
||||
// Humidity sensor
|
||||
public static final ThingTypeUID THING_TYPE_HUMIDITYSENSOR = new ThingTypeUID(BINDING_ID, "humiditysensor");
|
||||
|
||||
// Window
|
||||
public static final ThingTypeUID THING_TYPE_WINDOW = new ThingTypeUID(BINDING_ID, "window");
|
||||
|
||||
// Alarm
|
||||
public static final ThingTypeUID THING_TYPE_INTERNAL_ALARM = new ThingTypeUID(BINDING_ID, "internalalarm");
|
||||
public static final ThingTypeUID THING_TYPE_EXTERNAL_ALARM = new ThingTypeUID(BINDING_ID, "externalalarm");
|
||||
public static final ThingTypeUID THING_TYPE_MYFOX_ALARM = new ThingTypeUID(BINDING_ID, "myfoxalarm");
|
||||
|
||||
// Pod
|
||||
public static final ThingTypeUID THING_TYPE_POD = new ThingTypeUID(BINDING_ID, "pod");
|
||||
|
||||
// Heating system
|
||||
public static final ThingTypeUID THING_TYPE_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID, "heatingsystem");
|
||||
public static final ThingTypeUID THING_TYPE_ONOFF_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID,
|
||||
"onoffheatingsystem");
|
||||
public static final ThingTypeUID THING_TYPE_EXTERIOR_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID,
|
||||
"exteriorheatingsystem");
|
||||
|
||||
// Door lock
|
||||
public static final ThingTypeUID THING_TYPE_DOOR_LOCK = new ThingTypeUID(BINDING_ID, "doorlock");
|
||||
|
||||
// Pergola
|
||||
public static final ThingTypeUID THING_TYPE_PERGOLA = new ThingTypeUID(BINDING_ID, "pergola");
|
||||
|
||||
// Window handle
|
||||
public static final ThingTypeUID THING_TYPE_WINDOW_HANDLE = new ThingTypeUID(BINDING_ID, "windowhandle");
|
||||
|
||||
// Temperature sensor
|
||||
public static final ThingTypeUID THING_TYPE_TEMPERATURESENSOR = new ThingTypeUID(BINDING_ID, "temperaturesensor");
|
||||
|
||||
// Gate
|
||||
public static final ThingTypeUID THING_TYPE_GATE = new ThingTypeUID(BINDING_ID, "gate");
|
||||
|
||||
// Curtains
|
||||
public static final ThingTypeUID THING_TYPE_CURTAIN = new ThingTypeUID(BINDING_ID, "curtain");
|
||||
|
||||
// Electricity sensor
|
||||
public static final ThingTypeUID THING_TYPE_ELECTRICITYSENSOR = new ThingTypeUID(BINDING_ID, "electricitysensor");
|
||||
|
||||
// Dock
|
||||
public static final ThingTypeUID THING_TYPE_DOCK = new ThingTypeUID(BINDING_ID, "dock");
|
||||
|
||||
// Siren
|
||||
public static final ThingTypeUID THING_TYPE_SIREN = new ThingTypeUID(BINDING_ID, "siren");
|
||||
|
||||
// Adjustable slats roller shutter
|
||||
public static final ThingTypeUID THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER = new ThingTypeUID(BINDING_ID,
|
||||
"adjustableslatsrollershutter");
|
||||
|
||||
// MyFox Camera
|
||||
public static final ThingTypeUID THING_TYPE_MYFOX_CAMERA = new ThingTypeUID(BINDING_ID, "myfoxcamera");
|
||||
|
||||
// Thermostat
|
||||
public static final ThingTypeUID THING_TYPE_THERMOSTAT = new ThingTypeUID(BINDING_ID, "thermostat");
|
||||
|
||||
// List of all Channel ids
|
||||
public static final String RSSI = "rssi";
|
||||
|
||||
// Gateway
|
||||
public static final String STATUS = "status";
|
||||
|
||||
// Roller shutter, Awning, Screen, Blind, Garage door, Window, Curtain
|
||||
public static final String CONTROL = "control";
|
||||
|
||||
// Adjustable slats roller shutter
|
||||
public static final String ROCKER = "rocker";
|
||||
|
||||
// Silent roller shutter
|
||||
public static final String CONTROL_SILENT = "control_silent";
|
||||
|
||||
// Blind
|
||||
public static final String ORIENTATION = "orientation";
|
||||
public static final String CLOSURE_AND_ORIENTATION = "closure_orientation";
|
||||
|
||||
// Action group
|
||||
public static final String EXECUTE_ACTION = "execute_action";
|
||||
|
||||
// OnOff, Light
|
||||
public static final String SWITCH = "switch";
|
||||
|
||||
// Dimmer Light
|
||||
public static final String LIGHT_INTENSITY = "light_intensity";
|
||||
|
||||
// Door lock
|
||||
public static final String LOCK = "lock";
|
||||
public static final String OPEN = "open";
|
||||
|
||||
// Smoke sensor, Occupancy sensor, Contact sensor, Water sensor
|
||||
public static final String CONTACT = "contact";
|
||||
public static final String SENSOR_DEFECT = "sensor_defect";
|
||||
|
||||
// Humidity sensor
|
||||
public static final String HUMIDITY = "humidity";
|
||||
|
||||
// Smoke sensor
|
||||
public static final String ALARM_CHECK = "alarm_check";
|
||||
public static final String RADIO_BATTERY = "radio_battery";
|
||||
public static final String SENSOR_BATTERY = "sensor_battery";
|
||||
|
||||
// Light sensor
|
||||
public static final String LUMINANCE = "luminance";
|
||||
|
||||
// Temperature sensor
|
||||
public static final String TEMPERATURE = "temperature";
|
||||
|
||||
// Alarm
|
||||
public static final String ALARM_COMMAND = "alarm_command";
|
||||
public static final String ALARM_STATE = "alarm_state";
|
||||
public static final String TARGET_ALARM_STATE = "target_alarm_state";
|
||||
public static final String INTRUSION_CONTROL = "intrusion_control";
|
||||
public static final String INTRUSION_STATE = "intrusion_state";
|
||||
|
||||
// Pod
|
||||
public static final String CYCLIC_BUTTON = "cyclic_button";
|
||||
public static final String LIGHTING_LED_POD_MODE = "lighting_led_pod_mode";
|
||||
|
||||
// Heating system
|
||||
public static final String TARGET_TEMPERATURE = "target_temperature";
|
||||
public static final String CURRENT_TEMPERATURE = "current_temperature";
|
||||
public static final String CURRENT_STATE = "current_state";
|
||||
public static final String BATTERY_LEVEL = "battery_level";
|
||||
public static final String TARGET_HEATING_LEVEL = "target_heating_level";
|
||||
public static final String HEATING_LEVEL = "heating_level";
|
||||
|
||||
// Thermostat
|
||||
public static final String HEATING_MODE = "heating_mode";
|
||||
public static final String DEROGATION_HEATING_MODE = "derogation_heating_mode";
|
||||
public static final String DEROGATION_ACTIVATION = "derogation_activation";
|
||||
|
||||
// Window handle
|
||||
public static final String HANDLE_STATE = "handle_state";
|
||||
|
||||
// Gate
|
||||
public static final String GATE_STATE = "gate_state";
|
||||
public static final String GATE_COMMAND = "gate_command";
|
||||
|
||||
// ElectricitySensor
|
||||
public static final String ENERGY_CONSUMPTION = "energy_consumption";
|
||||
|
||||
// Dock
|
||||
public static final String BATTERY_STATUS = "battery_status";
|
||||
public static final String SIREN_STATUS = "siren_status";
|
||||
public static final String SHORT_BIP = "short_beep";
|
||||
public static final String LONG_BIP = "long_beep";
|
||||
|
||||
// Siren
|
||||
public static final String MEMORIZED_VOLUME = "memorized_volume";
|
||||
public static final String ONOFF_STATE = "onoff";
|
||||
public static final String BATTERY = "battery";
|
||||
|
||||
// Myfox Alarm
|
||||
public static final String MYFOX_ALARM_COMMAND = "myfox_alarm_command";
|
||||
|
||||
// Myfox Alarm & Camera
|
||||
public static final String CLOUD_STATUS = "cloud_status";
|
||||
|
||||
// Myfox Camera
|
||||
public static final String SHUTTER = "shutter";
|
||||
|
||||
// Constants
|
||||
public static final String TAHOMA_API_URL = "https://www.tahomalink.com/enduser-mobile-web/enduserAPI/";
|
||||
public static final String TAHOMA_EVENTS_URL = TAHOMA_API_URL + "events/";
|
||||
public static final String SETUP_URL = TAHOMA_API_URL + "setup/";
|
||||
public static final String GATEWAYS_URL = SETUP_URL + "gateways/";
|
||||
public static final String DEVICES_URL = SETUP_URL + "devices/";
|
||||
public static final String REFRESH_URL = DEVICES_URL + "states/refresh";
|
||||
public static final String EXEC_URL = TAHOMA_API_URL + "exec/";
|
||||
public static final String DELETE_URL = EXEC_URL + "current/setup/";
|
||||
public static final String TAHOMA_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
|
||||
public static final int TAHOMA_TIMEOUT = 5;
|
||||
public static final String UNAUTHORIZED = "Not logged in";
|
||||
public static final int TYPE_PERCENT = 1;
|
||||
public static final int TYPE_DECIMAL = 2;
|
||||
public static final int TYPE_STRING = 3;
|
||||
public static final int TYPE_BOOLEAN = 6;
|
||||
public static final String UNAVAILABLE = "unavailable";
|
||||
public static final String AUTHENTICATION_CHALLENGE = "HTTP protocol violation: Authentication challenge without WWW-Authenticate header";
|
||||
public static final String TOO_MANY_REQUESTS = "Too many requests, try again later";
|
||||
public static final int SUSPEND_TIME = 120;
|
||||
public static final int RECONCILIATION_TIME = 600;
|
||||
|
||||
// Commands
|
||||
public static final String COMMAND_MY = "my";
|
||||
public static final String COMMAND_SET_CLOSURE = "setClosure";
|
||||
public static final String COMMAND_SET_CLOSURE_ORIENTATION = "setClosureAndOrientation";
|
||||
public static final String COMMAND_SET_DEPLOYMENT = "setDeployment";
|
||||
public static final String COMMAND_SET_ORIENTATION = "setOrientation";
|
||||
public static final String COMMAND_SET_CLOSURESPEED = "setClosureAndLinearSpeed";
|
||||
public static final String COMMAND_SET_HEATINGLEVEL = "setHeatingLevel";
|
||||
public static final String COMMAND_SET_PEDESTRIANPOSITION = "setPedestrianPosition";
|
||||
public static final String COMMAND_SET_ROCKERPOSITION = "setRockerPosition";
|
||||
public static final String COMMAND_UP = "up";
|
||||
public static final String COMMAND_DOWN = "down";
|
||||
public static final String COMMAND_OPEN = "open";
|
||||
public static final String COMMAND_CLOSE = "close";
|
||||
public static final String COMMAND_STOP = "stop";
|
||||
public static final String COMMAND_OFF = "off";
|
||||
public static final String COMMAND_CHECK_TRIGGER = "checkEventTrigger";
|
||||
|
||||
// States
|
||||
public static final String NAME_STATE = "core:NameState";
|
||||
public static final String RSSI_LEVEL_STATE = "core:RSSILevelState";
|
||||
public static final String STATUS_STATE = "core:StatusState";
|
||||
public static final String ENERGY_CONSUMPTION_STATE = "core:ElectricEnergyConsumptionState";
|
||||
public static final String CYCLIC_BUTTON_STATE = "core:CyclicButtonState";
|
||||
public static final String BATTERY_STATUS_STATE = "internal:BatteryStatusState";
|
||||
public static final String SLATE_ORIENTATION_STATE = "core:SlateOrientationState";
|
||||
public static final String CLOSURE_OR_ROCKER_STATE = "core:ClosureOrRockerPositionState";
|
||||
public static final String MYFOX_SHUTTER_STATUS_STATE = "myfox:ShutterStatusState";
|
||||
public static final String TARGET_CLOSURE_STATE = "core:TargetClosureState";
|
||||
public static final String WATER_DETECTION_STATE = "core:WaterDetectionState";
|
||||
public static final String CLOUD_DEVICE_STATUS_STATE = "core:CloudDeviceStatusState";
|
||||
public static final String BATTERY_LEVEL_STATE = "core:BatteryLevelState";
|
||||
public static final String SIREN_STATUS_STATE = "internal:SirenStatusState";
|
||||
public static final String TARGET_TEMPERATURE_STATE = "core:TargetTemperatureState";
|
||||
public static final String SMOKE_STATE = "core:SmokeState";
|
||||
public static final String SENSOR_DEFECT_STATE = "core:SensorDefectState";
|
||||
public static final String RADIO_PART_BATTERY_STATE = "io:MaintenanceRadioPartBatteryState";
|
||||
public static final String SENSOR_PART_BATTERY_STATE = "io:MaintenanceSensorPartBatteryState";
|
||||
|
||||
// supported uiClasses
|
||||
public static final String CLASS_ROLLER_SHUTTER = "RollerShutter";
|
||||
public static final String CLASS_SCREEN = "Screen";
|
||||
public static final String CLASS_VENETIAN_BLIND = "VenetianBlind";
|
||||
public static final String CLASS_EXTERIOR_SCREEN = "ExteriorScreen";
|
||||
public static final String CLASS_EXTERIOR_VENETIAN_BLIND = "ExteriorVenetianBlind";
|
||||
public static final String CLASS_GARAGE_DOOR = "GarageDoor";
|
||||
public static final String CLASS_AWNING = "Awning";
|
||||
public static final String CLASS_ON_OFF = "OnOff";
|
||||
public static final String CLASS_LIGHT = "Light";
|
||||
public static final String CLASS_LIGHT_SENSOR = "LightSensor";
|
||||
public static final String CLASS_SMOKE_SENSOR = "SmokeSensor";
|
||||
public static final String CLASS_CONTACT_SENSOR = "ContactSensor";
|
||||
public static final String CLASS_OCCUPANCY_SENSOR = "OccupancySensor";
|
||||
public static final String CLASS_HUMIDITY_SENSOR = "HumiditySensor";
|
||||
public static final String CLASS_WINDOW = "Window";
|
||||
public static final String CLASS_ALARM = "Alarm";
|
||||
public static final String CLASS_POD = "Pod";
|
||||
public static final String CLASS_HEATING_SYSTEM = "HeatingSystem";
|
||||
public static final String CLASS_EXTERIOR_HEATING_SYSTEM = "ExteriorHeatingSystem";
|
||||
public static final String CLASS_DOOR_LOCK = "DoorLock";
|
||||
public static final String CLASS_PERGOLA = "Pergola";
|
||||
public static final String CLASS_WINDOW_HANDLE = "WindowHandle";
|
||||
public static final String CLASS_TEMPERATURE_SENSOR = "TemperatureSensor";
|
||||
public static final String CLASS_GATE = "Gate";
|
||||
public static final String CLASS_CURTAIN = "Curtain";
|
||||
public static final String CLASS_ELECTRICITY_SENSOR = "ElectricitySensor";
|
||||
public static final String CLASS_DOCK = "Dock";
|
||||
public static final String CLASS_SIREN = "Siren";
|
||||
public static final String CLASS_ADJUSTABLE_SLATS_ROLLER_SHUTTER = "AdjustableSlatsRollerShutter";
|
||||
public static final String CLASS_CAMERA = "Camera";
|
||||
|
||||
// unsupported uiClasses
|
||||
public static final String THING_PROTOCOL_GATEWAY = "ProtocolGateway";
|
||||
public static final String THING_REMOTE_CONTROLLER = "RemoteController";
|
||||
public static final String THING_NETWORK_COMPONENT = "NetworkComponent";
|
||||
|
||||
// Event states
|
||||
public static final String FAILED_EVENT = "FAILED";
|
||||
public static final String COMPLETED_EVENT = "COMPLETED";
|
||||
|
||||
// supported thing types for discovery
|
||||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(Arrays.asList(THING_TYPE_GATEWAY,
|
||||
THING_TYPE_ROLLERSHUTTER, THING_TYPE_ROLLERSHUTTER_SILENT, THING_TYPE_SCREEN, THING_TYPE_VENETIANBLIND,
|
||||
THING_TYPE_EXTERIORSCREEN, THING_TYPE_EXTERIORVENETIANBLIND, THING_TYPE_GARAGEDOOR, THING_TYPE_AWNING,
|
||||
THING_TYPE_ACTIONGROUP, THING_TYPE_ONOFF, THING_TYPE_LIGHT, THING_TYPE_LIGHTSENSOR, THING_TYPE_SMOKESENSOR,
|
||||
THING_TYPE_CONTACTSENSOR, THING_TYPE_OCCUPANCYSENSOR, THING_TYPE_WINDOW, THING_TYPE_INTERNAL_ALARM,
|
||||
THING_TYPE_EXTERNAL_ALARM, THING_TYPE_POD, THING_TYPE_HEATING_SYSTEM, THING_TYPE_ONOFF_HEATING_SYSTEM,
|
||||
THING_TYPE_DOOR_LOCK, THING_TYPE_PERGOLA, THING_TYPE_WINDOW_HANDLE, THING_TYPE_TEMPERATURESENSOR,
|
||||
THING_TYPE_GATE, THING_TYPE_CURTAIN, THING_TYPE_ELECTRICITYSENSOR, THING_TYPE_DOCK, THING_TYPE_SIREN,
|
||||
THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER, THING_TYPE_MYFOX_CAMERA, THING_TYPE_ROLLERSHUTTER_UNO,
|
||||
THING_TYPE_WATERSENSOR, THING_TYPE_HUMIDITYSENSOR, THING_TYPE_MYFOX_ALARM, THING_TYPE_THERMOSTAT,
|
||||
THING_TYPE_DIMMER_LIGHT, THING_TYPE_EXTERIOR_HEATING_SYSTEM));
|
||||
|
||||
// somfy gateways
|
||||
public static Map<Integer, String> gatewayTypes = new HashMap<Integer, String>() {
|
||||
{
|
||||
put(0, "VIRTUAL_KIZBOX");
|
||||
put(2, "KIZBOX_V1");
|
||||
put(15, "TAHOMA");
|
||||
put(20, "VERISURE_ALARM_SYSTEM");
|
||||
put(21, "KIZBOX_MINI");
|
||||
put(24, "KIZBOX_V2");
|
||||
put(25, "MYFOX_ALARM_SYSTEM");
|
||||
put(27, "KIZBOX_MINI_VMBUS");
|
||||
put(28, "KIZBOX_MINI_IO");
|
||||
put(29, "TAHOMA_V2");
|
||||
put(30, "KIZBOX_V2_3H");
|
||||
put(31, "KIZBOX_V2_2H");
|
||||
put(34, "CONNEXOON");
|
||||
put(35, "JSW_CAMERA");
|
||||
put(37, "KIZBOX_MINI_DAUGHTERBOARD");
|
||||
put(38, "KIZBOX_MINI_DAUGHTERBOARD_ZWAVE");
|
||||
put(39, "KIZBOX_MINI_DAUGHTERBOARD_ENOCEAN");
|
||||
put(40, "KIZBOX_MINI_RAILDIN");
|
||||
put(41, "TAHOMA_V2_RTS");
|
||||
put(42, "KIZBOX_MINI_MODBUS");
|
||||
put(43, "KIZBOX_MINI_OVP");
|
||||
put(53, "CONNEXOON_RTS");
|
||||
put(54, "OPENDOORS_LOCK_SYSTEM");
|
||||
put(56, "CONNEXOON_RTS_JAPAN");
|
||||
put(58, "HOME_PROTECT_SYSTEM");
|
||||
put(62, "CONNEXOON_RTS_AUSTRALIA");
|
||||
put(63, "THERMOSTAT_SOMFY_SYSTEM");
|
||||
put(64, "BOX_ULTRA_LOW_COST_RTS");
|
||||
put(65, "SMARTLY_MINI_DAUGHTERBOARD_ZWAVE");
|
||||
put(66, "SMARTLY_MINIBOX_RAILDIN");
|
||||
put(67, "TAHOMA_BEE");
|
||||
put(72, "TAHOMA_RAIL_DIN");
|
||||
put(77, "ELIOT");
|
||||
put(88, "WISER");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaException} represents an exception in the response of
|
||||
* the TahomaLink cloud service.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SomfyTahomaException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public SomfyTahomaException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public SomfyTahomaException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.*;
|
||||
import org.openhab.core.io.net.http.HttpClientFactory;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.somfytahoma")
|
||||
public class SomfyTahomaHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(SomfyTahomaHandlerFactory.class);
|
||||
|
||||
private final HttpClientFactory httpClientFactory;
|
||||
|
||||
@Activate
|
||||
public SomfyTahomaHandlerFactory(@Reference HttpClientFactory httpClientFactory) {
|
||||
this.httpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
return THING_TYPE_BRIDGE.equals(thingTypeUID) || SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
logger.debug("Creating handler for {}", thing.getThingTypeUID().getId());
|
||||
|
||||
if (thingTypeUID.equals(THING_TYPE_BRIDGE)) {
|
||||
return new SomfyTahomaBridgeHandler((Bridge) thing, httpClientFactory);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_GATEWAY)) {
|
||||
return new SomfyTahomaGatewayHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ROLLERSHUTTER)) {
|
||||
return new SomfyTahomaRollerShutterHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ROLLERSHUTTER_SILENT)) {
|
||||
return new SomfyTahomaSilentRollerShutterHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ROLLERSHUTTER_UNO)) {
|
||||
return new SomfyTahomaUnoRollerShutterHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_SCREEN) || thingTypeUID.equals(THING_TYPE_EXTERIORSCREEN)) {
|
||||
return new SomfyTahomaRollerShutterHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_VENETIANBLIND)
|
||||
|| thingTypeUID.equals(THING_TYPE_EXTERIORVENETIANBLIND)) {
|
||||
return new SomfyTahomaVenetianBlindHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_GARAGEDOOR)) {
|
||||
return new SomfyTahomaRollerShutterHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_AWNING)) {
|
||||
return new SomfyTahomaAwningHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ACTIONGROUP)) {
|
||||
return new SomfyTahomaActionGroupHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ONOFF)) {
|
||||
return new SomfyTahomaOnOffHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_LIGHT)) {
|
||||
return new SomfyTahomaOnOffHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_DIMMER_LIGHT)) {
|
||||
return new SomfyTahomaDimmerLightHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_LIGHTSENSOR)) {
|
||||
return new SomfyTahomaLightSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_SMOKESENSOR)) {
|
||||
return new SomfyTahomaSmokeSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_OCCUPANCYSENSOR)) {
|
||||
return new SomfyTahomaOccupancySensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_CONTACTSENSOR)) {
|
||||
return new SomfyTahomaContactSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_WATERSENSOR)) {
|
||||
return new SomfyTahomaWaterSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_HUMIDITYSENSOR)) {
|
||||
return new SomfyTahomaHumiditySensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_WINDOW)) {
|
||||
return new SomfyTahomaWindowHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_INTERNAL_ALARM)) {
|
||||
return new SomfyTahomaInternalAlarmHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_EXTERNAL_ALARM)) {
|
||||
return new SomfyTahomaExternalAlarmHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_POD)) {
|
||||
return new SomfyTahomaPodHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ONOFF_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaOnOffHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_EXTERIOR_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaExteriorHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_DOOR_LOCK)) {
|
||||
return new SomfyTahomaDoorLockHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_PERGOLA)) {
|
||||
return new SomfyTahomaPergolaHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_WINDOW_HANDLE)) {
|
||||
return new SomfyTahomaWindowHandleHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_TEMPERATURESENSOR)) {
|
||||
return new SomfyTahomaTemperatureSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_GATE)) {
|
||||
return new SomfyTahomaGateHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_CURTAIN)) {
|
||||
return new SomfyTahomaCurtainHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ELECTRICITYSENSOR)) {
|
||||
return new SomfyTahomaElectricitySensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_DOCK)) {
|
||||
return new SomfyTahomaDockHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_SIREN)) {
|
||||
return new SomfyTahomaSirenHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER)) {
|
||||
return new SomfyTahomaAdjustableSlatsRollerShutterHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_MYFOX_CAMERA)) {
|
||||
return new SomfyTahomaMyfoxCameraHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_MYFOX_ALARM)) {
|
||||
return new SomfyTahomaMyfoxAlarmHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_THERMOSTAT)) {
|
||||
return new SomfyTahomaThermostatHandler(thing);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.config;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaConfig} is is the base class for configuration
|
||||
* information held by devices and modules.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaConfig {
|
||||
private String email = "";
|
||||
private String password = "";
|
||||
private int refresh = 30;
|
||||
private int statusTimeout = 300;
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public int getRefresh() {
|
||||
return refresh;
|
||||
}
|
||||
|
||||
public int getStatusTimeout() {
|
||||
return statusTimeout;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.discovery;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaBridgeHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.model.*;
|
||||
import org.openhab.core.config.discovery.AbstractDiscoveryService;
|
||||
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
|
||||
import org.openhab.core.config.discovery.DiscoveryService;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
import org.openhab.core.thing.ThingUID;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaItemDiscoveryService} discovers rollershutters and
|
||||
* action groups associated with your TahomaLink cloud account.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
|
||||
implements DiscoveryService, ThingHandlerService {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(SomfyTahomaItemDiscoveryService.class);
|
||||
|
||||
private @Nullable SomfyTahomaBridgeHandler bridgeHandler;
|
||||
|
||||
private @Nullable ScheduledFuture<?> discoveryJob;
|
||||
|
||||
private static final int DISCOVERY_TIMEOUT_SEC = 10;
|
||||
private static final int DISCOVERY_REFRESH_SEC = 3600;
|
||||
|
||||
public SomfyTahomaItemDiscoveryService() {
|
||||
super(DISCOVERY_TIMEOUT_SEC);
|
||||
logger.debug("Creating discovery service");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate() {
|
||||
super.activate(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
super.deactivate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThingHandler(@NonNullByDefault({}) ThingHandler handler) {
|
||||
if (handler instanceof SomfyTahomaBridgeHandler) {
|
||||
bridgeHandler = (SomfyTahomaBridgeHandler) handler;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ThingHandler getThingHandler() {
|
||||
return bridgeHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startBackgroundDiscovery() {
|
||||
logger.debug("Starting SomfyTahoma background discovery");
|
||||
|
||||
ScheduledFuture<?> localDiscoveryJob = discoveryJob;
|
||||
if (localDiscoveryJob == null || localDiscoveryJob.isCancelled()) {
|
||||
discoveryJob = scheduler.scheduleWithFixedDelay(this::runDiscovery, 10, DISCOVERY_REFRESH_SEC,
|
||||
TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void stopBackgroundDiscovery() {
|
||||
logger.debug("Stopping SomfyTahoma background discovery");
|
||||
ScheduledFuture<?> localDiscoveryJob = discoveryJob;
|
||||
if (localDiscoveryJob != null && !localDiscoveryJob.isCancelled()) {
|
||||
localDiscoveryJob.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ThingTypeUID> getSupportedThingTypes() {
|
||||
return SUPPORTED_THING_TYPES_UIDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startScan() {
|
||||
runDiscovery();
|
||||
}
|
||||
|
||||
private synchronized void runDiscovery() {
|
||||
logger.debug("Starting scanning for things...");
|
||||
|
||||
SomfyTahomaBridgeHandler localBridgeHandler = bridgeHandler;
|
||||
if (localBridgeHandler != null && ThingStatus.ONLINE == localBridgeHandler.getThing().getStatus()) {
|
||||
SomfyTahomaSetup setup = localBridgeHandler.getSetup();
|
||||
|
||||
if (setup == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (SomfyTahomaDevice device : setup.getDevices()) {
|
||||
discoverDevice(device);
|
||||
}
|
||||
for (SomfyTahomaGateway gw : setup.getGateways()) {
|
||||
gatewayDiscovered(gw);
|
||||
}
|
||||
|
||||
List<SomfyTahomaActionGroup> actions = localBridgeHandler.listActionGroups();
|
||||
|
||||
for (SomfyTahomaActionGroup group : actions) {
|
||||
String oid = group.getOid();
|
||||
String label = group.getLabel();
|
||||
|
||||
// actiongroups use oid as deviceURL
|
||||
actionGroupDiscovered(label, oid, oid);
|
||||
}
|
||||
} else {
|
||||
logger.debug("Cannot start discovery since the bridge is not online!");
|
||||
}
|
||||
}
|
||||
|
||||
private void discoverDevice(SomfyTahomaDevice device) {
|
||||
logger.debug("url: {}", device.getDeviceURL());
|
||||
switch (device.getUiClass()) {
|
||||
case CLASS_AWNING:
|
||||
// widget: PositionableHorizontalAwning
|
||||
deviceDiscovered(device, THING_TYPE_AWNING);
|
||||
break;
|
||||
case CLASS_CONTACT_SENSOR:
|
||||
// widget: ContactSensor
|
||||
deviceDiscovered(device, THING_TYPE_CONTACTSENSOR);
|
||||
break;
|
||||
case CLASS_CURTAIN:
|
||||
deviceDiscovered(device, THING_TYPE_CURTAIN);
|
||||
break;
|
||||
case CLASS_EXTERIOR_SCREEN:
|
||||
// widget: PositionableScreen
|
||||
deviceDiscovered(device, THING_TYPE_EXTERIORSCREEN);
|
||||
break;
|
||||
case CLASS_EXTERIOR_VENETIAN_BLIND:
|
||||
// widget: PositionableExteriorVenetianBlind
|
||||
deviceDiscovered(device, THING_TYPE_EXTERIORVENETIANBLIND);
|
||||
break;
|
||||
case CLASS_GARAGE_DOOR:
|
||||
deviceDiscovered(device, THING_TYPE_GARAGEDOOR);
|
||||
break;
|
||||
case CLASS_LIGHT:
|
||||
if ("DimmerLight".equals(device.getWidget())) {
|
||||
// widget: DimmerLight
|
||||
deviceDiscovered(device, THING_TYPE_DIMMER_LIGHT);
|
||||
} else {
|
||||
// widget: TimedOnOffLight
|
||||
// widget: StatefulOnOffLight
|
||||
deviceDiscovered(device, THING_TYPE_LIGHT);
|
||||
}
|
||||
break;
|
||||
case CLASS_LIGHT_SENSOR:
|
||||
deviceDiscovered(device, THING_TYPE_LIGHTSENSOR);
|
||||
break;
|
||||
case CLASS_OCCUPANCY_SENSOR:
|
||||
// widget: OccupancySensor
|
||||
deviceDiscovered(device, THING_TYPE_OCCUPANCYSENSOR);
|
||||
break;
|
||||
case CLASS_ON_OFF:
|
||||
// widget: StatefulOnOff
|
||||
deviceDiscovered(device, THING_TYPE_ONOFF);
|
||||
break;
|
||||
case CLASS_ROLLER_SHUTTER:
|
||||
if (isSilentRollerShutter(device)) {
|
||||
// widget: PositionableRollerShutterWithLowSpeedManagement
|
||||
deviceDiscovered(device, THING_TYPE_ROLLERSHUTTER_SILENT);
|
||||
} else if (isUnoRollerShutter(device)) {
|
||||
// widget: PositionableRollerShutterUno
|
||||
deviceDiscovered(device, THING_TYPE_ROLLERSHUTTER_UNO);
|
||||
} else {
|
||||
// widget: PositionableRollerShutter
|
||||
// widget: PositionableTiltedRollerShutter
|
||||
deviceDiscovered(device, THING_TYPE_ROLLERSHUTTER);
|
||||
}
|
||||
break;
|
||||
case CLASS_SCREEN:
|
||||
// widget: PositionableTiltedScreen
|
||||
deviceDiscovered(device, THING_TYPE_SCREEN);
|
||||
break;
|
||||
case CLASS_SMOKE_SENSOR:
|
||||
// widget: SmokeSensor
|
||||
deviceDiscovered(device, THING_TYPE_SMOKESENSOR);
|
||||
break;
|
||||
case CLASS_VENETIAN_BLIND:
|
||||
deviceDiscovered(device, THING_TYPE_VENETIANBLIND);
|
||||
break;
|
||||
case CLASS_WINDOW:
|
||||
// widget: PositionableTiltedWindow
|
||||
deviceDiscovered(device, THING_TYPE_WINDOW);
|
||||
break;
|
||||
case CLASS_ALARM:
|
||||
if (device.getDeviceURL().startsWith("internal:")) {
|
||||
// widget: TSKAlarmController
|
||||
deviceDiscovered(device, THING_TYPE_INTERNAL_ALARM);
|
||||
} else if ("MyFoxAlarmController".equals(device.getWidget())) {
|
||||
// widget: MyFoxAlarmController
|
||||
deviceDiscovered(device, THING_TYPE_MYFOX_ALARM);
|
||||
} else {
|
||||
deviceDiscovered(device, THING_TYPE_EXTERNAL_ALARM);
|
||||
}
|
||||
break;
|
||||
case CLASS_POD:
|
||||
if (hasState(device, CYCLIC_BUTTON_STATE)) {
|
||||
deviceDiscovered(device, THING_TYPE_POD);
|
||||
}
|
||||
break;
|
||||
case CLASS_HEATING_SYSTEM:
|
||||
if ("SomfyThermostat".equals(device.getWidget())) {
|
||||
deviceDiscovered(device, THING_TYPE_THERMOSTAT);
|
||||
} else if (isOnOffHeatingSystem(device)) {
|
||||
deviceDiscovered(device, THING_TYPE_ONOFF_HEATING_SYSTEM);
|
||||
} else {
|
||||
deviceDiscovered(device, THING_TYPE_HEATING_SYSTEM);
|
||||
}
|
||||
break;
|
||||
case CLASS_EXTERIOR_HEATING_SYSTEM:
|
||||
if ("DimmerExteriorHeating".equals(device.getWidget())) {
|
||||
// widget: DimmerExteriorHeating
|
||||
deviceDiscovered(device, THING_TYPE_EXTERIOR_HEATING_SYSTEM);
|
||||
} else {
|
||||
logUnsupportedDevice(device);
|
||||
}
|
||||
break;
|
||||
case CLASS_HUMIDITY_SENSOR:
|
||||
if (hasState(device, WATER_DETECTION_STATE)) {
|
||||
deviceDiscovered(device, THING_TYPE_WATERSENSOR);
|
||||
} else {
|
||||
// widget: RelativeHumiditySensor
|
||||
deviceDiscovered(device, THING_TYPE_HUMIDITYSENSOR);
|
||||
}
|
||||
case CLASS_DOOR_LOCK:
|
||||
// widget: UnlockDoorLockWithUnknownPosition
|
||||
deviceDiscovered(device, THING_TYPE_DOOR_LOCK);
|
||||
break;
|
||||
case CLASS_PERGOLA:
|
||||
deviceDiscovered(device, THING_TYPE_PERGOLA);
|
||||
break;
|
||||
case CLASS_WINDOW_HANDLE:
|
||||
// widget: ThreeWayWindowHandle
|
||||
deviceDiscovered(device, THING_TYPE_WINDOW_HANDLE);
|
||||
break;
|
||||
case CLASS_TEMPERATURE_SENSOR:
|
||||
// widget: TemperatureSensor
|
||||
deviceDiscovered(device, THING_TYPE_TEMPERATURESENSOR);
|
||||
break;
|
||||
case CLASS_GATE:
|
||||
deviceDiscovered(device, THING_TYPE_GATE);
|
||||
break;
|
||||
case CLASS_ELECTRICITY_SENSOR:
|
||||
if (hasEnergyConsumption(device)) {
|
||||
deviceDiscovered(device, THING_TYPE_ELECTRICITYSENSOR);
|
||||
} else {
|
||||
logUnsupportedDevice(device);
|
||||
}
|
||||
break;
|
||||
case CLASS_DOCK:
|
||||
// widget: Dock
|
||||
deviceDiscovered(device, THING_TYPE_DOCK);
|
||||
break;
|
||||
case CLASS_SIREN:
|
||||
deviceDiscovered(device, THING_TYPE_SIREN);
|
||||
break;
|
||||
case CLASS_ADJUSTABLE_SLATS_ROLLER_SHUTTER:
|
||||
deviceDiscovered(device, THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER);
|
||||
break;
|
||||
case CLASS_CAMERA:
|
||||
if (hasMyfoxShutter(device)) {
|
||||
// widget: MyFoxSecurityCamera
|
||||
deviceDiscovered(device, THING_TYPE_MYFOX_CAMERA);
|
||||
} else {
|
||||
logUnsupportedDevice(device);
|
||||
}
|
||||
break;
|
||||
case THING_PROTOCOL_GATEWAY:
|
||||
case THING_REMOTE_CONTROLLER:
|
||||
// widget: AlarmRemoteController
|
||||
case THING_NETWORK_COMPONENT:
|
||||
break;
|
||||
default:
|
||||
logUnsupportedDevice(device);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStateLess(SomfyTahomaDevice device) {
|
||||
return device.getStates().isEmpty() || (device.getStates().size() == 1 && hasState(device, STATUS_STATE));
|
||||
}
|
||||
|
||||
private void logUnsupportedDevice(SomfyTahomaDevice device) {
|
||||
if (!isStateLess(device)) {
|
||||
logger.info("Detected a new unsupported device: {} with widgetName: {}", device.getUiClass(),
|
||||
device.getWidget());
|
||||
logger.info("If you want to add the support, please create a new issue and attach the information below");
|
||||
logger.info("Device definition:\n{}", device.getDefinition());
|
||||
|
||||
StringBuilder sb = new StringBuilder().append('\n');
|
||||
for (SomfyTahomaState state : device.getStates()) {
|
||||
sb.append(state.toString()).append('\n');
|
||||
}
|
||||
logger.info("Current device states: {}", sb);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasState(SomfyTahomaDevice device, String state) {
|
||||
return device.getDefinition().getStates().stream().anyMatch(st -> state.equals(st.getQualifiedName()));
|
||||
}
|
||||
|
||||
private boolean hasMyfoxShutter(SomfyTahomaDevice device) {
|
||||
return hasState(device, MYFOX_SHUTTER_STATUS_STATE);
|
||||
}
|
||||
|
||||
private boolean hasEnergyConsumption(SomfyTahomaDevice device) {
|
||||
return hasState(device, ENERGY_CONSUMPTION_STATE);
|
||||
}
|
||||
|
||||
private boolean isSilentRollerShutter(SomfyTahomaDevice device) {
|
||||
return hasCommmand(device, COMMAND_SET_CLOSURESPEED);
|
||||
}
|
||||
|
||||
private boolean isUnoRollerShutter(SomfyTahomaDevice device) {
|
||||
return hasState(device, TARGET_CLOSURE_STATE);
|
||||
}
|
||||
|
||||
private boolean isOnOffHeatingSystem(SomfyTahomaDevice device) {
|
||||
return hasCommmand(device, COMMAND_SET_HEATINGLEVEL);
|
||||
}
|
||||
|
||||
private boolean hasCommmand(SomfyTahomaDevice device, String command) {
|
||||
return device.getDefinition().getCommands().stream().anyMatch(cmd -> command.equals(cmd.getCommandName()));
|
||||
}
|
||||
|
||||
private void deviceDiscovered(SomfyTahomaDevice device, ThingTypeUID thingTypeUID) {
|
||||
deviceDiscovered(device.getLabel(), device.getDeviceURL(), device.getOid(), thingTypeUID,
|
||||
hasState(device, RSSI_LEVEL_STATE));
|
||||
}
|
||||
|
||||
private void deviceDiscovered(String label, String deviceURL, String oid, ThingTypeUID thingTypeUID, boolean rssi) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("url", deviceURL);
|
||||
properties.put(NAME_STATE, label);
|
||||
if (rssi) {
|
||||
properties.put(RSSI_LEVEL_STATE, "-1");
|
||||
}
|
||||
|
||||
SomfyTahomaBridgeHandler localBridgeHandler = bridgeHandler;
|
||||
if (localBridgeHandler != null) {
|
||||
ThingUID thingUID = new ThingUID(thingTypeUID, localBridgeHandler.getThing().getUID(), oid);
|
||||
|
||||
logger.debug("Detected a/an {} - label: {} oid: {}", thingTypeUID.getId(), label, oid);
|
||||
thingDiscovered(DiscoveryResultBuilder.create(thingUID).withThingType(thingTypeUID)
|
||||
.withProperties(properties).withRepresentationProperty("url").withLabel(label)
|
||||
.withBridge(localBridgeHandler.getThing().getUID()).build());
|
||||
}
|
||||
}
|
||||
|
||||
private void actionGroupDiscovered(String label, String deviceURL, String oid) {
|
||||
deviceDiscovered(label, deviceURL, oid, THING_TYPE_ACTIONGROUP, false);
|
||||
}
|
||||
|
||||
private void gatewayDiscovered(SomfyTahomaGateway gw) {
|
||||
Map<String, Object> properties = new HashMap<>(1);
|
||||
String type = gatewayTypes.getOrDefault(gw.getType(), "UNKNOWN");
|
||||
String id = gw.getGatewayId();
|
||||
properties.put("id", id);
|
||||
properties.put("type", type);
|
||||
|
||||
SomfyTahomaBridgeHandler localBridgeHandler = bridgeHandler;
|
||||
if (localBridgeHandler != null) {
|
||||
ThingUID thingUID = new ThingUID(THING_TYPE_GATEWAY, localBridgeHandler.getThing().getUID(), id);
|
||||
|
||||
logger.debug("Detected a gateway with id: {} and type: {}", id, type);
|
||||
thingDiscovered(
|
||||
DiscoveryResultBuilder.create(thingUID).withThingType(THING_TYPE_GATEWAY).withProperties(properties)
|
||||
.withRepresentationProperty("id").withLabel("Somfy Gateway (" + type + ")")
|
||||
.withBridge(localBridgeHandler.getThing().getUID()).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.EXECUTE_ACTION;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaActionGroupHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the action group thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaActionGroupHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaActionGroupHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isAlwaysOnline() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (EXECUTE_ACTION.equals(channelUID.getId()) && command instanceof OnOffType) {
|
||||
if (OnOffType.ON.equals(command)) {
|
||||
executeActionGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.somfytahoma.internal.model.SomfyTahomaState;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.openhab.core.types.State;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaAdjustableSlatsRollerShutterHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the adjustable slats roller shutter thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaAdjustableSlatsRollerShutterHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaAdjustableSlatsRollerShutterHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTROL, CLOSURE_OR_ROCKER_STATE);
|
||||
stateNames.put(ROCKER, CLOSURE_OR_ROCKER_STATE);
|
||||
stateNames.put(ORIENTATION, SLATE_ORIENTATION_STATE);
|
||||
// override state type because the control may return string 'rocker'
|
||||
cacheStateType(CONTROL, TYPE_PERCENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThingChannels(SomfyTahomaState state) {
|
||||
if (CLOSURE_OR_ROCKER_STATE.equals(state.getName())) {
|
||||
Channel ch = thing.getChannel(CONTROL);
|
||||
Channel chRocker = thing.getChannel(ROCKER);
|
||||
if ("rocker".equals(state.getValue())) {
|
||||
if (chRocker != null) {
|
||||
updateState(chRocker.getUID(), OnOffType.ON);
|
||||
}
|
||||
} else {
|
||||
if (chRocker != null) {
|
||||
updateState(chRocker.getUID(), OnOffType.OFF);
|
||||
}
|
||||
if (ch != null) {
|
||||
State newState = parseTahomaState(state);
|
||||
if (newState != null) {
|
||||
updateState(ch.getUID(), newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (SLATE_ORIENTATION_STATE.equals(state.getName())) {
|
||||
Channel ch = thing.getChannel(ORIENTATION);
|
||||
if (ch != null) {
|
||||
State newState = parseTahomaState(state);
|
||||
if (newState != null) {
|
||||
updateState(ch.getUID(), newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (channelUID.getId()) {
|
||||
case ROCKER:
|
||||
if (OnOffType.ON.equals(command)) {
|
||||
sendCommand(COMMAND_SET_ROCKERPOSITION);
|
||||
}
|
||||
break;
|
||||
case CLOSURE_AND_ORIENTATION:
|
||||
sendCommand(COMMAND_SET_CLOSURE_ORIENTATION, "[" + command.toString() + "]");
|
||||
break;
|
||||
case CONTROL:
|
||||
case ORIENTATION:
|
||||
String cmd = getTahomaCommand(command.toString(), channelUID.getId());
|
||||
if (COMMAND_SET_ROCKERPOSITION.equals(cmd)) {
|
||||
String executionId = getCurrentExecutions();
|
||||
if (executionId != null) {
|
||||
// Check if the roller shutter is moving and rocker is sent => STOP it
|
||||
cancelExecution(executionId);
|
||||
} else {
|
||||
sendCommand(COMMAND_SET_ROCKERPOSITION);
|
||||
}
|
||||
} else {
|
||||
String param = (COMMAND_SET_CLOSURE.equals(cmd) || COMMAND_SET_ORIENTATION.equals(cmd))
|
||||
? "[" + toInteger(command) + "]"
|
||||
: "[]";
|
||||
sendCommand(cmd, param);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getTahomaCommand(String command, String channelId) {
|
||||
switch (command) {
|
||||
case "OFF":
|
||||
case "DOWN":
|
||||
case "CLOSE":
|
||||
return COMMAND_DOWN;
|
||||
case "ON":
|
||||
case "UP":
|
||||
case "OPEN":
|
||||
return COMMAND_UP;
|
||||
case "STOP":
|
||||
return COMMAND_SET_ROCKERPOSITION;
|
||||
default:
|
||||
if (CONTROL.equals(channelId)) {
|
||||
return COMMAND_SET_CLOSURE;
|
||||
} else {
|
||||
return COMMAND_SET_ORIENTATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaAwningHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the awning thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaAwningHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaAwningHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTROL, "core:DeploymentState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (!CONTROL.equals(channelUID.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
String cmd = getTahomaCommand(command.toString());
|
||||
if (COMMAND_MY.equals(cmd)) {
|
||||
sendCommand(COMMAND_MY);
|
||||
} else if (COMMAND_STOP.equals(cmd)) {
|
||||
String executionId = getCurrentExecutions();
|
||||
if (executionId != null) {
|
||||
// Check if the awning is moving and STOP is sent => STOP it
|
||||
cancelExecution(executionId);
|
||||
} else {
|
||||
sendCommand(COMMAND_MY);
|
||||
}
|
||||
} else {
|
||||
String param = COMMAND_SET_DEPLOYMENT.equals(cmd) ? "[" + toInteger(command) + "]" : "[]";
|
||||
sendCommand(cmd, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getTahomaCommand(String command) {
|
||||
switch (command) {
|
||||
case "OFF":
|
||||
case "DOWN":
|
||||
return COMMAND_DOWN;
|
||||
case "ON":
|
||||
case "UP":
|
||||
return COMMAND_UP;
|
||||
case "MOVE":
|
||||
case "MY":
|
||||
return COMMAND_MY;
|
||||
case "STOP":
|
||||
return COMMAND_STOP;
|
||||
default:
|
||||
return COMMAND_SET_DEPLOYMENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.somfytahoma.internal.model.SomfyTahomaState;
|
||||
import org.openhab.binding.somfytahoma.internal.model.SomfyTahomaStatus;
|
||||
import org.openhab.core.library.types.*;
|
||||
import org.openhab.core.thing.*;
|
||||
import org.openhab.core.thing.binding.BaseThingHandler;
|
||||
import org.openhab.core.thing.binding.builder.ChannelBuilder;
|
||||
import org.openhab.core.thing.binding.builder.ThingBuilder;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.openhab.core.types.State;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaBaseThingHandler} is base thing handler for all things.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public abstract class SomfyTahomaBaseThingHandler extends BaseThingHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private HashMap<String, Integer> typeTable = new HashMap<>();
|
||||
protected HashMap<String, String> stateNames = new HashMap<>();
|
||||
|
||||
public SomfyTahomaBaseThingHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
public HashMap<String, String> getStateNames() {
|
||||
return stateNames;
|
||||
}
|
||||
|
||||
private String url = "";
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
url = getURL();
|
||||
if (getThing().getProperties().containsKey(RSSI_LEVEL_STATE)) {
|
||||
createRSSIChannel();
|
||||
}
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
|
||||
private void createRSSIChannel() {
|
||||
if (thing.getChannel(RSSI) == null) {
|
||||
logger.debug("{} Creating a rssi channel", url);
|
||||
createChannel(RSSI, "Number", "RSSI Level");
|
||||
}
|
||||
}
|
||||
|
||||
private void createChannel(String name, String type, String label) {
|
||||
ThingBuilder thingBuilder = editThing();
|
||||
Channel channel = ChannelBuilder.create(new ChannelUID(thing.getUID(), name), type).withLabel(label).build();
|
||||
thingBuilder.withChannel(channel);
|
||||
updateThing(thingBuilder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
logger.debug("{} Received command {} for channel {}", url, command, channelUID);
|
||||
if (command instanceof RefreshType) {
|
||||
refresh(channelUID.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
return logger;
|
||||
}
|
||||
|
||||
protected boolean isAlwaysOnline() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected @Nullable SomfyTahomaBridgeHandler getBridgeHandler() {
|
||||
return this.getBridge() != null ? (SomfyTahomaBridgeHandler) this.getBridge().getHandler() : null;
|
||||
}
|
||||
|
||||
private String getURL() {
|
||||
return getThing().getConfiguration().get("url") != null ? getThing().getConfiguration().get("url").toString()
|
||||
: "";
|
||||
}
|
||||
|
||||
private void setAvailable() {
|
||||
if (ThingStatus.ONLINE != thing.getStatus()) {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
}
|
||||
|
||||
private void setUnavailable() {
|
||||
if (ThingStatus.OFFLINE != thing.getStatus() && !isAlwaysOnline()) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendCommand(String cmd) {
|
||||
sendCommand(cmd, "[]");
|
||||
}
|
||||
|
||||
protected void sendCommand(String cmd, String param) {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
handler.sendCommand(url, cmd, param);
|
||||
}
|
||||
}
|
||||
|
||||
protected void refresh(String channel) {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null && stateNames.containsKey(channel)) {
|
||||
handler.refresh(url, stateNames.get(channel));
|
||||
}
|
||||
}
|
||||
|
||||
protected void executeActionGroup() {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
handler.executeActionGroup(url);
|
||||
}
|
||||
}
|
||||
|
||||
protected @Nullable String getCurrentExecutions() {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
return handler.getCurrentExecutions(url);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void cancelExecution(String executionId) {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
handler.cancelExecution(executionId);
|
||||
}
|
||||
}
|
||||
|
||||
protected SomfyTahomaStatus getTahomaStatus(String id) {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
return handler.getTahomaStatus(id);
|
||||
}
|
||||
return new SomfyTahomaStatus();
|
||||
}
|
||||
|
||||
private void cacheStateType(SomfyTahomaState state) {
|
||||
if (state.getType() > 0 && !typeTable.containsKey(state.getName())) {
|
||||
typeTable.put(state.getName(), state.getType());
|
||||
}
|
||||
}
|
||||
|
||||
protected void cacheStateType(String stateName, int type) {
|
||||
if (type > 0 && !typeTable.containsKey(stateName)) {
|
||||
typeTable.put(stateName, type);
|
||||
}
|
||||
}
|
||||
|
||||
protected @Nullable State parseTahomaState(@Nullable SomfyTahomaState state) {
|
||||
return parseTahomaState(null, state);
|
||||
}
|
||||
|
||||
protected @Nullable State parseTahomaState(@Nullable String acceptedState, @Nullable SomfyTahomaState state) {
|
||||
if (state == null) {
|
||||
return UnDefType.NULL;
|
||||
}
|
||||
|
||||
int type = state.getType();
|
||||
|
||||
try {
|
||||
if (typeTable.containsKey(state.getName())) {
|
||||
type = typeTable.get(state.getName());
|
||||
} else {
|
||||
cacheStateType(state);
|
||||
}
|
||||
|
||||
if (type == 0) {
|
||||
logger.debug("{} Cannot recognize the state type for: {}!", url, state.getValue());
|
||||
return null;
|
||||
}
|
||||
|
||||
logger.trace("Value to parse: {}, type: {}", state.getValue(), type);
|
||||
switch (type) {
|
||||
case TYPE_PERCENT:
|
||||
Double valPct = Double.parseDouble(state.getValue().toString());
|
||||
return new PercentType(normalizePercent(valPct));
|
||||
case TYPE_DECIMAL:
|
||||
Double valDec = Double.parseDouble(state.getValue().toString());
|
||||
return new DecimalType(valDec);
|
||||
case TYPE_STRING:
|
||||
case TYPE_BOOLEAN:
|
||||
String value = state.getValue().toString();
|
||||
if ("String".equals(acceptedState)) {
|
||||
return new StringType(value);
|
||||
} else {
|
||||
return parseStringState(value);
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} catch (IllegalArgumentException ex) {
|
||||
logger.debug("{} Error while parsing Tahoma state! Value: {} type: {}", url, state.getValue(), type, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private int normalizePercent(Double valPct) {
|
||||
int value = valPct.intValue();
|
||||
if (value < 0) {
|
||||
value = 0;
|
||||
} else if (value > 100) {
|
||||
value = 100;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private State parseStringState(String value) {
|
||||
if (value.endsWith("%")) {
|
||||
// convert "100%" to 100 decimal
|
||||
String val = value.replace("%", "");
|
||||
logger.trace("converting: {} to value: {}", value, val);
|
||||
Double valDec = Double.parseDouble(val);
|
||||
return new DecimalType(valDec);
|
||||
}
|
||||
switch (value.toLowerCase()) {
|
||||
case "on":
|
||||
case "true":
|
||||
return OnOffType.ON;
|
||||
case "off":
|
||||
case "false":
|
||||
return OnOffType.OFF;
|
||||
case "notdetected":
|
||||
case "nopersoninside":
|
||||
case "closed":
|
||||
case "locked":
|
||||
return OpenClosedType.CLOSED;
|
||||
case "detected":
|
||||
case "personinside":
|
||||
case "open":
|
||||
case "opened":
|
||||
case "unlocked":
|
||||
return OpenClosedType.OPEN;
|
||||
case "unknown":
|
||||
return UnDefType.UNDEF;
|
||||
default:
|
||||
logger.debug("{} Unknown thing state returned: {}", url, value);
|
||||
return UnDefType.UNDEF;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateThingStatus(List<SomfyTahomaState> states) {
|
||||
SomfyTahomaState state = getStatusState(states);
|
||||
updateThingStatus(state);
|
||||
}
|
||||
|
||||
private @Nullable SomfyTahomaState getStatusState(List<SomfyTahomaState> states) {
|
||||
for (SomfyTahomaState state : states) {
|
||||
if (STATUS_STATE.equals(state.getName()) && state.getType() == TYPE_STRING) {
|
||||
return state;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void updateThingStatus(@Nullable SomfyTahomaState state) {
|
||||
if (state == null) {
|
||||
// Most probably we are dealing with RTS device which does not return states
|
||||
// so we have to setup ONLINE status manually
|
||||
setAvailable();
|
||||
return;
|
||||
}
|
||||
if (STATUS_STATE.equals(state.getName()) && state.getType() == TYPE_STRING) {
|
||||
if (UNAVAILABLE.equals(state.getValue())) {
|
||||
setUnavailable();
|
||||
} else {
|
||||
setAvailable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateThingChannels(List<SomfyTahomaState> states) {
|
||||
Map<String, String> properties = new HashMap<>();
|
||||
for (SomfyTahomaState state : states) {
|
||||
logger.trace("{} processing state: {} with value: {}", url, state.getName(), state.getValue());
|
||||
properties.put(state.getName(), state.getValue().toString());
|
||||
if (RSSI_LEVEL_STATE.equals(state.getName())) {
|
||||
// RSSI channel is a dynamic one
|
||||
updateRSSIChannel(state);
|
||||
} else {
|
||||
updateThingChannels(state);
|
||||
}
|
||||
}
|
||||
updateProperties(properties);
|
||||
}
|
||||
|
||||
private void updateRSSIChannel(SomfyTahomaState state) {
|
||||
createRSSIChannel();
|
||||
Channel ch = thing.getChannel(RSSI);
|
||||
if (ch != null) {
|
||||
logger.debug("{} updating RSSI channel with value: {}", url, state.getValue());
|
||||
State newState = parseTahomaState(ch.getAcceptedItemType(), state);
|
||||
if (newState != null) {
|
||||
updateState(ch.getUID(), newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateThingChannels(SomfyTahomaState state) {
|
||||
stateNames.forEach((k, v) -> {
|
||||
if (v.equals(state.getName())) {
|
||||
Channel ch = thing.getChannel(k);
|
||||
if (ch != null) {
|
||||
logger.debug("{} updating channel: {} with value: {}", url, k, state.getValue());
|
||||
State newState = parseTahomaState(ch.getAcceptedItemType(), state);
|
||||
if (newState != null) {
|
||||
updateState(ch.getUID(), newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int toInteger(Command command) {
|
||||
return (command instanceof DecimalType) ? ((DecimalType) command).intValue() : 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,940 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.api.ContentResponse;
|
||||
import org.eclipse.jetty.client.api.Request;
|
||||
import org.eclipse.jetty.client.util.StringContentProvider;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
import org.openhab.binding.somfytahoma.internal.config.SomfyTahomaConfig;
|
||||
import org.openhab.binding.somfytahoma.internal.discovery.SomfyTahomaItemDiscoveryService;
|
||||
import org.openhab.binding.somfytahoma.internal.model.*;
|
||||
import org.openhab.core.io.net.http.HttpClientFactory;
|
||||
import org.openhab.core.thing.*;
|
||||
import org.openhab.core.thing.binding.BaseBridgeHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerService;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaBridgeHandler} is responsible for handling commands, which are
|
||||
* sent to one of the channels.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaBridgeHandler extends BaseBridgeHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(SomfyTahomaBridgeHandler.class);
|
||||
|
||||
/**
|
||||
* The shared HttpClient
|
||||
*/
|
||||
private final HttpClient httpClient;
|
||||
|
||||
/**
|
||||
* Future to poll for updates
|
||||
*/
|
||||
private @Nullable ScheduledFuture<?> pollFuture;
|
||||
|
||||
/**
|
||||
* Future to poll for status
|
||||
*/
|
||||
private @Nullable ScheduledFuture<?> statusFuture;
|
||||
|
||||
/**
|
||||
* Future to set reconciliation flag
|
||||
*/
|
||||
private @Nullable ScheduledFuture<?> reconciliationFuture;
|
||||
|
||||
/**
|
||||
* List of executions
|
||||
*/
|
||||
private Map<String, String> executions = new HashMap<>();
|
||||
|
||||
// Too many requests flag
|
||||
private boolean tooManyRequests = false;
|
||||
|
||||
// Silent relogin flag
|
||||
private boolean reLoginNeeded = false;
|
||||
|
||||
// Reconciliation flag
|
||||
private boolean reconciliation = false;
|
||||
|
||||
/**
|
||||
* Our configuration
|
||||
*/
|
||||
protected SomfyTahomaConfig thingConfig = new SomfyTahomaConfig();
|
||||
|
||||
/**
|
||||
* Id of registered events
|
||||
*/
|
||||
private String eventsId = "";
|
||||
|
||||
// Gson & parser
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public SomfyTahomaBridgeHandler(Bridge thing, HttpClientFactory httpClientFactory) {
|
||||
super(thing);
|
||||
this.httpClient = httpClientFactory.createHttpClient("somfy_" + thing.getUID().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
thingConfig = getConfigAs(SomfyTahomaConfig.class);
|
||||
|
||||
try {
|
||||
httpClient.start();
|
||||
} catch (Exception e) {
|
||||
logger.debug("Cannot start http client for: {}", thing.getBridgeUID().getId(), e);
|
||||
return;
|
||||
}
|
||||
|
||||
scheduler.execute(() -> {
|
||||
login();
|
||||
initPolling();
|
||||
logger.debug("Initialize done...");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* starts this things polling future
|
||||
*/
|
||||
private void initPolling() {
|
||||
stopPolling();
|
||||
pollFuture = scheduler.scheduleWithFixedDelay(() -> {
|
||||
getTahomaUpdates();
|
||||
}, 10, thingConfig.getRefresh(), TimeUnit.SECONDS);
|
||||
|
||||
statusFuture = scheduler.scheduleWithFixedDelay(() -> {
|
||||
refreshTahomaStates();
|
||||
}, 60, thingConfig.getStatusTimeout(), TimeUnit.SECONDS);
|
||||
|
||||
reconciliationFuture = scheduler.scheduleWithFixedDelay(() -> {
|
||||
enableReconciliation();
|
||||
}, RECONCILIATION_TIME, RECONCILIATION_TIME, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public synchronized void login() {
|
||||
String url;
|
||||
|
||||
if (StringUtils.isEmpty(thingConfig.getEmail()) || StringUtils.isEmpty(thingConfig.getPassword())) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"Can not access device as username and/or password are null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tooManyRequests) {
|
||||
logger.debug("Skipping login due to too many requests");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ThingStatus.ONLINE == thing.getStatus() && !reLoginNeeded) {
|
||||
logger.debug("No need to log in, because already logged in");
|
||||
return;
|
||||
}
|
||||
|
||||
reLoginNeeded = false;
|
||||
|
||||
try {
|
||||
url = TAHOMA_API_URL + "login";
|
||||
String urlParameters = "userId=" + urlEncode(thingConfig.getEmail()) + "&userPassword="
|
||||
+ urlEncode(thingConfig.getPassword());
|
||||
|
||||
ContentResponse response = sendRequestBuilder(url, HttpMethod.POST)
|
||||
.content(new StringContentProvider(urlParameters),
|
||||
"application/x-www-form-urlencoded; charset=UTF-8")
|
||||
.send();
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Login response: {}", response.getContentAsString());
|
||||
}
|
||||
|
||||
SomfyTahomaLoginResponse data = gson.fromJson(response.getContentAsString(),
|
||||
SomfyTahomaLoginResponse.class);
|
||||
if (data.isSuccess()) {
|
||||
logger.debug("SomfyTahoma version: {}", data.getVersion());
|
||||
String id = registerEvents();
|
||||
if (id != null && !id.equals(UNAUTHORIZED)) {
|
||||
eventsId = id;
|
||||
logger.debug("Events id: {}", eventsId);
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
} else {
|
||||
logger.debug("Events id error: {}", id);
|
||||
}
|
||||
} else {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"Error logging in: " + data.getError());
|
||||
if (data.getError().startsWith(TOO_MANY_REQUESTS)) {
|
||||
setTooManyRequests();
|
||||
}
|
||||
}
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received invalid data", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
if (e instanceof ExecutionException) {
|
||||
if (e.getMessage().contains(AUTHENTICATION_CHALLENGE)) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
|
||||
"Authentication challenge");
|
||||
setTooManyRequests();
|
||||
return;
|
||||
}
|
||||
}
|
||||
logger.debug("Cannot get login cookie!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Cannot get login cookie");
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.debug("Cannot login due to unsupported encoding", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Unsupported encoding");
|
||||
}
|
||||
}
|
||||
|
||||
private void setTooManyRequests() {
|
||||
logger.debug("Too many requests error, suspending activity for {} seconds", SUSPEND_TIME);
|
||||
tooManyRequests = true;
|
||||
scheduler.schedule(this::enableLogin, SUSPEND_TIME, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private @Nullable String registerEvents() {
|
||||
String url;
|
||||
|
||||
try {
|
||||
url = TAHOMA_EVENTS_URL + "register";
|
||||
|
||||
String line = sendPostToTahomaWithCookie(url, "");
|
||||
SomfyTahomaRegisterEventsResponse response = gson.fromJson(line, SomfyTahomaRegisterEventsResponse.class);
|
||||
return response.getId();
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received invalid data", e);
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
return UNAUTHORIZED;
|
||||
} else {
|
||||
logger.info("Cannot register events!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.info("Cannot register events!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String urlEncode(String text) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(text, StandardCharsets.UTF_8.toString());
|
||||
}
|
||||
|
||||
private void enableLogin() {
|
||||
tooManyRequests = false;
|
||||
}
|
||||
|
||||
private List<SomfyTahomaEvent> getEvents() {
|
||||
String url;
|
||||
String line = "";
|
||||
|
||||
try {
|
||||
url = TAHOMA_API_URL + "events/" + eventsId + "/fetch";
|
||||
|
||||
line = sendPostToTahomaWithCookie(url, "");
|
||||
SomfyTahomaEvent[] array = gson.fromJson(line, SomfyTahomaEvent[].class);
|
||||
return new ArrayList<>(Arrays.asList(array));
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", line, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
} else {
|
||||
logger.debug("Cannot get Tahoma events!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot get Tahoma events!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRemoval() {
|
||||
super.handleRemoval();
|
||||
logout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Class<? extends ThingHandlerService>> getServices() {
|
||||
return Collections.singleton(SomfyTahomaItemDiscoveryService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
cleanup();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
private void cleanup() {
|
||||
logger.debug("Doing cleanup");
|
||||
stopPolling();
|
||||
executions.clear();
|
||||
try {
|
||||
httpClient.stop();
|
||||
} catch (Exception e) {
|
||||
logger.debug("Error during http client stopping", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
|
||||
super.bridgeStatusChanged(bridgeStatusInfo);
|
||||
if (ThingStatus.UNINITIALIZED == bridgeStatusInfo.getStatus()) {
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops this thing's polling future
|
||||
*/
|
||||
private void stopPolling() {
|
||||
ScheduledFuture<?> localPollFuture = pollFuture;
|
||||
if (localPollFuture != null && !localPollFuture.isCancelled()) {
|
||||
localPollFuture.cancel(true);
|
||||
}
|
||||
ScheduledFuture<?> localStatusFuture = statusFuture;
|
||||
if (localStatusFuture != null && !localStatusFuture.isCancelled()) {
|
||||
localStatusFuture.cancel(true);
|
||||
}
|
||||
ScheduledFuture<?> localReconciliationFuture = reconciliationFuture;
|
||||
if (localReconciliationFuture != null && !localReconciliationFuture.isCancelled()) {
|
||||
localReconciliationFuture.cancel(true);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SomfyTahomaActionGroup> listActionGroups() {
|
||||
String groups = getGroups();
|
||||
if (StringUtils.equals(groups, UNAUTHORIZED)) {
|
||||
groups = getGroups();
|
||||
}
|
||||
|
||||
if (groups == null || groups.equals(UNAUTHORIZED)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
try {
|
||||
SomfyTahomaActionGroup[] list = gson.fromJson(groups, SomfyTahomaActionGroup[].class);
|
||||
return Arrays.asList(list);
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", groups, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
private @Nullable String getGroups() {
|
||||
String url;
|
||||
|
||||
try {
|
||||
url = TAHOMA_API_URL + "actionGroups";
|
||||
return sendGetToTahomaWithCookie(url);
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
return UNAUTHORIZED;
|
||||
} else {
|
||||
logger.debug("Cannot send getActionGroups command!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot send getActionGroups command!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public @Nullable SomfyTahomaSetup getSetup() {
|
||||
String url;
|
||||
String line = "";
|
||||
|
||||
try {
|
||||
url = TAHOMA_API_URL + "setup";
|
||||
line = sendGetToTahomaWithCookie(url);
|
||||
return gson.fromJson(line, SomfyTahomaSetup.class);
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", line, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
} else {
|
||||
logger.debug("Cannot send getSetup command!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot send getSetup command!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SomfyTahomaDevice> getDevices() {
|
||||
String url;
|
||||
String line = "";
|
||||
|
||||
try {
|
||||
url = SETUP_URL + "devices";
|
||||
line = sendGetToTahomaWithCookie(url);
|
||||
return Arrays.asList(gson.fromJson(line, SomfyTahomaDevice[].class));
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", line, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
} else {
|
||||
logger.debug("Cannot send get devices command!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot send get devices command!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private void getTahomaUpdates() {
|
||||
logger.debug("Getting Tahoma Updates...");
|
||||
if (ThingStatus.OFFLINE == thing.getStatus() && !reLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<SomfyTahomaEvent> events = getEvents();
|
||||
logger.trace("Got total of {} events", events.size());
|
||||
for (SomfyTahomaEvent event : events) {
|
||||
processEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
private void processEvent(SomfyTahomaEvent event) {
|
||||
logger.debug("Got event: {}", event.getName());
|
||||
switch (event.getName()) {
|
||||
case "ExecutionRegisteredEvent":
|
||||
processExecutionRegisteredEvent(event);
|
||||
break;
|
||||
case "ExecutionStateChangedEvent":
|
||||
processExecutionChangedEvent(event);
|
||||
break;
|
||||
case "DeviceStateChangedEvent":
|
||||
processStateChangedEvent(event);
|
||||
break;
|
||||
case "RefreshAllDevicesStatesCompletedEvent":
|
||||
scheduler.schedule(this::updateThings, 1, TimeUnit.SECONDS);
|
||||
break;
|
||||
case "GatewayAliveEvent":
|
||||
case "GatewayDownEvent":
|
||||
processGatewayEvent(event);
|
||||
break;
|
||||
default:
|
||||
// ignore other states
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void updateThings() {
|
||||
boolean needsUpdate = reconciliation;
|
||||
|
||||
for (Thing th : getThing().getThings()) {
|
||||
if (ThingStatus.ONLINE != th.getStatus()) {
|
||||
needsUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
// update all states only if necessary
|
||||
if (needsUpdate) {
|
||||
updateAllStates();
|
||||
reconciliation = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void processExecutionRegisteredEvent(SomfyTahomaEvent event) {
|
||||
JsonElement el = event.getAction();
|
||||
if (el.isJsonArray()) {
|
||||
SomfyTahomaAction[] actions = gson.fromJson(el, SomfyTahomaAction[].class);
|
||||
for (SomfyTahomaAction action : actions) {
|
||||
registerExecution(action.getDeviceURL(), event.getExecId());
|
||||
}
|
||||
} else {
|
||||
SomfyTahomaAction action = gson.fromJson(el, SomfyTahomaAction.class);
|
||||
registerExecution(action.getDeviceURL(), event.getExecId());
|
||||
}
|
||||
}
|
||||
|
||||
private void processExecutionChangedEvent(SomfyTahomaEvent event) {
|
||||
if (FAILED_EVENT.equals(event.getNewState()) || COMPLETED_EVENT.equals(event.getNewState())) {
|
||||
logger.debug("Removing execution id: {}", event.getExecId());
|
||||
unregisterExecution(event.getExecId());
|
||||
}
|
||||
}
|
||||
|
||||
private void registerExecution(String url, String execId) {
|
||||
if (executions.containsKey(url)) {
|
||||
executions.remove(url);
|
||||
logger.debug("Previous execution exists for url: {}", url);
|
||||
}
|
||||
executions.put(url, execId);
|
||||
}
|
||||
|
||||
private void unregisterExecution(String execId) {
|
||||
if (executions.containsValue(execId)) {
|
||||
executions.values().removeAll(Collections.singleton(execId));
|
||||
} else {
|
||||
logger.debug("Cannot remove execution id: {}, because it is not registered", execId);
|
||||
}
|
||||
}
|
||||
|
||||
private void processGatewayEvent(SomfyTahomaEvent event) {
|
||||
// update gateway status
|
||||
for (Thing th : getThing().getThings()) {
|
||||
if (THING_TYPE_GATEWAY.equals(th.getThingTypeUID())) {
|
||||
SomfyTahomaGatewayHandler gatewayHandler = (SomfyTahomaGatewayHandler) th.getHandler();
|
||||
if (gatewayHandler != null && gatewayHandler.getGateWayId().equals(event.getGatewayId())) {
|
||||
gatewayHandler.refresh(STATUS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void updateAllStates() {
|
||||
logger.debug("Updating all states");
|
||||
getDevices().forEach(device -> updateDevice(device));
|
||||
}
|
||||
|
||||
private void updateDevice(SomfyTahomaDevice device) {
|
||||
String url = device.getDeviceURL();
|
||||
List<SomfyTahomaState> states = device.getStates();
|
||||
updateDevice(url, states);
|
||||
}
|
||||
|
||||
private void updateDevice(String url, List<SomfyTahomaState> states) {
|
||||
Thing th = getThingByDeviceUrl(url);
|
||||
if (th == null) {
|
||||
return;
|
||||
}
|
||||
SomfyTahomaBaseThingHandler handler = (SomfyTahomaBaseThingHandler) th.getHandler();
|
||||
if (handler != null) {
|
||||
handler.updateThingStatus(states);
|
||||
handler.updateThingChannels(states);
|
||||
}
|
||||
}
|
||||
|
||||
private void processStateChangedEvent(SomfyTahomaEvent event) {
|
||||
String deviceUrl = event.getDeviceUrl();
|
||||
List<SomfyTahomaState> states = event.getDeviceStates();
|
||||
logger.debug("States for device {} : {}", deviceUrl, states);
|
||||
Thing thing = getThingByDeviceUrl(deviceUrl);
|
||||
|
||||
if (thing != null) {
|
||||
logger.debug("Updating status of thing: {}", thing.getLabel());
|
||||
SomfyTahomaBaseThingHandler handler = (SomfyTahomaBaseThingHandler) thing.getHandler();
|
||||
|
||||
if (handler != null) {
|
||||
// update thing status
|
||||
handler.updateThingStatus(states);
|
||||
handler.updateThingChannels(states);
|
||||
}
|
||||
} else {
|
||||
logger.debug("Thing handler is null, probably not bound thing.");
|
||||
}
|
||||
}
|
||||
|
||||
private void enableReconciliation() {
|
||||
logger.debug("Enabling reconciliation");
|
||||
reconciliation = true;
|
||||
}
|
||||
|
||||
private void refreshTahomaStates() {
|
||||
logger.debug("Refreshing Tahoma states...");
|
||||
if (ThingStatus.OFFLINE == thing.getStatus() && !reLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// force Tahoma to ask for actual states
|
||||
forceGatewaySync();
|
||||
}
|
||||
|
||||
private @Nullable Thing getThingByDeviceUrl(String deviceUrl) {
|
||||
for (Thing th : getThing().getThings()) {
|
||||
String url = (String) th.getConfiguration().get("url");
|
||||
if (deviceUrl.equals(url)) {
|
||||
return th;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void logout() {
|
||||
try {
|
||||
eventsId = "";
|
||||
sendGetToTahomaWithCookie(TAHOMA_API_URL + "logout");
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
logger.debug("Cannot send logout command!", e);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String sendPostToTahomaWithCookie(String url, String urlParameters)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return sendMethodToTahomaWithCookie(url, HttpMethod.POST, urlParameters);
|
||||
}
|
||||
|
||||
private String sendGetToTahomaWithCookie(String url)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return sendMethodToTahomaWithCookie(url, HttpMethod.GET);
|
||||
}
|
||||
|
||||
private String sendPutToTahomaWithCookie(String url)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return sendMethodToTahomaWithCookie(url, HttpMethod.PUT);
|
||||
}
|
||||
|
||||
private String sendDeleteToTahomaWithCookie(String url)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return sendMethodToTahomaWithCookie(url, HttpMethod.DELETE);
|
||||
}
|
||||
|
||||
private String sendMethodToTahomaWithCookie(String url, HttpMethod method)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
return sendMethodToTahomaWithCookie(url, method, "");
|
||||
}
|
||||
|
||||
private String sendMethodToTahomaWithCookie(String url, HttpMethod method, String urlParameters)
|
||||
throws InterruptedException, ExecutionException, TimeoutException {
|
||||
logger.trace("Sending {} to url: {} with data: {}", method.asString(), url, urlParameters);
|
||||
Request request = sendRequestBuilder(url, method);
|
||||
if (StringUtils.isNotEmpty(urlParameters)) {
|
||||
request = request.content(new StringContentProvider(urlParameters), "application/json;charset=UTF-8");
|
||||
}
|
||||
|
||||
ContentResponse response = request.send();
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Response: {}", response.getContentAsString());
|
||||
}
|
||||
|
||||
if (response.getStatus() < 200 || response.getStatus() >= 300) {
|
||||
logger.debug("Received unexpected status code: {}", response.getStatus());
|
||||
}
|
||||
return response.getContentAsString();
|
||||
}
|
||||
|
||||
private Request sendRequestBuilder(String url, HttpMethod method) {
|
||||
return httpClient.newRequest(url).method(method).header(HttpHeader.ACCEPT_LANGUAGE, "en-US,en")
|
||||
.header(HttpHeader.ACCEPT_ENCODING, "gzip, deflate").header("X-Requested-With", "XMLHttpRequest")
|
||||
.timeout(TAHOMA_TIMEOUT, TimeUnit.SECONDS).agent(TAHOMA_AGENT);
|
||||
}
|
||||
|
||||
public void sendCommand(String io, String command, String params) {
|
||||
if (ThingStatus.OFFLINE == thing.getStatus() && !reLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Boolean result = sendCommandInternal(io, command, params);
|
||||
if (result != null && !result) {
|
||||
sendCommandInternal(io, command, params);
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable Boolean sendCommandInternal(String io, String command, String params) {
|
||||
String url;
|
||||
String line = "";
|
||||
|
||||
try {
|
||||
url = EXEC_URL + "apply";
|
||||
|
||||
String value = params.equals("[]") ? command : params.replace("\"", "");
|
||||
String urlParameters = "{\"label\":\"" + getThingLabelByURL(io) + " - " + value
|
||||
+ " - OH2\",\"actions\":[{\"deviceURL\":\"" + io + "\",\"commands\":[{\"name\":\"" + command
|
||||
+ "\",\"parameters\":" + params + "}]}]}";
|
||||
|
||||
line = sendPostToTahomaWithCookie(url, urlParameters);
|
||||
|
||||
SomfyTahomaApplyResponse data = gson.fromJson(line, SomfyTahomaApplyResponse.class);
|
||||
|
||||
if (!StringUtils.isEmpty(data.getExecId())) {
|
||||
logger.debug("Exec id: {}", data.getExecId());
|
||||
registerExecution(io, data.getExecId());
|
||||
} else {
|
||||
logger.warn("Apply command response: {}", line);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", line, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
return false;
|
||||
} else {
|
||||
logger.debug("Cannot send apply command {} with params {}!", command, params, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot send apply command {} with params {}!", command, params, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getThingLabelByURL(String io) {
|
||||
Thing th = getThingByDeviceUrl(io);
|
||||
if (th != null) {
|
||||
if (th.getProperties().containsKey(NAME_STATE)) {
|
||||
// Return label from Tahoma
|
||||
return th.getProperties().get(NAME_STATE).replace("\"", "");
|
||||
}
|
||||
// Return label from OH2
|
||||
String label = th.getLabel();
|
||||
return label != null ? label.replace("\"", "") : "";
|
||||
}
|
||||
return "null";
|
||||
}
|
||||
|
||||
public @Nullable String getCurrentExecutions(String io) {
|
||||
if (executions.containsKey(io)) {
|
||||
return executions.get(io);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void cancelExecution(String executionId) {
|
||||
Boolean result = cancelExecutionInternal(executionId);
|
||||
if (result != null && !result) {
|
||||
cancelExecutionInternal(executionId);
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable Boolean cancelExecutionInternal(String executionId) {
|
||||
String url;
|
||||
|
||||
try {
|
||||
url = DELETE_URL + executionId;
|
||||
sendDeleteToTahomaWithCookie(url);
|
||||
return true;
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
return false;
|
||||
} else {
|
||||
logger.debug("Cannot cancel execution!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot cancel execution!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void executeActionGroup(String id) {
|
||||
if (ThingStatus.OFFLINE == thing.getStatus() && !reLogin()) {
|
||||
return;
|
||||
}
|
||||
String execId = executeActionGroupInternal(id);
|
||||
if (UNAUTHORIZED.equals(execId)) {
|
||||
execId = executeActionGroupInternal(id);
|
||||
}
|
||||
if (!UNAUTHORIZED.equals(execId) && execId != null) {
|
||||
registerExecution(id, execId);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean reLogin() {
|
||||
logger.debug("Doing relogin");
|
||||
reLoginNeeded = true;
|
||||
login();
|
||||
return ThingStatus.OFFLINE != thing.getStatus();
|
||||
}
|
||||
|
||||
public @Nullable String executeActionGroupInternal(String id) {
|
||||
String line = "";
|
||||
try {
|
||||
String url = EXEC_URL + id;
|
||||
|
||||
line = sendPostToTahomaWithCookie(url, "");
|
||||
SomfyTahomaApplyResponse data = gson.fromJson(line, SomfyTahomaApplyResponse.class);
|
||||
if (data.getExecId().isEmpty()) {
|
||||
logger.debug("Got empty exec response");
|
||||
}
|
||||
return data.getExecId();
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", line, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
return UNAUTHORIZED;
|
||||
} else {
|
||||
logger.debug("Cannot exec execution group!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot exec execution group!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void forceGatewaySync() {
|
||||
try {
|
||||
sendPutToTahomaWithCookie(REFRESH_URL);
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
} else {
|
||||
logger.debug("Cannot sync gateway!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot sync gateway!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SomfyTahomaStatus getTahomaStatus(String gatewayId) {
|
||||
String line = "";
|
||||
try {
|
||||
String url = GATEWAYS_URL + gatewayId;
|
||||
line = sendGetToTahomaWithCookie(url);
|
||||
SomfyTahomaStatusResponse data = gson.fromJson(line, SomfyTahomaStatusResponse.class);
|
||||
logger.debug("Tahoma status: {}", data.getConnectivity().getStatus());
|
||||
logger.debug("Tahoma protocol version: {}", data.getConnectivity().getProtocolVersion());
|
||||
return data.getConnectivity();
|
||||
} catch (JsonSyntaxException e) {
|
||||
logger.debug("Received data: {} is not JSON", line, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Received invalid data");
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
return new SomfyTahomaStatus();
|
||||
} else {
|
||||
logger.debug("Cannot get Tahoma gateway status!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot get Tahoma gateway status!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
return new SomfyTahomaStatus();
|
||||
}
|
||||
|
||||
private boolean isAuthenticationChallenge(Exception ex) {
|
||||
return ex.getMessage().contains(AUTHENTICATION_CHALLENGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleConfigurationUpdate(Map<String, Object> configurationParameters) {
|
||||
super.handleConfigurationUpdate(configurationParameters);
|
||||
if (configurationParameters.containsKey("email")) {
|
||||
thingConfig.setEmail(configurationParameters.get("email").toString());
|
||||
}
|
||||
if (configurationParameters.containsKey("password")) {
|
||||
thingConfig.setPassword(configurationParameters.get("password").toString());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void refresh(String url, String stateName) {
|
||||
try {
|
||||
String line = sendGetToTahomaWithCookie(DEVICES_URL + urlEncode(url) + "/states/" + stateName);
|
||||
SomfyTahomaState state = gson.fromJson(line, SomfyTahomaState.class);
|
||||
if (StringUtils.isNotEmpty(state.getName())) {
|
||||
updateDevice(url, Arrays.asList(state));
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.debug("Unsupported encoding!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
} catch (ExecutionException e) {
|
||||
if (isAuthenticationChallenge(e)) {
|
||||
reLogin();
|
||||
} else {
|
||||
logger.debug("Cannot refresh device states!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
}
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
logger.debug("Cannot refresh device states!", e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
|
||||
if (e instanceof InterruptedException) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaContactSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the contact sensors.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaContactSensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaContactSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTACT, "core:ContactState");
|
||||
stateNames.put(SENSOR_DEFECT, SENSOR_DEFECT_STATE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaCurtainHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the curtain thing.
|
||||
*
|
||||
* @author Tobias Ammann - Initial contribution
|
||||
* @author Ondrej Pecta - Code optimization
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaCurtainHandler extends SomfyTahomaRollerShutterHandler {
|
||||
|
||||
public SomfyTahomaCurtainHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTahomaCommand(String command) {
|
||||
switch (command) {
|
||||
case "OFF":
|
||||
case "DOWN":
|
||||
case "CLOSE":
|
||||
return COMMAND_CLOSE;
|
||||
case "ON":
|
||||
case "UP":
|
||||
case "OPEN":
|
||||
return COMMAND_OPEN;
|
||||
case "MOVE":
|
||||
case "MY":
|
||||
return COMMAND_MY;
|
||||
case "STOP":
|
||||
return COMMAND_STOP;
|
||||
default:
|
||||
return COMMAND_SET_CLOSURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.LIGHT_INTENSITY;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDimmerLightHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the dimmer light thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDimmerLightHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaDimmerLightHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(LIGHT_INTENSITY, "core:LightIntensityState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else if (LIGHT_INTENSITY.equals(channelUID.getId())) {
|
||||
if (command instanceof OnOffType) {
|
||||
sendCommand(command.toString().toLowerCase());
|
||||
} else {
|
||||
sendCommand("setIntensity", "[" + toInteger(command) + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDockHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the dock thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDockHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaDockHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(BATTERY_STATUS, BATTERY_STATUS_STATE);
|
||||
stateNames.put(BATTERY_LEVEL, BATTERY_LEVEL_STATE);
|
||||
stateNames.put(SIREN_STATUS, SIREN_STATUS_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SIREN_STATUS.equals(channelUID.getId()) && command instanceof StringType) {
|
||||
sendCommand("siren", "[\"" + command.toString().toLowerCase() + "\"]");
|
||||
return;
|
||||
}
|
||||
if (SHORT_BIP.equals(channelUID.getId()) && OnOffType.ON.equals(command)) {
|
||||
sendCommand("shortBip", "[3]");
|
||||
return;
|
||||
}
|
||||
if (LONG_BIP.equals(channelUID.getId()) && OnOffType.ON.equals(command)) {
|
||||
sendCommand("longBip", "[3]");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.LOCK;
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.OPEN;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDoorLockHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the door lock thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDoorLockHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaDoorLockHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(OPEN, "core:OpenClosedState");
|
||||
stateNames.put(LOCK, "core:LockedUnlockedState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (OPEN.equals(channelUID.getId()) && command instanceof OnOffType) {
|
||||
sendCommand(command.equals(OnOffType.ON) ? "open" : "close");
|
||||
}
|
||||
if (LOCK.equals(channelUID.getId()) && command instanceof OnOffType) {
|
||||
sendCommand(command.equals(OnOffType.ON) ? "lock" : "unlock");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaElectricitySensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the electricity sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
public class SomfyTahomaElectricitySensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaElectricitySensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(ENERGY_CONSUMPTION, ENERGY_CONSUMPTION_STATE);
|
||||
// override state type because the cloud sends consumption in percent
|
||||
cacheStateType(ENERGY_CONSUMPTION_STATE, TYPE_DECIMAL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.HEATING_LEVEL;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.somfytahoma.internal.model.SomfyTahomaState;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.PercentType;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.openhab.core.types.State;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaExteriorHeatingSystemHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the exterior heating system thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaExteriorHeatingSystemHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaExteriorHeatingSystemHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThingChannels(SomfyTahomaState state) {
|
||||
if ("core:LevelState".equals(state.getName())) {
|
||||
Channel chLevel = thing.getChannel(HEATING_LEVEL);
|
||||
if (chLevel != null) {
|
||||
State newState = parseTahomaState(state);
|
||||
if (newState != null && newState instanceof PercentType) {
|
||||
int value = ((PercentType) newState).intValue();
|
||||
PercentType inverted = new PercentType(100 - value);
|
||||
updateState(chLevel.getUID(), inverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else if (HEATING_LEVEL.equals(channelUID.getId())) {
|
||||
if (command instanceof OnOffType) {
|
||||
sendCommand(command.toString().toLowerCase());
|
||||
} else {
|
||||
int inverted = 100 - toInteger(command);
|
||||
sendCommand("setLevel", "[" + inverted + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.ALARM_COMMAND;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaExternalAlarmHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the alarm thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaExternalAlarmHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaExternalAlarmHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put("active_zones_state", "core:ActiveZonesState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (ALARM_COMMAND.equals(channelUID.getId()) && command instanceof StringType) {
|
||||
sendCommand(command.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaGateHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the gate thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaGateHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaGateHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(GATE_STATE, "core:OpenClosedPedestrianState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
if (GATE_COMMAND.equals(channelUID.getId())) {
|
||||
sendCommand(getGateCommand(command.toString().toLowerCase()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getGateCommand(String command) {
|
||||
return "pedestrian".equals(command) ? COMMAND_SET_PEDESTRIANPOSITION : command;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.core.thing.Thing.PROPERTY_FIRMWARE_VERSION;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.somfytahoma.internal.model.SomfyTahomaStatus;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaGatewayHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the gateway thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaGatewayHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaGatewayHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(String channel) {
|
||||
String id = getGateWayId();
|
||||
SomfyTahomaStatus status = getTahomaStatus(id);
|
||||
String tahomaStatus = status.getStatus();
|
||||
Channel ch = thing.getChannel(channel);
|
||||
if (ch != null) {
|
||||
updateState(ch.getUID(), new StringType(tahomaStatus));
|
||||
}
|
||||
// update the firmware property
|
||||
String fw = status.getProtocolVersion();
|
||||
updateProperty(PROPERTY_FIRMWARE_VERSION, fw);
|
||||
|
||||
updateStatus("DISCONNECTED".equals(tahomaStatus) ? ThingStatus.OFFLINE : ThingStatus.ONLINE);
|
||||
}
|
||||
|
||||
public String getGateWayId() {
|
||||
return getThing().getConfiguration().get("id").toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaHeatingSystemHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the heating system thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaHeatingSystemHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaHeatingSystemHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(TARGET_TEMPERATURE, TARGET_TEMPERATURE_STATE);
|
||||
stateNames.put(CURRENT_TEMPERATURE, "zwave:SetPointHeatingValueState");
|
||||
stateNames.put(BATTERY_LEVEL, BATTERY_LEVEL_STATE);
|
||||
stateNames.put(CURRENT_STATE, "zwave:SetPointTypeState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
if (TARGET_TEMPERATURE.equals(channelUID.getId())) {
|
||||
String param = "[" + command.toString() + "]";
|
||||
sendCommand("setTargetTemperature", param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.HUMIDITY;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaHumiditySensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the humidity sensors.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaHumiditySensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaHumiditySensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(HUMIDITY, "core:RelativeHumidityState");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaInternalAlarmHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the alarm thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaInternalAlarmHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaInternalAlarmHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(ALARM_STATE, "internal:CurrentAlarmModeState");
|
||||
stateNames.put(TARGET_ALARM_STATE, "internal:TargetAlarmModeState");
|
||||
stateNames.put(INTRUSION_STATE, "internal:IntrusionDetectedState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (ALARM_COMMAND.equals(channelUID.getId()) && command instanceof StringType) {
|
||||
sendCommand(command.toString());
|
||||
}
|
||||
if (INTRUSION_CONTROL.equals(channelUID.getId()) && command instanceof StringType) {
|
||||
sendCommand("setIntrusionDetected", "[\"" + command.toString() + "\"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaLightSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the light sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaLightSensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaLightSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(LUMINANCE, "core:LuminanceState");
|
||||
stateNames.put(SENSOR_DEFECT, SENSOR_DEFECT_STATE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaMyfoxAlarmHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the Myfox alarm thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaMyfoxAlarmHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaMyfoxAlarmHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(ALARM_STATE, "myfox:AlarmStatusState");
|
||||
stateNames.put(INTRUSION_STATE, "core:IntrusionState");
|
||||
stateNames.put(CLOUD_STATUS, CLOUD_DEVICE_STATUS_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (MYFOX_ALARM_COMMAND.equals(channelUID.getId()) && command instanceof StringType) {
|
||||
sendCommand(command.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.somfytahoma.internal.model.SomfyTahomaState;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.openhab.core.types.State;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaMyfoxCameraHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the Myfox camera.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaMyfoxCameraHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaMyfoxCameraHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CLOUD_STATUS, CLOUD_DEVICE_STATUS_STATE);
|
||||
stateNames.put(SHUTTER, MYFOX_SHUTTER_STATUS_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThingChannels(SomfyTahomaState state) {
|
||||
if (MYFOX_SHUTTER_STATUS_STATE.equals(state.getName())) {
|
||||
Channel ch = thing.getChannel(SHUTTER);
|
||||
if (ch != null) {
|
||||
// we need to covert opened/closed values to ON/OFF
|
||||
boolean open = "opened".equals(state.getValue());
|
||||
updateState(ch.getUID(), open ? OnOffType.ON : OnOffType.OFF);
|
||||
}
|
||||
} else if (CLOUD_DEVICE_STATUS_STATE.equals(state.getName())) {
|
||||
Channel ch = thing.getChannel(CLOUD_STATUS);
|
||||
if (ch != null) {
|
||||
State newState = parseTahomaState(ch.getAcceptedItemType(), state);
|
||||
if (newState != null) {
|
||||
updateState(ch.getUID(), newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (!SHUTTER.equals(channelUID.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
if (command instanceof OnOffType) {
|
||||
sendCommand(command.equals(OnOffType.ON) ? "open" : "close");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaOccupancySensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the occupancy sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaOccupancySensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaOccupancySensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTACT, "core:OccupancyState");
|
||||
stateNames.put(SENSOR_DEFECT, SENSOR_DEFECT_STATE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.SWITCH;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaOnOffHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the on/off thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaOnOffHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaOnOffHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(SWITCH, "core:OnOffState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (SomfyTahomaBindingConstants.SWITCH.equals(channelUID.getId()) && command instanceof OnOffType) {
|
||||
sendCommand(command.toString().toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.COMMAND_SET_HEATINGLEVEL;
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.TARGET_HEATING_LEVEL;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaOnOffHeatingSystemHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the ON/OFF heating system thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaOnOffHeatingSystemHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaOnOffHeatingSystemHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(TARGET_HEATING_LEVEL, "io:TargetHeatingLevelState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
if (TARGET_HEATING_LEVEL.equals(channelUID.getId())) {
|
||||
String param = "[\"" + command.toString() + "\"]";
|
||||
sendCommand(COMMAND_SET_HEATINGLEVEL, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.CONTROL;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaPergolaHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the pergola thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaPergolaHandler extends SomfyTahomaAwningHandler {
|
||||
|
||||
public SomfyTahomaPergolaHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTROL, "core:TargetClosureState");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaPodHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the pod thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaPodHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaPodHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CYCLIC_BUTTON, CYCLIC_BUTTON_STATE);
|
||||
stateNames.put(BATTERY_STATUS, BATTERY_STATUS_STATE);
|
||||
stateNames.put(LIGHTING_LED_POD_MODE, "internal:LightingLedPodModeState");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaRollerShutterHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the roller shutter, screen & garage door
|
||||
* things.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaRollerShutterHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaRollerShutterHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTROL, "core:ClosureState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (!CONTROL.equals(channelUID.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
String cmd = getTahomaCommand(command.toString());
|
||||
if (COMMAND_MY.equals(cmd)) {
|
||||
sendCommand(COMMAND_MY);
|
||||
} else if (COMMAND_STOP.equals(cmd)) {
|
||||
String executionId = getCurrentExecutions();
|
||||
if (executionId != null) {
|
||||
// Check if the roller shutter is moving and STOP is sent => STOP it
|
||||
cancelExecution(executionId);
|
||||
} else {
|
||||
sendCommand(COMMAND_MY);
|
||||
}
|
||||
} else {
|
||||
String param = COMMAND_SET_CLOSURE.equals(cmd) ? "[" + toInteger(command) + "]" : "[]";
|
||||
sendCommand(cmd, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getTahomaCommand(String command) {
|
||||
switch (command) {
|
||||
case "OFF":
|
||||
case "DOWN":
|
||||
case "CLOSE":
|
||||
return COMMAND_DOWN;
|
||||
case "ON":
|
||||
case "UP":
|
||||
case "OPEN":
|
||||
return COMMAND_UP;
|
||||
case "MOVE":
|
||||
case "MY":
|
||||
return COMMAND_MY;
|
||||
case "STOP":
|
||||
return COMMAND_STOP;
|
||||
default:
|
||||
return COMMAND_SET_CLOSURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaSilentRollerShutterHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the silent roller shutter thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaSilentRollerShutterHandler extends SomfyTahomaRollerShutterHandler {
|
||||
|
||||
public SomfyTahomaSilentRollerShutterHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTROL_SILENT, "core:ClosureState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (!CONTROL.equals(channelUID.getId()) && !channelUID.getId().equals(CONTROL_SILENT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
String cmd = getTahomaCommand(command.toString());
|
||||
switch (cmd) {
|
||||
case COMMAND_STOP:
|
||||
String executionId = getCurrentExecutions();
|
||||
if (executionId != null) {
|
||||
// Check if the roller shutter is moving and STOP is sent => STOP it
|
||||
cancelExecution(executionId);
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case COMMAND_MY:
|
||||
sendCommand(COMMAND_MY);
|
||||
break;
|
||||
case COMMAND_SET_CLOSURE:
|
||||
if (CONTROL_SILENT.equals(channelUID.getId())) {
|
||||
// move the roller shutter to the specific position at low speed
|
||||
String param = "[" + toInteger(command) + ", \"lowspeed\"]";
|
||||
sendCommand(COMMAND_SET_CLOSURESPEED, param);
|
||||
} else {
|
||||
String param = "[" + toInteger(command) + "]";
|
||||
sendCommand(cmd, param);
|
||||
}
|
||||
break;
|
||||
case COMMAND_UP:
|
||||
case COMMAND_DOWN:
|
||||
if (CONTROL_SILENT.equals(channelUID.getId())) {
|
||||
// move the roller shutter to the specific position at low speed
|
||||
String param = "[" + (COMMAND_UP.equals(cmd) ? 0 : 100) + ", \"lowspeed\"]";
|
||||
sendCommand(COMMAND_SET_CLOSURESPEED, param);
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
default:
|
||||
sendCommand(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaSirenHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the siren thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaSirenHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaSirenHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(BATTERY, "core:BatteryState");
|
||||
stateNames.put(ONOFF_STATE, "core:OnOffState");
|
||||
stateNames.put(MEMORIZED_VOLUME, "io:MemorizedSimpleVolumeState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
}
|
||||
|
||||
// it is possible only to disable the siren
|
||||
if (ONOFF_STATE.equals(channelUID.getId()) && command.equals(OnOffType.OFF)) {
|
||||
sendCommand(COMMAND_OFF);
|
||||
}
|
||||
|
||||
// highest or normal memorized volume
|
||||
if (MEMORIZED_VOLUME.equals(channelUID.getId()) && command instanceof StringType) {
|
||||
sendCommand("setMemorizedSimpleVolume", "[\"" + command.toString().toLowerCase() + "\"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaSmokeSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the smoke sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaSmokeSensorHandler extends SomfyTahomaContactSensorHandler {
|
||||
|
||||
public SomfyTahomaSmokeSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTACT, SMOKE_STATE);
|
||||
stateNames.put(SENSOR_DEFECT, SENSOR_DEFECT_STATE);
|
||||
stateNames.put(SENSOR_BATTERY, SENSOR_PART_BATTERY_STATE);
|
||||
stateNames.put(RADIO_BATTERY, RADIO_PART_BATTERY_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else if (ALARM_CHECK.equals(channelUID.getId())) {
|
||||
sendCommand(COMMAND_CHECK_TRIGGER, "[\"" + command.toString().toLowerCase() + "\"]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.TEMPERATURE;
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.TYPE_DECIMAL;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaTemperatureSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the temperature sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaTemperatureSensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaTemperatureSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(TEMPERATURE, "core:TemperatureState");
|
||||
|
||||
// override state type because the cloud sends both percent & decimal
|
||||
cacheStateType("core:TemperatureState", TYPE_DECIMAL);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaThermostatHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the Somfy thermostat thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaThermostatHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaThermostatHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(TARGET_TEMPERATURE, TARGET_TEMPERATURE_STATE);
|
||||
stateNames.put(BATTERY_LEVEL, BATTERY_LEVEL_STATE);
|
||||
stateNames.put(HEATING_MODE, "somfythermostat:HeatingModeState");
|
||||
stateNames.put(DEROGATION_HEATING_MODE, "somfythermostat:DerogationHeatingModeState");
|
||||
stateNames.put(DEROGATION_ACTIVATION, "core:DerogationActivationState");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaUnoRollerShutterHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the Uno roller shutter things.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaUnoRollerShutterHandler extends SomfyTahomaRollerShutterHandler {
|
||||
|
||||
public SomfyTahomaUnoRollerShutterHandler(Thing thing) {
|
||||
super(thing);
|
||||
// clear states set by RollerShutterHandler
|
||||
stateNames.clear();
|
||||
stateNames.put(CONTROL, TARGET_CLOSURE_STATE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaVenetianBlindHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the venetian blind thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaVenetianBlindHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaVenetianBlindHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTROL, "core:ClosureState");
|
||||
stateNames.put(ORIENTATION, SLATE_ORIENTATION_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (channelUID.getId()) {
|
||||
case CLOSURE_AND_ORIENTATION:
|
||||
sendCommand(COMMAND_SET_CLOSURE_ORIENTATION, "[" + command.toString() + "]");
|
||||
break;
|
||||
case CONTROL:
|
||||
case ORIENTATION:
|
||||
String cmd = getTahomaCommand(command.toString(), channelUID.getId());
|
||||
if (COMMAND_MY.equals(cmd)) {
|
||||
sendCommand(COMMAND_MY);
|
||||
} else if (COMMAND_STOP.equals(cmd)) {
|
||||
String executionId = getCurrentExecutions();
|
||||
if (executionId != null) {
|
||||
// Check if the venetian blind is moving and STOP is sent => STOP it
|
||||
cancelExecution(executionId);
|
||||
} else {
|
||||
sendCommand(COMMAND_MY);
|
||||
}
|
||||
} else {
|
||||
String param = (COMMAND_SET_CLOSURE.equals(cmd) || COMMAND_SET_ORIENTATION.equals(cmd))
|
||||
? "[" + toInteger(command) + "]"
|
||||
: "[]";
|
||||
sendCommand(cmd, param);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private String getTahomaCommand(String command, String channelId) {
|
||||
switch (command) {
|
||||
case "OFF":
|
||||
case "DOWN":
|
||||
case "CLOSE":
|
||||
return COMMAND_DOWN;
|
||||
case "ON":
|
||||
case "UP":
|
||||
case "OPEN":
|
||||
return COMMAND_UP;
|
||||
case "MOVE":
|
||||
case "MY":
|
||||
return COMMAND_MY;
|
||||
case "STOP":
|
||||
return COMMAND_STOP;
|
||||
default:
|
||||
if (CONTROL.equals(channelId)) {
|
||||
return COMMAND_SET_CLOSURE;
|
||||
} else {
|
||||
return COMMAND_SET_ORIENTATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaWaterSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the water detection sensors.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaWaterSensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaWaterSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CONTACT, WATER_DETECTION_STATE);
|
||||
stateNames.put(SENSOR_DEFECT, SENSOR_DEFECT_STATE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.HANDLE_STATE;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaWindowHandleHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the window handle thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaWindowHandleHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaWindowHandleHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(HANDLE_STATE, "core:ThreeWayHandleDirectionState");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaWindowHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the window thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaWindowHandler extends SomfyTahomaRollerShutterHandler {
|
||||
|
||||
public SomfyTahomaWindowHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (!CONTROL.equals(channelUID.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
String cmd = getTahomaCommand(command.toString());
|
||||
if (COMMAND_STOP.equals(cmd)) {
|
||||
// Check if the window is not moving
|
||||
String executionId = getCurrentExecutions();
|
||||
if (executionId != null) {
|
||||
// STOP command should be interpreted if window is moving
|
||||
// otherwise do nothing
|
||||
cancelExecution(executionId);
|
||||
}
|
||||
} else {
|
||||
String param = COMMAND_SET_CLOSURE.equals(cmd) ? "[" + toInteger(command) + "]" : "[]";
|
||||
sendCommand(cmd, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTahomaCommand(String command) {
|
||||
switch (command) {
|
||||
case "OFF":
|
||||
case "DOWN":
|
||||
case "CLOSE":
|
||||
return COMMAND_CLOSE;
|
||||
case "ON":
|
||||
case "UP":
|
||||
case "OPEN":
|
||||
return COMMAND_OPEN;
|
||||
case "STOP":
|
||||
return COMMAND_STOP;
|
||||
default:
|
||||
return COMMAND_SET_CLOSURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaAction} holds information about a list of
|
||||
* commands for one concrete device.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaAction {
|
||||
|
||||
private String deviceURL = "";
|
||||
|
||||
public String getDeviceURL() {
|
||||
return deviceURL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaActionGroup} holds information about a action
|
||||
* group and current actions.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaActionGroup {
|
||||
private String oid = "";
|
||||
private String label = "";
|
||||
|
||||
public String getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaApplyResponse} holds information about
|
||||
* response to sending a command to a device.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaApplyResponse {
|
||||
|
||||
private String execId = "";
|
||||
|
||||
public String getExecId() {
|
||||
return execId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDevice} holds information about a device bound
|
||||
* to TahomaLink account.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDevice {
|
||||
|
||||
private String uiClass = "";
|
||||
private String widget = "";
|
||||
private String deviceURL = "";
|
||||
private String label = "";
|
||||
private String oid = "";
|
||||
private SomfyTahomaDeviceDefinition definition = new SomfyTahomaDeviceDefinition();
|
||||
private List<SomfyTahomaState> states = new ArrayList<>();
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getDeviceURL() {
|
||||
return deviceURL;
|
||||
}
|
||||
|
||||
public String getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public String getUiClass() {
|
||||
return uiClass;
|
||||
}
|
||||
|
||||
public String getWidget() {
|
||||
return widget;
|
||||
}
|
||||
|
||||
public SomfyTahomaDeviceDefinition getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public List<SomfyTahomaState> getStates() {
|
||||
return states;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDeviceDefinition} holds information about a device definition.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDeviceDefinition {
|
||||
|
||||
private List<SomfyTahomaDeviceDefinitionCommand> commands = new ArrayList<>();
|
||||
private List<SomfyTahomaDeviceDefinitionState> states = new ArrayList<>();
|
||||
|
||||
public List<SomfyTahomaDeviceDefinitionCommand> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
public List<SomfyTahomaDeviceDefinitionState> getStates() {
|
||||
return states;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Commands: { ");
|
||||
for (SomfyTahomaDeviceDefinitionCommand cmd : commands) {
|
||||
sb.append(cmd.toString()).append("; ");
|
||||
}
|
||||
|
||||
sb.append("}\nStates: {");
|
||||
for (SomfyTahomaDeviceDefinitionState state : states) {
|
||||
sb.append(state.toString()).append("; ");
|
||||
}
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDeviceDefinitionCommand} holds information about commands
|
||||
* accepted by a device.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDeviceDefinitionCommand {
|
||||
|
||||
private String commandName = "";
|
||||
private int nparams;
|
||||
|
||||
public String getCommandName() {
|
||||
return commandName;
|
||||
}
|
||||
|
||||
public int getNparams() {
|
||||
return nparams;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return commandName + " (params: " + nparams + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaDeviceDefinitionState} holds information about states
|
||||
* provided by a device.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaDeviceDefinitionState {
|
||||
|
||||
private String qualifiedName = "";
|
||||
private List<String> values = new ArrayList<>();
|
||||
|
||||
public String getQualifiedName() {
|
||||
return qualifiedName;
|
||||
}
|
||||
|
||||
public List<String> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return qualifiedName + " (values: " + String.join(", ", values) + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaEvent} holds information about Tahoma
|
||||
* event.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaEvent {
|
||||
private String name = "";
|
||||
private String deviceURL = "";
|
||||
private String newState = "";
|
||||
private String execId = "";
|
||||
private String gatewayId = "";
|
||||
private List<SomfyTahomaState> deviceStates = new ArrayList<>();
|
||||
private JsonElement action = new JsonObject();
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDeviceUrl() {
|
||||
return deviceURL;
|
||||
}
|
||||
|
||||
public String getGatewayId() {
|
||||
return gatewayId;
|
||||
}
|
||||
|
||||
public String getNewState() {
|
||||
return newState;
|
||||
}
|
||||
|
||||
public String getExecId() {
|
||||
return execId;
|
||||
}
|
||||
|
||||
public List<SomfyTahomaState> getDeviceStates() {
|
||||
return deviceStates;
|
||||
}
|
||||
|
||||
public JsonElement getAction() {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaGateway} holds information about a gateway bound
|
||||
* to TahomaLink account.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaGateway {
|
||||
|
||||
private String gatewayId = "";
|
||||
private int type;
|
||||
|
||||
public String getGatewayId() {
|
||||
return gatewayId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaLoginResponse} holds information about login
|
||||
* response to your TahomaLink account.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaLoginResponse {
|
||||
|
||||
private boolean success;
|
||||
private String version = "";
|
||||
private String error = "";
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaRegisterEventsResponse} holds information about register events
|
||||
* response to your TahomaLink account.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaRegisterEventsResponse {
|
||||
|
||||
private String id = "";
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaSetup} holds information about devices bound
|
||||
* to TahomaLink account.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaSetup {
|
||||
|
||||
private List<SomfyTahomaDevice> devices = new ArrayList<>();
|
||||
|
||||
private List<SomfyTahomaGateway> gateways = new ArrayList<>();
|
||||
|
||||
public List<SomfyTahomaDevice> getDevices() {
|
||||
return devices;
|
||||
}
|
||||
|
||||
public List<SomfyTahomaGateway> getGateways() {
|
||||
return gateways;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaState} holds information about
|
||||
* device state.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaState {
|
||||
|
||||
private Object value = new Object();
|
||||
private int type;
|
||||
private String name = "";
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + "name='" + name + '\'' + ", type=" + type + ", value=" + value + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaStatus} holds information about
|
||||
* gateway status.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaStatus {
|
||||
|
||||
private String status = "N/A";
|
||||
private String protocolVersion = "N/A";
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getProtocolVersion() {
|
||||
return protocolVersion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.somfytahoma.internal.model;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaStatusResponse} holds information about
|
||||
* response to getting gateway's status command.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaStatusResponse {
|
||||
|
||||
private SomfyTahomaStatus connectivity = new SomfyTahomaStatus();
|
||||
|
||||
public SomfyTahomaStatus getConnectivity() {
|
||||
return connectivity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<binding:binding id="somfytahoma" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
|
||||
|
||||
<name>SomfyTahoma Binding</name>
|
||||
<description>This is the binding for SomfyTahoma.</description>
|
||||
<author>Ondrej Pecta</author>
|
||||
|
||||
</binding:binding>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config-description:config-descriptions
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd">
|
||||
|
||||
<config-description uri="thing-type:somfytahoma:device">
|
||||
<parameter name="url" type="text">
|
||||
<label>Somfy Tahoma Device URL</label>
|
||||
<description>The identifier of this Somfy device</description>
|
||||
<required>true</required>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
<config-description uri="thing-type:somfytahoma:gateway">
|
||||
<parameter name="id" type="text">
|
||||
<label>Somfy Tahoma Gateway ID</label>
|
||||
<description>The identifier of this Somfy gateway</description>
|
||||
<required>true</required>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
<config-description uri="bridge-type:somfytahoma:bridge">
|
||||
<parameter name="email" type="text">
|
||||
<label>Email Address</label>
|
||||
<description>Email address for TahomaLink portal</description>
|
||||
<required>true</required>
|
||||
</parameter>
|
||||
|
||||
<parameter name="password" type="text">
|
||||
<context>password</context>
|
||||
<label>Password</label>
|
||||
<description>Password for TahomaLink portal</description>
|
||||
<required>true</required>
|
||||
</parameter>
|
||||
|
||||
<parameter name="refresh" type="integer" required="false" min="10">
|
||||
<label>Refresh</label>
|
||||
<description>Specifies the refresh time in seconds for polling events from Tahoma cloud</description>
|
||||
<default>30</default>
|
||||
</parameter>
|
||||
|
||||
<parameter name="statusTimeout" type="integer" required="false" min="60">
|
||||
<label>Status Timeout</label>
|
||||
<description>Specifies the timeout in seconds after which the status is got from Tahoma cloud</description>
|
||||
<default>300</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
</config-description:config-descriptions>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="actiongroup">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Action Group</label>
|
||||
<channels>
|
||||
<channel id="execute_action" typeId="execute_action"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
<channel-type id="execute_action">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Somfy Action Group Trigger</label>
|
||||
<description>Trigger of the action group</description>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="adjustableslatsrollershutter">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy AS Roller Shutter</label>
|
||||
<description>Somfy Adjustable Slats Roller Shutter</description>
|
||||
<channels>
|
||||
<channel id="rocker" typeId="rocker"></channel>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
<channel id="orientation" typeId="orientation"></channel>
|
||||
<channel id="closure_orientation" typeId="closure_orientation"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="awning">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Awning</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<!-- Bridge -->
|
||||
<bridge-type id="bridge">
|
||||
<label>Somfy Tahoma Bridge</label>
|
||||
<description>Somfy Tahoma bridge enabling communication with Somfy devices</description>
|
||||
|
||||
<config-description-ref uri="bridge-type:somfytahoma:bridge"/>
|
||||
</bridge-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,355 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<channel-type id="control_silent">
|
||||
<item-type>Rollershutter</item-type>
|
||||
<label>Control (silent)</label>
|
||||
<description>Device control (UP, DOWN, MY/STOP, closure 0-100%) (only for IO devices)</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="control">
|
||||
<item-type>Rollershutter</item-type>
|
||||
<label>Control</label>
|
||||
<description>Device control (UP, DOWN, MY/STOP, closure 0-100%)</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="orientation">
|
||||
<item-type>Dimmer</item-type>
|
||||
<label>Orientation</label>
|
||||
<description>Orientation of the device slats</description>
|
||||
<state max="100" min="0" step="1" pattern="%d %%" readOnly="false"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="contact">
|
||||
<item-type>Contact</item-type>
|
||||
<label>Contact</label>
|
||||
<description>A contact having OPEN/CLOSE state</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="luminance">
|
||||
<item-type>Number:Illuminance</item-type>
|
||||
<label>Luminance</label>
|
||||
<description>A light sensor luminance in lux</description>
|
||||
<state readOnly="true" pattern="%.1f %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="alarm_command">
|
||||
<item-type>String</item-type>
|
||||
<label>Command</label>
|
||||
<description>A channel used for sending commands to Somfy Alarm device</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="on">ARM</option>
|
||||
<option value="off">DISARM</option>
|
||||
<option value="alarmPartial1">ARM_PARTIAL_1</option>
|
||||
<option value="alarmPartial2">ARM_PARTIAL_2</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="myfox_alarm_command">
|
||||
<item-type>String</item-type>
|
||||
<label>Command</label>
|
||||
<description>A channel used for sending commands to Somfy Myfox Alarm device</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="arm">ARM</option>
|
||||
<option value="disarm">DISARM</option>
|
||||
<option value="partial">ARM_PARTIAL</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="intrusion_control">
|
||||
<item-type>String</item-type>
|
||||
<label>Intrusion Control</label>
|
||||
<description>A channel used for Alarm external intrusion controlling</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="detected">DETECTED</option>
|
||||
<option value="notDetected">NOT DETECTED</option>
|
||||
<option value="pending">PENDING</option>
|
||||
<option value="sos">SOS</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="alarm_state">
|
||||
<item-type>String</item-type>
|
||||
<label>Alarm State</label>
|
||||
<description>A state of the Somfy Alarm</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="active_zones_state">
|
||||
<item-type>String</item-type>
|
||||
<label>Active Zones State</label>
|
||||
<description>Active Zones State</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="intrusion_state">
|
||||
<item-type>String</item-type>
|
||||
<label>Alarm Intrusion State</label>
|
||||
<description>An intrusion state of the Somfy Alarm</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="cyclic_button">
|
||||
<item-type>String</item-type>
|
||||
<label>Cyclic Button State</label>
|
||||
<description>Cyclic Button State</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="battery_status">
|
||||
<item-type>String</item-type>
|
||||
<label>Battery Status State</label>
|
||||
<description>Battery Status State</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="battery">
|
||||
<item-type>String</item-type>
|
||||
<label>Battery State</label>
|
||||
<description>Battery Condition State (full, low, normal, verylow)</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="lighting_led_pod_mode">
|
||||
<item-type>Number</item-type>
|
||||
<label>Lighting Led Pod Mod State</label>
|
||||
<description>Lighting Led Pod Mod State</description>
|
||||
<state pattern="%.2f" readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="current_temperature">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Current Temperature</label>
|
||||
<description>The current temperature of the heating system</description>
|
||||
<state pattern="%.1f %unit%" readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="humidity">
|
||||
<item-type>Number:Dimensionless</item-type>
|
||||
<label>Relative Humidity</label>
|
||||
<description>The current relative humidity</description>
|
||||
<state readOnly="true" min="0" max="100" pattern="%f.1 %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="current_state">
|
||||
<item-type>String</item-type>
|
||||
<label>Heating System Current State</label>
|
||||
<description>A channel used for getting the heating state</description>
|
||||
<state readOnly="true" pattern="%s"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="target_temperature">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Target Temperature</label>
|
||||
<description>The target temperature of the heating system</description>
|
||||
<state pattern="%.1f %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="target_heating_level">
|
||||
<item-type>String</item-type>
|
||||
<label>Target Heating Level</label>
|
||||
<description>A channel used for getting/setting the target heating level (on/off, frostprotection, confort, eco)</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="frostprotection">FROSTPROTECTION</option>
|
||||
<option value="comfort">COMFORT</option>
|
||||
<option value="eco">ECO</option>
|
||||
<option value="off">OFF</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="gate_command">
|
||||
<item-type>String</item-type>
|
||||
<label>Gate Command</label>
|
||||
<description>A channel used for getting/setting the gate position (open, close, pedestrian, stop)</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="open">OPEN</option>
|
||||
<option value="close">CLOSE</option>
|
||||
<option value="pedestrian">PEDESTRIAN</option>
|
||||
<option value="stop">STOP</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="gate_state">
|
||||
<item-type>String</item-type>
|
||||
<label>Gate Status</label>
|
||||
<description>A channel used for getting the gate state (open, closed, pedestrian)</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="open">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Open/Close</label>
|
||||
<description>A channel for controlling door OPEN/CLOSE state</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="lock">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Lock</label>
|
||||
<description>A lock having ON/OFF state (unlocked/locked)</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="handle_state">
|
||||
<item-type>String</item-type>
|
||||
<label>Handle State</label>
|
||||
<description>A state of the Somfy Window Handle</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="temperature">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Temperature</label>
|
||||
<description>The temperature value of the sensor</description>
|
||||
<state pattern="%.1f %unit%" readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="energy_consumption">
|
||||
<item-type>Number:Energy</item-type>
|
||||
<label>Energy Consumption</label>
|
||||
<description>The energy consumption reported by the sensor</description>
|
||||
<state pattern="%.1f %unit%" readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="siren_status">
|
||||
<item-type>String</item-type>
|
||||
<label>Siren Status State</label>
|
||||
<description>A channel for controlling the dock's siren state</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="on">ON</option>
|
||||
<option value="off">OFF</option>
|
||||
<option value="cyclic">CYCLIC</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="memorized_volume">
|
||||
<item-type>String</item-type>
|
||||
<label>Memorized Volume</label>
|
||||
<description>A channel used for controlling siren's volume state</description>
|
||||
<state>
|
||||
<options>
|
||||
<option value="normal">NORMAL</option>
|
||||
<option value="highest">HIGHEST</option>
|
||||
</options>
|
||||
</state>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="short_beep">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Dock Short Beep Test</label>
|
||||
<description>A channel for testing the dock's short beeping</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="long_beep">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Dock Long Beep Test</label>
|
||||
<description>A channel for testing the dock's long beeping</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="alarm_check">
|
||||
<item-type>String</item-type>
|
||||
<label>Alarm Check Trigger</label>
|
||||
<description>A channel for triggering the smoke sensor's check</description>
|
||||
<command>
|
||||
<options>
|
||||
<option value="SHORT">Short check</option>
|
||||
<option value="LONG">Long check</option>
|
||||
</options>
|
||||
</command>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="rocker">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Rocker Position</label>
|
||||
<description>A channel for controlling the rocker position</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="cloud_status">
|
||||
<item-type>String</item-type>
|
||||
<label>Cloud Status State</label>
|
||||
<description>Cloud status state of the camera</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="shutter">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Myfox Shutter</label>
|
||||
<description>A channel for controlling the shutter</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="heating_mode">
|
||||
<item-type>String</item-type>
|
||||
<label>Heating Mode</label>
|
||||
<description>Heating mode of the Somfy thermostat</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="derogation_heating_mode">
|
||||
<item-type>String</item-type>
|
||||
<label>Derogation Heating Mode</label>
|
||||
<description>Derogation heating mode of the Somfy thermostat</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="derogation_activation">
|
||||
<item-type>String</item-type>
|
||||
<label>Derogation Activation State</label>
|
||||
<description>Derogation activation state of the Somfy thermostat</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="sensor_defect">
|
||||
<item-type>String</item-type>
|
||||
<label>Sensor Defect State</label>
|
||||
<description>State of the Somfy sensor (dead, lowBattery, noDefect...)</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="sensor_battery">
|
||||
<item-type>String</item-type>
|
||||
<label>Sensor Part Battery State</label>
|
||||
<description>State of the sensor part of the Somfy sensor</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="radio_battery">
|
||||
<item-type>String</item-type>
|
||||
<label>Radio Part Battery State</label>
|
||||
<description>State of the radio part of the Somfy sensor</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="closure_orientation">
|
||||
<item-type>String</item-type>
|
||||
<label>Set Closure And Orientation</label>
|
||||
<description>A channel for setting closure and orientation of the blind</description>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="light_intensity">
|
||||
<item-type>Dimmer</item-type>
|
||||
<label>Light Intensity</label>
|
||||
<description>The intensity of the light</description>
|
||||
<state max="100" min="0" step="1" pattern="%d %%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="heating_level">
|
||||
<item-type>Dimmer</item-type>
|
||||
<label>Heating Level</label>
|
||||
<description>The level of the heating</description>
|
||||
<state max="100" min="0" step="1" pattern="%d %%"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="contactsensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Contact Sensor</label>
|
||||
<channels>
|
||||
<channel id="contact" typeId="contact"></channel>
|
||||
<channel id="sensor_defect" typeId="sensor_defect"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="curtain">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Curtain</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="dimmerlight">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Dimmer Light</label>
|
||||
<channels>
|
||||
<channel id="light_intensity" typeId="light_intensity"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="dock">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Dock</label>
|
||||
<channels>
|
||||
<channel id="battery_status" typeId="battery_status"></channel>
|
||||
<channel id="battery_level" typeId="system.battery-level"></channel>
|
||||
<channel id="siren_status" typeId="siren_status"></channel>
|
||||
<channel id="short_beep" typeId="short_beep"></channel>
|
||||
<channel id="long_beep" typeId="long_beep"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="doorlock">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Door Lock</label>
|
||||
<channels>
|
||||
<channel id="open" typeId="open"></channel>
|
||||
<channel id="lock" typeId="lock"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="electricitysensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Electricity Sensor</label>
|
||||
<channels>
|
||||
<channel id="energy_consumption" typeId="energy_consumption"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="exteriorheatingsystem">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Light Switch</label>
|
||||
<channels>
|
||||
<channel id="heating_level" typeId="heating_level"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="exteriorscreen">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Exterior Screen</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="exteriorvenetianblind">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Exterior Venetian Blind</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
<channel id="orientation" typeId="orientation"></channel>
|
||||
<channel id="closure_orientation" typeId="closure_orientation"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="externalalarm">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy External Alarm</label>
|
||||
<channels>
|
||||
<channel id="active_zones_state" typeId="active_zones_state"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="garagedoor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Garage Door</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="gate">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Heating System with On/Off</label>
|
||||
<channels>
|
||||
<channel id="gate_state" typeId="gate_state"></channel>
|
||||
<channel id="gate_command" typeId="gate_command"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="gateway">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Tahoma Gateway</label>
|
||||
<channels>
|
||||
<channel id="status" typeId="status"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:gateway"/>
|
||||
</thing-type>
|
||||
|
||||
<!-- Gateway status -->
|
||||
<channel-type id="status">
|
||||
<item-type>String</item-type>
|
||||
<label>Status</label>
|
||||
<description>Status for SomfyTahoma</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="heatingsystem">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Heating System</label>
|
||||
<channels>
|
||||
<channel id="current_temperature" typeId="current_temperature"></channel>
|
||||
<channel id="current_state" typeId="current_state"></channel>
|
||||
<channel id="target_temperature" typeId="target_temperature"></channel>
|
||||
<channel id="battery_level" typeId="system.battery-level"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="humiditysensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Humidity Sensor</label>
|
||||
<channels>
|
||||
<channel id="humidity" typeId="humidity"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="internalalarm">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Internal Alarm</label>
|
||||
<channels>
|
||||
<channel id="alarm_command" typeId="alarm_command"></channel>
|
||||
<channel id="intrusion_control" typeId="intrusion_control"></channel>
|
||||
<channel id="alarm_state" typeId="alarm_state"></channel>
|
||||
<channel id="target_alarm_state" typeId="alarm_state"></channel>
|
||||
<channel id="intrusion_state" typeId="intrusion_state"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="light">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Light Switch</label>
|
||||
<channels>
|
||||
<channel id="switch" typeId="system.power"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="lightsensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Light Sensor</label>
|
||||
<channels>
|
||||
<channel id="luminance" typeId="luminance"></channel>
|
||||
<channel id="sensor_defect" typeId="sensor_defect"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="myfoxalarm">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Myfox Alarm</label>
|
||||
<channels>
|
||||
<channel id="cloud_status" typeId="cloud_status"></channel>
|
||||
<channel id="myfox_alarm_command" typeId="myfox_alarm_command"></channel>
|
||||
<channel id="alarm_state" typeId="alarm_state"></channel>
|
||||
<channel id="intrusion_state" typeId="intrusion_state"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="myfoxcamera">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Myfox Camera</label>
|
||||
<channels>
|
||||
<channel id="cloud_status" typeId="cloud_status"></channel>
|
||||
<channel id="shutter" typeId="shutter"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="occupancysensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Occupancy Sensor</label>
|
||||
<channels>
|
||||
<channel id="contact" typeId="contact"></channel>
|
||||
<channel id="sensor_defect" typeId="sensor_defect"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="onoff">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy On/Off Switch</label>
|
||||
<channels>
|
||||
<channel id="switch" typeId="system.power"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="onoffheatingsystem">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Heating System with On/Off</label>
|
||||
<channels>
|
||||
<channel id="target_heating_level" typeId="target_heating_level"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="pergola">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Pergola</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="pod">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Pod</label>
|
||||
<channels>
|
||||
<channel id="cyclic_button" typeId="cyclic_button"></channel>
|
||||
<channel id="battery_status" typeId="battery_status"></channel>
|
||||
<channel id="lighting_led_pod_mode" typeId="lighting_led_pod_mode"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="rollershutter">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Roller Shutter</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="rollershutter_silent">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Silent Roller Shutter</label>
|
||||
<channels>
|
||||
<channel id="control_silent" typeId="control_silent"></channel>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="rollershutter_uno">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Roller Shutter Uno</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="screen">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Screen</label>
|
||||
<channels>
|
||||
<channel id="control" typeId="control"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="somfytahoma"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="siren">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Siren</label>
|
||||
<channels>
|
||||
<channel id="battery" typeId="battery"></channel>
|
||||
<channel id="onoff" typeId="system.power"></channel>
|
||||
<channel id="memorized_volume" typeId="memorized_volume"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user