Skip to content

Commit

Permalink
Implemented some improvement suggestions from PR code review
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Pecta <[email protected]>
  • Loading branch information
octa22 committed May 16, 2018
1 parent 447bb59 commit bcbf336
Show file tree
Hide file tree
Showing 24 changed files with 390 additions and 234 deletions.
18 changes: 0 additions & 18 deletions addons/binding/org.openhab.binding.somfytahoma/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0 http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd">
xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0 http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd">

<config-description uri="thing-type:somfytahoma:device">
<parameter name="url" type="text">
<label>SomfyTahoma device URL</label>
<description>The identifier of this Somfy device</description>
<required>true</required>
<advanced>true</advanced>
</parameter>
</config-description>
<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>
<advanced>true</advanced>
</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>
<advanced>true</advanced>
</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>
<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="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">
<label>Refresh refresh</label>
<description>Specifies the refresh of thing states in seconds</description>
<default>30</default>
</parameter>
</config-description>
<parameter name="refresh" type="integer" required="false">
<label>Refresh refresh</label>
<description>Specifies the refresh of thing states in seconds</description>
<default>30</default>
</parameter>
</config-description>
</config-description:config-descriptions>
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>

<channel-type id="trigger">
<item-type>Switch</item-type>
<label>Somfy Action Group Trigger</label>
<description>Trigger of the action group</description>
<state readOnly="false"></state>
</channel-type>
<channel-type id="trigger">
<item-type>Switch</item-type>
<label>Somfy Action Group Trigger</label>
<description>Trigger of the action group</description>
<state readOnly="false"></state>
</channel-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="somfytahoma" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<thing-type id="awning">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
</supported-bridge-type-refs>
<label>Somfy Awning</label>
<channels>
<channel id="position" typeId="position"></channel>
<channel id="control" typeId="control"></channel>
</channels>
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>
<thing-type id="awning">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
</supported-bridge-type-refs>
<label>Somfy Awning</label>
<channels>
<channel id="position" typeId="position"></channel>
<channel id="control" typeId="control"></channel>
</channels>
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>

<channel-type id="position">
<item-type>Dimmer</item-type>
<label>Somfy Awning Position</label>
<description>Position of the awning (only for IO devices)</description>
<state max="100" min="0" step="1" pattern="%d %%" readOnly="false"></state>
</channel-type>
<channel-type id="control">
<item-type>Rollershutter</item-type>
<label>Somfy Awning Control</label>
<description>Awning control (UP, DOWN, MY/STOP)</description>
<channel-type id="position">
<item-type>Dimmer</item-type>
<label>Somfy Awning Position</label>
<description>Position of the awning (only for IO devices)</description>
<state max="100" min="0" step="1" pattern="%d %%" readOnly="false"></state>
</channel-type>
<channel-type id="control">
<item-type>Rollershutter</item-type>
<label>Somfy Awning Control</label>
<description>Awning control (UP, DOWN, MY/STOP)</description>
<state readOnly="false"></state>
</channel-type>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="somfytahoma"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<!-- Bridge -->
<bridge-type id="bridge">
<label>Somfy Tahoma Bridge</label>
<description>Somfy Tahoma bridge enabling communication with Somfy devices</description>

<channels>
<channel id="version" typeId="version"/>
</channels>
<channels/>
<config-description-ref uri="bridge-type:somfytahoma:bridge"/>
</bridge-type>

<!-- Bridge firmware version -->
<channel-type id="version">
<item-type>String</item-type>
<label>SomfyTahoma Firmware Version</label>
<description>Version channel for SomfyTahoma Binding</description>
<state readOnly="true"/>
</channel-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="somfytahoma" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<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="version" typeId="version"></channel>
</channels>
<config-description-ref uri="thing-type:somfytahoma:gateway"/>
</thing-type>

<!-- Gateway firmware version -->
<channel-type id="version">
<item-type>String</item-type>
<label>Somfy Tahoma Firmware Version</label>
<description>Version channel for SomfyTahoma Binding</description>
<state readOnly="true"/>
</channel-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>

<channel-type id="switch">
<item-type>Switch</item-type>
<label>Somfy Switch</label>
<description>A switch bound to you Tahoma box (zwave/enocean/rts)</description>
<state readOnly="false"></state>
</channel-type>
<channel-type id="switch">
<item-type>Switch</item-type>
<label>Somfy Switch</label>
<description>A switch bound to you Tahoma box (zwave/enocean/rts)</description>
<state readOnly="false"></state>
</channel-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="somfytahoma" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<thing-type id="rollershutter">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
<thing-type id="rollershutter">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
</supported-bridge-type-refs>
<label>Somfy Rollershutter</label>
<channels>
<channel id="position" typeId="position"></channel>
<channel id="control" typeId="control"></channel>
</channels>
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>
<label>Somfy Rollershutter</label>
<channels>
<channel id="position" typeId="position"></channel>
<channel id="control" typeId="control"></channel>
</channels>
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>

