forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[somfymylink] Somfy MyLink Binding initial contribution (openhab#5652)
* Initial contribution Signed-off-by: Chris Johnson <[email protected]> Co-authored-by: Connor Petty <[email protected]>
- Loading branch information
1 parent
93f2f54
commit 1a02aff
Showing
39 changed files
with
1,880 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?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-1.8"> | ||
<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="src" path="target/generated-sources/annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="ignore_optional_problems" value="true"/> | ||
<attribute name="m2e-apt" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.somfymylink</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/openhab2-addons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Somfy myLink Binding | ||
|
||
This binding supports the [Somfy myLink](https://www.somfysystems.com/en-us/products/1811403/mylink-) device for control of Somfy RTS blinds/shades. | ||
|
||
## Supported Things | ||
|
||
Currently these things are supported: | ||
|
||
- bridge (Somfy MyLink bridge, which can discover roller shades and scenes) | ||
- roller shades (UP, DOWN, STOP control of a roller shade). | ||
|
||
This binding has been tested with myLink firmware 5.23. | ||
|
||
## Discovery | ||
|
||
To start a discovery: | ||
|
||
- install this binding | ||
- open Paper UI | ||
- add a new thing in menu Configuration/Things | ||
- choose SomfyMyLink Binding and select Somfy MyLink Bridge | ||
- enter it's IP Address and system id. The system id This can be found in the integration settings -> Control4 section of your My Link app | ||
|
||
If the supplied ip address and system id are correct, the automatic discovery starts immediately and detected roller shades appear in Paper UI inbox. | ||
|
||
## Thing Configuration | ||
|
||
### mylink | ||
|
||
| Parameter | Parameter ID | Required/Optional | Description | | ||
|------------------|-------------------|-------------------|-------------| | ||
| IP or Hostname | ipAddress | Required | Hostname or IP Address of the myLink device | | ||
| System Id | systemId | Required | The system id configured on the myLink device | | ||
|
||
### shade | ||
|
||
| Parameter | Parameter ID | Required/Optional | Description | | ||
|------------------|-------------------|-------------------|-------------| | ||
| Target ID | targetId | Required | Address of shade in the Somfy system | | ||
|
||
### scene | ||
|
||
| Parameter | Parameter ID | Required/Optional | Description | | ||
|------------------|-------------------|-------------------|-------------| | ||
| Scene ID | sceneId | Required | Address of scene in the Somfy system | | ||
|
||
## Channels | ||
|
||
The following channels are supported by the binding. Note that specific weather station models may support only some or all of these channels. | ||
|
||
| Channel ID | Item Type | Description | | ||
|---------------------------------|-------------------------|---------------------------------------------------------------| | ||
| shadeControl | Rollershutter | Device control (UP, DOWN, STOP) | | ||
| scenelist | String | Comma-separated list of scenes of form sceneId=sceneName | | ||
| button | Switch | Button to trigger a scene or rule | | ||
|
||
## Example | ||
|
||
### Things | ||
|
||
``` | ||
Bridge somfymylink:mylink:mylink1 "myLink Bridge" @ "Office" [ ipAddress="192.168.1.1", systemId="mysystemidhere" ] { | ||
Thing shade shade1 "Living Room" [ targetId="CC114A21.1" ] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>2.5.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.somfymylink</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: Somfy MyLink Binding</name> | ||
|
||
</project> |
39 changes: 39 additions & 0 deletions
39
...k/src/main/java/org/openhab/binding/somfymylink/internal/SomfyMyLinkBindingConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.somfymylink.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* @author Chris Johnson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class SomfyMyLinkBindingConstants { | ||
|
||
private static final String BINDING_ID = "somfymylink"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_SHADE = new ThingTypeUID(BINDING_ID, "shade"); | ||
public static final ThingTypeUID THING_TYPE_SCENE = new ThingTypeUID(BINDING_ID, "scene"); | ||
public static final ThingTypeUID THING_TYPE_MYLINK = new ThingTypeUID(BINDING_ID, "mylink"); | ||
|
||
// List of all Channel ids | ||
public static final String CHANNEL_SHADELEVEL = "shadelevel"; | ||
public static final String CHANNEL_SCENECONTROL = "scenecontrol"; | ||
public static final String CHANNEL_SCENES = "sceneid"; | ||
|
||
// Thing config properties | ||
public static final String TARGET_ID = "targetId"; | ||
public static final String SCENE_ID = "sceneId"; | ||
} |
81 changes: 81 additions & 0 deletions
81
...ink/src/main/java/org/openhab/binding/somfymylink/internal/SomfyMyLinkHandlerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** | ||
* 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.somfymylink.internal; | ||
|
||
import static org.openhab.binding.somfymylink.internal.SomfyMyLinkBindingConstants.*; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.core.thing.Bridge; | ||
import org.eclipse.smarthome.core.thing.Thing; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandler; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory; | ||
import org.openhab.binding.somfymylink.internal.handler.SomfyMyLinkBridgeHandler; | ||
import org.openhab.binding.somfymylink.internal.handler.SomfyMyLinkStateDescriptionOptionsProvider; | ||
import org.openhab.binding.somfymylink.internal.handler.SomfySceneHandler; | ||
import org.openhab.binding.somfymylink.internal.handler.SomfyShadeHandler; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* @author Chris Johnson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(configurationPid = "binding.somfymylink", service = ThingHandlerFactory.class) | ||
public class SomfyMyLinkHandlerFactory extends BaseThingHandlerFactory { | ||
|
||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>( | ||
Arrays.asList(THING_TYPE_MYLINK, THING_TYPE_SHADE, THING_TYPE_SCENE)); | ||
|
||
public static final Set<ThingTypeUID> DISCOVERABLE_DEVICE_TYPES_UIDS = new HashSet<>( | ||
Arrays.asList(THING_TYPE_SHADE, THING_TYPE_SCENE)); | ||
|
||
private @Nullable SomfyMyLinkStateDescriptionOptionsProvider stateDescriptionProvider; | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
|
||
if (thingTypeUID.equals(THING_TYPE_MYLINK)) { | ||
return new SomfyMyLinkBridgeHandler((Bridge) thing, stateDescriptionProvider); | ||
} | ||
if (THING_TYPE_SHADE.equals(thingTypeUID)) { | ||
return new SomfyShadeHandler(thing); | ||
} | ||
if (THING_TYPE_SCENE.equals(thingTypeUID)) { | ||
return new SomfySceneHandler(thing); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@Reference | ||
protected void setDynamicStateDescriptionProvider(SomfyMyLinkStateDescriptionOptionsProvider provider) { | ||
this.stateDescriptionProvider = provider; | ||
} | ||
|
||
protected void unsetDynamicStateDescriptionProvider(SomfyMyLinkStateDescriptionOptionsProvider provider) { | ||
this.stateDescriptionProvider = null; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...c/main/java/org/openhab/binding/somfymylink/internal/config/SomfyMyLinkConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* 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.somfymylink.internal.config; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link SomfyMyLinkConfiguration} class contains fields mapping thing configuration parameters. | ||
* | ||
* @author Chris Johnson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class SomfyMyLinkConfiguration { | ||
public String ipAddress = ""; | ||
|
||
public String systemId = ""; | ||
} |
Oops, something went wrong.