这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/binding/org.openhab.binding.velux/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="lib/gson-2.2.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/gson-2.2.4.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*
* Copyright (c) 2010-2019 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
*
-->
<binding:binding id="velux" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">
Expand All @@ -9,46 +23,62 @@
like controlling window openers, shutters and others. For example a KLF200 can act as interface between the HomeAutomation
and the VELUX INTEGRA products with wireless connectivity based on the io-homecontrol standard.
</description>

<service-id>org.openhab.velux</service-id>

<config-description>
<parameter name="bridgeIPAddress" type="text" required="true">
<parameter name="bridgeProtocol" type="text">
<label>Bridge Protocol</label>
<description>The connection protocol to contact the Velux Bridge with (either slip or json).</description>
<default>slip</default>
<required>false</required>
<advanced>true</advanced>
</parameter>
<parameter name="bridgeIPAddress" type="text">
<label>Bridge IP Address</label>
<description>The hostname or IP address of the Velux Bridge.</description>
<description>The IP address of the Velux Bridge.</description>
<required>true</required>
</parameter>
<parameter name="bridgeTCPPort" type="integer" required="false" min="1" max="65335">
<label>Bridge Port</label>
<description>TCP port of the Velux gateway</description>
<default>80</default>
<default>51200</default>
<required>false</required>

<advanced>true</advanced>
</parameter>
<parameter name="bridgePassword" type="text">
<label>Bridge Password</label>
<description>Password for authentication against the Velux Bridge.</description>
<required>false</required>
<required>true</required>
<!-- Velux Bridge factory default -->
<default>velux123</default>
</parameter>
<parameter name="timeoutMsecs" type="integer" min="1" step="1">
<label>Timeout</label>
<description>Initial Connection timeout in milliseconds.</description>
<required>false</required>
<default>2000</default>
<default>1000</default>
<advanced>true</advanced>
</parameter>
<parameter name="retries" type="integer" min="1" step="1">
<label>Connection retries</label>
<description>Number of retries with timing along the Binary Exponential Backoff (BEB) Algorithm.</description>
<required>false</required>
<default>10</default>
<default>5</default>
<advanced>true</advanced>
</parameter>
<parameter name="refreshMsecs" type="integer" min="1" step="1">
<label>Timeout</label>
<description>Refresh interval in milliseconds.</description>
<required>false</required>
<default>15000</default>
<advanced>true</advanced>
</parameter>
<parameter name="refreshSecs" type="integer" required="false">
<label>Refresh Interval</label>
<description>Data refresh interval for any bridge parameters in milliseconds.</description>
<default>3600000</default>
<parameter name="isBulkRetrievalEnabled" type="text">
<label>Enable Bulk retrieval</label>
<description>Fetch the complete actuator information in a bulk.</description>
<required>false</required>
<default>"true"</default>
<advanced>true</advanced>
</parameter>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# binding
binding.velux.name = Velux Binding (1.x)
binding.velux.description = Ein openHAB1 Binding f�r das Velux KLF200 Kopplungselement. Das Velux Binding kommuniziert �ber ein Velux Kopplungselement mit den unterschiedlichen Velux-Ger�ten zur Steuerung von Fenstern, Roll�den und anderen Ger�ten. Beispielsweise kann ein KLF 200 als Schnittstelle zwischen Hausleitsystemen und VELUX INTEGRA Produkten mit Funkanbindung basierend auf dem io-homecontrol-Standard eingesetzt werden.

# end-of-ESH-INF/i18n/velux_de.properties

Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ Bundle-DocURL: http://www.openhab.org
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Service-Component: OSGI-INF/binding.xml, OSGI-INF/genericbindingprovider.xml
Bundle-ClassPath: .,
lib/gson-2.2.4.jar
lib
172 changes: 155 additions & 17 deletions bundles/binding/org.openhab.binding.velux/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Velux Binding