<channel-type id="position">
<item-type>Dimmer</item-type>
<label>Somfy Roller Shutter Position</label>
<description>Position of the roller shutter (only for IO devices)</description>
<state max="100" min="0" step="1" pattern="%d %%" readOnly="false"></state>
</channel-type>
<channel-type id="control">
<item-type>Rollershutter</item-type>
<label>Somfy Roller Shutter Control</label>
<description>Rollershutter control (UP, DOWN, MY/STOP)</description>
<state readOnly="false"></state>
</channel-type>
<channel-type id="position">
<item-type>Dimmer</item-type>
<label>Somfy Roller Shutter Position</label>
<description>Position of the roller shutter (only for IO devices)</description>
<state max="100" min="0" step="1" pattern="%d %%" readOnly="false"></state>
</channel-type>
<channel-type id="control">
<item-type>Rollershutter</item-type>
<label>Somfy Roller Shutter Control</label>
<description>Rollershutter control (UP, DOWN, MY/STOP)</description>
<state readOnly="false"></state>
</channel-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Bundle-Version: 2.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Import-Package: com.google.gson,
org.apache.commons.lang,
org.openhab.binding.somfytahoma,
org.openhab.binding.somfytahoma.handler,
org.eclipse.smarthome.config.core,
Expand Down
10 changes: 8 additions & 2 deletions addons/binding/org.openhab.binding.somfytahoma/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Somfy Tahoma Binding

This binding integrates the [Somfy Tahoma](https://www.somfy.fr/produits/domotique/maison-connectee-tahoma) home automation system.

## Supported Things

Currently supports these things
- bridge (Somfy Tahoma bridge, which can discover roller shutters, awnings, switches and action groups)
- bridge (Somfy Tahoma bridge, which can discover gateways, roller shutters, awnings, switches and action groups)
- gateways (Somfy Tahoma gateway - getting firmware version)
- roller shutters (UP, DOWN, STOP control of a roller shutter). IO Homecontrol devices are allowed to set exact position of a shutter (0-100%)
- awnings (UP, DOWN, STOP control of an awning). IO Homecontrol devices are allowed to set exact position of an awning (0-100%)
- on/off switches (connected by RTS, IO protocol or supported by USB stick - z-wave, enocean, ..)
Expand Down Expand Up @@ -32,7 +34,9 @@ Please see the example below.

## Channels

A bridge exposes this read only channel:
A bridge does not expose and channel.

Gateways expose this read only channel:
- version (this is a firmware version of your Tahoma device)

Roller shutters and awnings expose these channels:
Expand All @@ -54,6 +58,7 @@ A on/off thing has this channel:
.things file
```
Bridge somfytahoma:bridge:237dbae7 "Somfy Tahoma Bridge" [ email="[email protected]", password="MyPassword", refresh=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" ]
Expand All @@ -66,6 +71,7 @@ Bridge somfytahoma:bridge:237dbae7 "Somfy Tahoma Bridge" [ email="[email protected]",
```
.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:position"}
Rollershutter RollerShutterLiving "Roller shutter [%d %%]" {channel="somfytahoma:rollershutter:237dbae7:87bf0403-a45d-4037-b874-28f4ece30004:control" }
Expand Down
2 changes: 0 additions & 2 deletions addons/binding/org.openhab.binding.somfytahoma/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
<version>2.2.0-SNAPSHOT</version>
</parent>

<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.somfytahoma</artifactId>
<version>2.2.0-SNAPSHOT</version>

<name>SomfyTahoma Binding</name>
<packaging>eclipse-plugin</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class SomfyTahomaBindingConstants {
// 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");

// Rollershutter
public static final ThingTypeUID THING_TYPE_ROLLERSHUTTER = new ThingTypeUID(BINDING_ID, "rollershutter");

Expand All @@ -37,7 +40,7 @@ public class SomfyTahomaBindingConstants {
public static final ThingTypeUID THING_TYPE_ONOFF = new ThingTypeUID(BINDING_ID, "onoff");

// List of all Channel ids
// Bridge
// Gateway
public static final String VERSION = "version";

// Roller shutter
Expand All @@ -52,9 +55,14 @@ public class SomfyTahomaBindingConstants {

//Constants
final public static String TAHOMA_URL = "https://www.tahomalink.com/enduser-mobile-web/externalAPI/json/";
final public static String SETUP_URL = "https://www.tahomalink.com/enduser-mobile-web/enduserAPI/setup/gateways/";
final public static String DELETE_URL = "https://www.tahomalink.com/enduser-mobile-web/enduserAPI/exec/current/setup/";
final public static String TAHOMA_AGENT = "TaHoma/3640 CFNetwork/711.1.16 Darwin/14.0.0";
final public static String UNAUTHORIZED = "Server returned HTTP response code: 401";
final public static int TYPE_PERCENT = 1;
final public static int TYPE_ONOFF = 3;
final public static String COMMAND_MY = "my";
final public static String COMMAND_SET_CLOSURE = "setClosure";
final public static String COMMAND_UP = "up";
final public static String COMMAND_DOWN = "down";
}
Loading

0 comments on commit bcbf336

Please sign in to comment.