Skip to content

Commit

Permalink
initial contribution Windcentrale binding (#1535)
Browse files Browse the repository at this point in the history
* WindCentrale binding

Binding for windcentrale incl code reviews & updates

Also-by: Wouter Born <[email protected]>
Also-by: Martin van Wingerden <[email protected]>
Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv authored and kaikreuzer committed Jun 11, 2017
1 parent f659876 commit 83fcbb5
Show file tree
Hide file tree
Showing 16 changed files with 584 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/binding/org.openhab.binding.windcentrale/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.windcentrale/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.windcentrale</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="windcentrale"
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">

<name>Windcentrale Binding</name>
<description>Binding for Windcentrale windmills</description>
<author>Marcel Verpaalen</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# binding
binding.windcentrale.name = Windcentrale Binding
binding.windcentrale.description = Binding voor Windcentrale windmolens

# thing types
thing-type.windcentrale.mill.label = Windcentrale windmolen
thing-type.config.windcentrale.mill.millId.label = Windmolen
thing-type.config.windcentrale.mill.wd.label = Aantal Winddelen
thing-type.config.windcentrale.mill.wd.description = Aantal Winddelen in bezit
thing-type.config.windcentrale.mill.refreshInterval.label = Ververs interval
thing-type.config.windcentrale.mill.refreshInterval.description = Ververs interval in seconden

# channels
channel.windcentrale.windSpeed.label = Windsnelheid (Bft)
channel.windcentrale.windDirection.label = Windrichting
channel.windcentrale.powerAbsTot.label = Productie vermogen molen
channel.windcentrale.powerAbsWd.label = Vermogen van de Winddelen
channel.windcentrale.powerRel.label = Relatief vermogen
channel.windcentrale.kwh.label = Productie
channel.windcentrale.kwhForecast.label = Verwachte productie
channel.windcentrale.runPercentage.label = Molen productie percentage
channel.windcentrale.runPercentage.description = Molen productie percentage dit jaar
channel.windcentrale.timestamp.label = Ververs tijdstip
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="windcentrale" 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="mill">
<label>Windcentrale windmill</label>

<channels>
<channel id="windSpeed" typeId="windSpeed" />
<channel id="windDirection" typeId="windDirection" />
<channel id="powerAbsTot" typeId="powerAbsTot" />
<channel id="powerAbsWd" typeId="powerAbsWd" />
<channel id="powerRel" typeId="powerRel" />
<channel id="kwh" typeId="kwh" />
<channel id="kwhForecast" typeId="kwhForecast" />
<channel id="runPercentage" typeId="runPercentage" />
<channel id="timestamp" typeId="timestamp" />
</channels>

<properties>
<property name="vendor">Windcentrale</property>
</properties>

<config-description>
<parameter name="millId" type="integer" required="true">
<label>Windmill</label>
<options>
<option value="1">De Grote Geert</option>
<option value="2">De Jonge Held</option>
<option value="31">Het Rode Hert</option>
<option value="41">De Ranke Zwaan</option>
<option value="51">De Witte Juffer</option>
<option value="111">De Bonte Hen</option>
<option value="121">De Trouwe Wachter</option>
<option value="131">De Blauwe Reiger</option>
<option value="141">De Vier Winden</option>
<option value="191">De Boerenzwaluw</option>
</options>
<default>131</default>
</parameter>
<parameter name="wd" type="integer" required="false">
<label>Wind shares</label>
<description>Number of wind shares ("Winddelen")</description>
<default>1</default>
</parameter>
<parameter name="refreshInterval" type="integer" min="1" max="9999" required="false">
<label>Refresh interval</label>
<description>Refresh interval for refreshing the data in seconds</description>
<default>30</default>
<advanced>true</advanced>
</parameter>
</config-description>
</thing-type>

<channel-type id="windSpeed">
<item-type>Number</item-type>
<label>Wind speed</label>
<category>Wind</category>
<state pattern="%.1d Bft" readOnly="true" />
</channel-type>
<channel-type id="windDirection">
<item-type>String</item-type>
<label>Wind direction</label>
<state pattern="%s" readOnly="true" />
</channel-type>
<channel-type id="powerRel">
<item-type>Number</item-type>
<label>Relative power</label>
<category>Energy</category>
<state pattern="%.1f %%" readOnly="true" />
</channel-type>
<channel-type id="runPercentage">
<item-type>Number</item-type>
<label>Run percentage</label>
<description>Run percentage this year</description>
<category>Energy</category>
<state pattern="%.1f %%" readOnly="true" />
</channel-type>
<channel-type id="powerAbsWd">
<item-type>Number</item-type>
<label>Wind shares power</label>
<category>Energy</category>
<state pattern="%.1f W" readOnly="true" />
</channel-type>
<channel-type id="powerAbsTot">
<item-type>Number</item-type>
<label>Total power</label>
<category>Energy</category>
<state pattern="%.1f kW" readOnly="true" />
</channel-type>
<channel-type id="kwh">
<item-type>Number</item-type>
<label>Energy</label>
<category>Energy</category>
<state pattern="%.0f kWh" readOnly="true" />
</channel-type>
<channel-type id="kwhForecast">
<item-type>Number</item-type>
<label>Energy forecast</label>
<category>Energy</category>
<state pattern="%.0f kWh" readOnly="true" />
</channel-type>
<channel-type id="timestamp">
<item-type>DateTime</item-type>
<label>Last updated</label>
<state readOnly="true" />
</channel-type>
</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Windcentrale Binding
Bundle-SymbolicName: org.openhab.binding.windcentrale;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Import-Package: com.google.common.collect,
com.google.gson,
org.apache.commons.io,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.cache,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.types,
org.eclipse.smarthome.io.net.http,
org.openhab.binding.windcentrale,
org.openhab.binding.windcentrale.handler,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.windcentrale,
org.openhab.binding.windcentrale.handler
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010-2017 by the respective copyright holders.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
-->
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.openhab.binding.windcentrale.internal.WindcentraleHandlerFactory">

<implementation class="org.openhab.binding.windcentrale.internal.WindcentraleHandlerFactory"/>

<service>
<provide interface="org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory"/>
</service>

</scr:component>
50 changes: 50 additions & 0 deletions addons/binding/org.openhab.binding.windcentrale/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Windcentrale Binding

This Binding is used to display the details of a Windcentrale windmill.

## Supported Things

This Binding supports Windcentrale mill devices.

## Discovery

There is no discovery available for this binding.

## Binding Configuration

No binding configuration required.

## Thing Configuration

The thing mandatory configuration is the selection of the mill.
Optional configuration is the number of wind shares ("Winddelen") and the refresh interval.

## Channels

- **windSpeed** Measured current wind speed
- **windDirection** Current wind direction
- **powerAbsTot** Total power
- **powerAbsWd** Power provided for your wind shares
- **powerRel** Relative power
- **kwh** Current energy
- **kwhForecast** Energy forecast
- **runPercentage** Run percentage this year
- **timestamp** Timestamp of the last update


## Full example

```
Group gReiger "Windcentrale Reiger" <wind>
Number ReigerWindSpeed "Windsnelheid [%1.0f Bft]" <wind> (gReiger) {channel="windcentrale:mill:reiger:windSpeed")
String ReigerWindDirection "Windrichting [%s]" <wind> (gReiger) {channel="windcentrale:mill:reiger:windDirection")
Number ReigerPowerAbsTot "Productie molen [%1.0f kW]" <wind> (gReiger) {channel="windcentrale:mill:reiger:powerAbsTot")
Number ReigerPowerAbsWd "WD power [%1.0f W]" <wind> (gReiger) {channel="windcentrale:mill:reiger:powerAbsWd")
Number ReigerPowerRel "Productie vermogen [%1.0f %%]" <wind> (gReiger) {channel="windcentrale:mill:reiger:powerRel")
Number ReigerKwh "kwh [%1.0f]" <wind> (gReiger) {channel="windcentrale:mill:reiger:kwh")
Number ReigerKwhForecast "Productie forecast [%1.0f]" <wind> (gReiger) {channel="windcentrale:mill:reiger:kwhForecast")
Number ReigerRunPercentage "Run percentage [%1.0f %%]" <wind> (gReiger) {channel="windcentrale:mill:reiger:runPercentage")
Number ReigerTimestamp "Update timestamp [%1$ta %1$tR]" <wind> (gReiger) {channel="windcentrale:mill:reiger:timestamp")
```
28 changes: 28 additions & 0 deletions addons/binding/org.openhab.binding.windcentrale/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>

<p>June 5, 2006</p>
<h3>License</h3>

<p>The openHAB community makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
indicated below, the Content is provided to you under the terms and conditions of the
Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>

<p>If you did not receive this Content directly from the openHAB community, the Content is
being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
apply to your use of any object code in the Content. Check the Redistributor's license that was
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
indicated below, the terms and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="http://www.openhab.org/">openhab.org</a>.</p>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source.. = src/main/java/
output.. = target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/,\
about.html
19 changes: 19 additions & 0 deletions addons/binding/org.openhab.binding.windcentrale/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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.binding</groupId>
<artifactId>pom</artifactId>
<version>2.1.0-SNAPSHOT</version>
</parent>

<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.windcentrale</artifactId>
<version>2.1.0-SNAPSHOT</version>

<name>Windcentrale Binding</name>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* Copyright (c) 2010-2017 by the respective copyright holders.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.openhab.binding.windcentrale;

import java.util.Collections;
import java.util.Set;

import org.eclipse.smarthome.core.thing.ThingTypeUID;

/**
* The {@link WindcentraleBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Marcel Verpaalen - Initial contribution
*/
public final class WindcentraleBindingConstants {

public static final String BINDING_ID = "windcentrale";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_MILL = new ThingTypeUID(BINDING_ID, "mill");

public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_MILL);

// List of all Channel IDs
public static final String CHANNEL_WIND_SPEED = "windSpeed";
public static final String CHANNEL_WIND_DIRECTION = "windDirection";
public static final String CHANNEL_POWER_TOTAL = "powerAbsTot";
public static final String CHANNEL_POWER_PER_WD = "powerAbsWd";
public static final String CHANNEL_POWER_RELATIVE = "powerRel";
public static final String CHANNEL_ENERGY = "kwh";
public static final String CHANNEL_ENERGY_FC = "kwhForecast";
public static final String CHANNEL_RUNTIME = "hoursRunThisYear";
public static final String CHANNEL_RUNTIME_PER = "runPercentage";
public static final String CHANNEL_LAST_UPDATE = "timestamp";

public static final String PROPERTY_MILL_ID = "millId";
public static final String PROPERTY_QTY_WINDDELEN = "wd";
public static final String PROPERTY_REFRESH_INTERVAL = "refreshInterval";

}
Loading

0 comments on commit 83fcbb5

Please sign in to comment.