This binding integrates the <B>Velux</B> devices with help of a gateway, the <B>Velux Bridge KLF200</B>.
This binding integrates the <B>Velux</B> devices with help of a gateway, the <B>Velux Bridge KLF200</B>, which is able to control 200 actuators.
The Velux Binding interacts via the Velux Bridge with any [io-homecontrol](http://www.io-homecontrol.com/)-based
devices like window openers, shutters and others.

Expand Down Expand Up @@ -38,10 +38,11 @@ The binding can be configured by parameters in the global configuration file `op
|----------------|------------------------|:--------:|-----------------------------------------------------------|
| bridgeIPAddress| | Yes | Hostname or address for accessing the Velux Bridge. |
| bridgeProtocol | slip | No | Underlying communication protocol (http/https/slip). |
| bridgeTCPPort | 80 | No | TCP port (80 or 51200)for accessing the Velux Bridge. |
| bridgeTCPPort | 51200 | No | TCP port (80 or 51200) for accessing the Velux Bridge. |
| bridgePassword | velux123 | No | Password for authentication against the Velux Bridge.(**) |
| timeoutMsecs | 2000 | No | Initial Connection timeout in milliseconds |
| retries | 6 | No | Number of retries during I/O |
| timeoutMsecs | 1000 | No | Initial Connection timeout in milliseconds |
| retries | 5 | No | Number of retries during I/O |
| refreshMsecs | 15000 | No | Refresh interval in milliseconds. |

(**) Note: This password is the API password that is printed on the back of the unit. Normally it differs from the password of the web frontend.

Expand Down Expand Up @@ -94,6 +95,8 @@ Optionally the subtype is enhanced with parameters like the appropriate name of
| action | Switch | Activates a set of predefined product settings | scene | required |
| silentMode | Switch | Modification of the silent mode of the defined product settings | scene | required |
| status | String | Current Bridge State (\*\*\*) | bridge | N/A |
| reload | Switch | Reload information from bridge into binding | bridge | N/A |
| timestamp | Number | Timestamp of last successful device interaction | bridge | N/A |
| doDetection | Switch | Start of the product detection mode | bridge | N/A |
| firmware | String | Software version of the Bridge | bridge | N/A |
| ipAddress | String | IP address of the Bridge | bridge | N/A |
Expand All @@ -106,10 +109,15 @@ Optionally the subtype is enhanced with parameters like the appropriate name of
| scenes | String | List of all defined scenes | bridge | N/A |
| check | String | Checks of current item configuratio | bridge | N/A |
| shutter | Rollershutter | Virtual rollershutter as combination of different scenes | bridge | required |
| serial | Rollershutter | IO-Homecontrol'ed device | actuator | required |
| serial | Switch | IO-Homecontrol'ed device | actuator | required |
| serial | Rollershutter | IO-Homecontrol'ed device (\*\*\*\*) (\*\*\*\*\*) | actuator | required |

Note (\*\*\*): The existence of this item triggers the continuous realtime status updates of any Velux item like shutters even if they are manually controlled by other controllers.
Notes:
(\*\*\*) The existence of this item triggers the continuous realtime status updates of any Velux item like shutters even if they are manually controlled by other controllers.

(\*\*\*\*) To enable a complete invertion of all parameter values (i.e. for Velux windows), add a trailing star to the eight-byte serial number. For an example,
see below at item `Velux DG Window Bathroom`.

(\*\*\*\*\*) Somfy devices does not provides a valid serial number to the Velux KLF200 gateway: The bridge reports a registration of the serial number 00:00:00:00:00:00:00:00. Therefore the binding implements a fallback to allow an item specification with a actuator name instead of actuator serial number whenever such an invalid serial number occurs. For an example, see below at item `Velux OG Somfy Shutter`.


### Subtype Parameters
Expand Down Expand Up @@ -164,9 +172,18 @@ Switch V_DG_CLOSED "Velux DG closed" (gV) { velux="thing=scene;cha

// Velux Bridge parameters

String V_FIRMWARE "Firmware [%s]" { velux="thing=bridge;channel=firmware" }
Switch V_RELOAD "Reload info from bridge" { velux="thing=bridge;channel=reload" }
String V_STATUS "Status [%s]" { velux="thing=bridge;channel=status" }
String V_CHECK "Velux Config Check [%s]" { velux="thing=bridge;channel=check" }
String V_TIMESTAMP "Timestamp [%.1f]" { velux="thing=bridge;channel=timestamp" }
String V_CHECK "Velux Config Check [%s]" { velux="thing=bridge;channel=check" }
String V_FIRMWARE "Firmware [%s]" { velux="thing=bridge;channel=firmware" }
String V_CONF_LAN_IP "KLF LAN IP [%s]" { velux="thing=bridge;channel=ipAddress" }
String V_CONF_LAN_SUBNET "KLF LAN Subnet [%s]" { velux="thing=bridge;channel=subnetMask" }
String V_CONF_LAN_GW "KLF LAN Gateway [%s]" { velux="thing=bridge;channel=defaultGW" }
Switch V_CONF_LAN_DHCP "KLF LAN DHCP [%s]" { velux="thing=bridge;channel=DHCP" }
String V_CONF_WLAN_SSID "KLF WLAN SSID [%s]" { velux="thing=bridge;channel=WLANSSID" }
String V_CONF_WLAN_PW "KLF WLAN Password [%s]"{ velux="thing=bridge;channel=WLANPassword" }


// Velux Shutters

Expand All @@ -192,9 +209,17 @@ sitemap velux label="Velux Environment"
Switch item=V_DG_M_W
}
Frame label="Velux Bridge" {
Text item=V_CHECK
Switch item=V_RELOAD
Text item=V_STATUS
Text item=V_TIMESTAMP
Text item=V_CHECK
Text item=V_FIRMWARE
Text item=V_CONF_LAN_IP
Text item=V_CONF_LAN_SUBNET
Text item=V_CONF_LAN_GW
Switch item=V_CONF_LAN_DHCP
Text item=V_CONF_WLAN_SSID
Text item=V_CONF_WLAN_PW
}
}
```
Expand Down Expand Up @@ -228,16 +253,27 @@ rule "PushButton of group gV"
```
// Velux Bridge parameters

String V_FIRMWARE "Firmware [%s]" { velux="thing=bridge;channel=firmware" }
String V_STATUS "Status [%s]" { velux="thing=bridge;channel=status" }
String V_CHECK "Velux Config Check [%s]" { velux="thing=bridge;channel=check" }
Switch V_RELOAD "Reload info from bridge" { velux="thing=bridge;channel=reload" }
String V_STATUS "Status [%s]" { velux="thing=bridge;channel=status" }
String V_TIMESTAMP "Timestamp [%.1f]" { velux="thing=bridge;channel=timestamp" }
String V_CHECK "Velux Config Check [%s]" { velux="thing=bridge;channel=check" }
String V_FIRMWARE "Firmware [%s]" { velux="thing=bridge;channel=firmware" }
String V_CONF_LAN_IP "KLF LAN IP [%s]" { velux="thing=bridge;channel=ipAddress" }
String V_CONF_LAN_SUBNET "KLF LAN Subnet [%s]" { velux="thing=bridge;channel=subnetMask" }
String V_CONF_LAN_GW "KLF LAN Gateway [%s]" { velux="thing=bridge;channel=defaultGW" }
Switch V_CONF_LAN_DHCP "KLF LAN DHCP [%s]" { velux="thing=bridge;channel=DHCP" }
String V_CONF_WLAN_SSID "KLF WLAN SSID [%s]" { velux="thing=bridge;channel=WLANSSID" }
String V_CONF_WLAN_PW "KLF WLAN Password [%s]" { velux="thing=bridge;channel=WLANPassword" }


// Velux Shutters

Rollershutter V_DG_M_W "Velux DG Window Bathroom [%d]" { velux="thing=actuator;channel=serial#01:52:21:3E:26:0C:1B:01"}
Rollershutter V_DG_M_W "Velux DG Window Bathroom [%d]" { velux="thing=actuator;channel=serial#01:52:21:3E:26:0C:1B:01*"}
Rollershutter V_DG_M_S "Velux DG Shutter Bathroom [%d]"{ velux="thing=actuator;channel=serial#01:52:00:21:00:07:00:02"}
Rollershutter V_DG_W_S "Velux DG Shutter West [%d]" { velux="thing=actuator;channel=serial#01:53:09:40:21:0C:2A:03" }
Rollershutter V_DG_E_S "Velux DG Shutter East [%d]" { velux="thing=actuator;channel=serial#11:56:32:14:5A:21:1C:04" }
Rollershutter V_OG_W_S "Velux OG Somfy Shutter [%d]" { velux="thing=actuator;channel=serial#Bathroom" }

```

### Sitemap
Expand All @@ -252,18 +288,106 @@ sitemap velux label="Velux Environment"
Switch item=V_DG_M_W
}
Frame label="Velux Bridge" {
Text item=V_CHECK
Switch item=V_RELOAD
Text item=V_STATUS
Text item=V_TIMESTAMP
Text item=V_CHECK
Text item=V_FIRMWARE
Text item=V_CONF_LAN_IP
Text item=V_CONF_LAN_SUBNET
Text item=V_CONF_LAN_GW
Switch item=V_CONF_LAN_DHCP
Text item=V_CONF_WLAN_SSID
Text item=V_CONF_WLAN_PW
}
}
```

### Debugging
## More automation samples

At this point some interesting automation rules are included to demonstrate the power of this gateway to the io-homecontrol world.


### Closing windows after a period of time

Especially in the colder months, it is advisable to close the window after adequate ventilation. Therefore, automatic closing after one minute is good to save on heating costs.
However, to allow the case of intentional prolonged opening, an automatic closure is made only with the window fully open.

```
/*
* Start of imports
*/

import org.openhab.core.library.types.*

/*
* Start of rules
*/

rule "V_WINDOW_changed"
when
Item V_WINDOW changed
then
logInfo("rules.V_WINDOW", "V_WINDOW_changes() called.")
//
// Get the sensor value
//
val Number windowState = V_WINDOW.state as DecimalType
logWarn("rules.V_WINDOW", "Window state is "+windowState+".")
if (windowState < 80) {
if (windowState == 0) {
logWarn("rules.V_WINDOW", "V-WINDOW changed to fully open.")

var int interval = 1

createTimer(now.plusMinutes(interval)) [|
logWarn("rules.V_WINDOW:event", "event-V_WINDOW(): setting V-WINDOW to 100.")
sendCommand(V_WINDOW,100)
V_WINDOW.postUpdate(100)
logWarn("rules.V_WINDOW:event", "event-V_WINDOW done.")
]
} else {
logWarn("rules.V_WINDOW", "V-WINDOW changed to partially open.")
}
}
//
// Check type of item
//
logDebug("rules.V_WINDOW", "V_WINDOW_changes finished.")
end

/*
* end-of-rules/V_WINDOW.rules
*/
```

## Debugging

For those who are interested in more detailed insight of the processing of this binding, a deeper look can be achieved by increased loglevel.

With Karaf you can use the following command sequence:
```
log:set TRACE org.openhab.binding.velux
log:tail
```

This, of course, is possible on command line with the commands:

```
% openhab-cli console log:set TRACE org.openhab.binding.velux
% openhab-cli console log:tail org.openhab.binding.velux
```

On the other hand, if you prefer a textual configuration, you can append the logging definition with:

```
<logger name="org.openhab.binding.velux" level="TRACE">
<appender-ref ref="FILE" />
</logger>
```

During startup of normal operations, there should be only some few messages within the logfile, like:

```
[INFO ] [.velux.internal.VeluxActivator] - velux binding has been started.
[INFO ] [.b.velux.internal.VeluxBinding] - Active items are: [V_DG_M_W, ..., V_DG_M_S].
Expand Down Expand Up @@ -304,9 +428,23 @@ Notes:
- Firmware updates are currently provided at [Velux download area](https://updates2.velux.com/).


## Is it possible to run the both communication methods in parallel?

For environments with the firmware version 0.1.* on the gateway, the interaction with the bridge is limited to the HTTP/JSON based communication, of course. On the other hand, after upgrading the gateway firmware to version 2, it is possible to run the binding either using HTTP/JSON if there is a permanent connectivity towards the WLAN interface of the KLF200 or using SLIP towards the LAN interface of the gateway. For example the Raspberry PI can directly be connected via WLAN to the Velux gateway and providing the other services via the LAN interface (but not vice versa).


## Known Limitations

The communication based on HTTP/JSON is limited to one connection: If the binding is operational, you won't get access to the Web Frontend in parallel.

The SLIP communication is limited to two connections in parallel, i.e. two different openHAB bindings - or - one openHAB binding and another platform connection.

Both interfacing methods, HTTP/JSON and SLIP, can be run in parallel. Therefore, on the one hand you can use the Web Frontend for manual control and on the other hand a binding can do all automatic jobs.


## Unknown Velux devices

All known <B>Velux</B> devices can be handled by this binding. However, there might be some new ones which will be reported within the logfiles.Therefore, error messages like the one below should be reported to the maintainers so that the new Velux device type can be incorporated."
All known <B>Velux</B> devices can be handled by this binding. However, there might be some new ones which will be reported within the logfiles. Therefore, error messages like the one below should be reported to the maintainers so that the new Velux device type can be incorporated."

```
[ERROR] [g.velux.things.VeluxProductReference] - PLEASE REPORT THIS TO MAINTAINER: VeluxProductReference(3) has found an unregistered ProductTypeId.
Expand Down
1 change: 1 addition & 0 deletions bundles/binding/org.openhab.binding.velux/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source.. = src/main/java/
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
lib/,\
NOTICE,\
ESH-INF/
output.. = target/classes/
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class VeluxBindingConstants {

// List of all bridge channel ids
public static final String CHANNEL_BRIDGE_STATUS = "status";
public static final String CHANNEL_BRIDGE_RELOAD = "reload";
public static final String CHANNEL_BRIDGE_TIMESTAMP = "timestamp";
public static final String CHANNEL_BRIDGE_DO_DETECTION = "doDetection";
public static final String CHANNEL_BRIDGE_FIRMWARE = "firmware";
public static final String CHANNEL_BRIDGE_IPADDRESS = "ipAddress";
Expand Down
Loading