Skip to content

Commit

Permalink
Initial Contribution for OH2 Max!Cube binding
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Verpaalen <[email protected]>
  • Loading branch information
marcelrv committed Nov 21, 2014
1 parent 28ca319 commit 751b7ec
Show file tree
Hide file tree
Showing 42 changed files with 3,844 additions and 0 deletions.
7 changes: 7 additions & 0 deletions addons/binding/org.openhab.binding.maxcube/.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.maxcube/.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.maxcube</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,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="maxcube"
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>MaxCube Binding</name>
<description>This is the binding for eQ-3 MaxCube heating Thermostat.</description>
<author>Marcel Verpaalen</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="maxcube"
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 org.eclipse.smarthome.thing-description.xsd">

<bridge-type id="bridge">
<label>MAX!Cube LAN gateway</label>
<description>This bridge represents the MAX!Cube LAN gateway.</description>

<config-description>
<parameter name="ipAddress" type="text">
<context>network_address</context>
<label>MAX!Cube LAN gateway IP</label>
<description>The IP address of the MAX!Cube LAN gateway. If none provided, binding will try to discover it.</description>
<required>false</required>
</parameter>
<parameter name="port" type="integer">
<context>port</context>
<label>MAX!Cube LAN gateway port</label>
<description>
Port of the LAN gateway. If empty, default port 62910 will be used.
</description>
<required>false</required>
</parameter>
<parameter name="refreshInterval" type="integer">
<label>Refresh Interval</label>
<description>The refresh interval in ms which is used to poll given MAX!Cube.</description>
<required>false</required>
</parameter>
<parameter name="serialNumber" type="text">
<label>Serial Number</label>
<description>The Serial Number identifier identifies one specific device.</description>
<required>false</required>
</parameter>
</config-description>
</bridge-type>


</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="maxcube"
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">

<!-- All Thermostats (Heating, Heating+, Wall) -->
<thing-type id="thermostat">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>

<label>MaxCube HeathingThermostat</label>
<description>MaxCube HeathingThermostat</description>

<channels>
<channel id="valve" typeId="valve-channel" />
<channel id="battery" typeId="battery-channel" />
<channel id="mode" typeId="mode-channel" />
<channel id="actual_temp" typeId="actual_temp-channel" />
<channel id="set_temp" typeId="set_temp-channel" />
</channels>

<config-description>
<parameter name="serialNumber" type="text">
<label>Serial Number</label>
<description>The Serial Number identifier identifies one specific device.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

<!-- All Switches (EcoSwitch, Pushbutton/ShutterContact) -->
<thing-type id="switch">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge" />
</supported-bridge-type-refs>

<label>MaxCube Switches</label>
<description>MaxCube All Switches (EcoSwitch, Pushbutton/ShutterContact)</description>

<channels>
<channel id="state" typeId="switch_state-channel" />
<channel id="battery" typeId="battery-channel" />

</channels>

<config-description>
<parameter name="serialNumber" type="text">
<label>Serial Number</label>
<description>The Serial Number identifier identifies one specific device.</description>
<required>true</required>
</parameter>
</config-description>
</thing-type>

<channel-type id="valve-channel">
<item-type>Number</item-type>
<label>Valve Position Channel</label>
<description>Thermostat Valve Position</description>
</channel-type>

<channel-type id="battery-channel">
<item-type>String</item-type>
<label>Battery Level Channel</label>
<description>Battery charge Level</description>
</channel-type>

<channel-type id="mode-channel">
<item-type>String</item-type>
<label>Mode Channel</label>
<description>Thermostat Mode Setting</description>
</channel-type>

<channel-type id="actual_temp-channel">
<item-type>Number</item-type>
<label>Actual Temperature Channel</label>
<description>Actual measured room temperature</description>
</channel-type>

<channel-type id="set_temp-channel">
<item-type>Number</item-type>
<label>Set Temperature Channel</label>
<description>Thermostat temperature setpoint</description>
</channel-type>


<channel-type id="switch_state-channel">
<item-type>Contact</item-type>
<label>Switch state Channel</label>
<description>Switch state information</description>
</channel-type>

</thing:thing-descriptions>
25 changes: 25 additions & 0 deletions addons/binding/org.openhab.binding.maxcube/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MaxCube Binding
Bundle-SymbolicName: org.openhab.binding.maxcube;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .
Import-Package: com.google.common.collect,
org.apache.commons.net.util;version="3.2.0",
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.common.registry,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.types,
org.openhab.core.library.types,
org.openhab.core.types,
org.osgi.framework;version="1.8.0",
org.slf4j
Service-Component: OSGI-INF/*
Export-Package: org.openhab.binding.maxcube,
org.openhab.binding.maxcube.internal.handler
Require-Bundle: org.eclipse.osgi.services
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 openHAB UG (haftungsbeschraenkt) and others.
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.maxcube.internal.discovery">

<implementation class="org.openhab.binding.maxcube.internal.discovery.MaxCubeBridgeDiscovery"/>

<service>
<provide interface="org.eclipse.smarthome.config.discovery.DiscoveryService"/>
</service>

</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 openHAB UG (haftungsbeschraenkt) and others.
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.maxcube.internal.factory.MaxCubeHandlerFactory">

<implementation class="org.openhab.binding.maxcube.internal.factory.MaxCubeHandlerFactory"/>

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

</scr:component>
6 changes: 6 additions & 0 deletions addons/binding/org.openhab.binding.maxcube/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/main/java/
output.. = target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/
24 changes: 24 additions & 0 deletions addons/binding/org.openhab.binding.maxcube/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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</groupId>
<artifactId>binding</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<properties>
<bundle.symbolicName>org.openhab.binding.maxcube</bundle.symbolicName>
<bundle.namespace>org.openhab.binding.maxcube</bundle.namespace>
</properties>

<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.maxcube</artifactId>
<version>2.0.0-SNAPSHOT</version>

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

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschraenkt) and others.
* 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.maxcube;

import java.util.Collection;
import java.util.Set;

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

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;

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

public static final String BINDING_ID = "maxcube";

// List of main device types
public static final String DEVICE_THERMOSTAT = "thermostat";
public static final String DEVICE_SWITCH = "switch";
public static final String BRIDGE_MAXCUBE = "bridge";

// List of all Thing Type UIDs
public final static ThingTypeUID HEATHINGTHERMOSTAT_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_THERMOSTAT);
public final static ThingTypeUID SWITCH_THING_TYPE = new ThingTypeUID(BINDING_ID, DEVICE_SWITCH);

// List of all Thing Type UIDs
public final static ThingTypeUID CubeBridge_THING_TYPE = new ThingTypeUID(BINDING_ID, BRIDGE_MAXCUBE);

// List of all Channel ids
public final static String CHANNEL_VALVE = "valve";
public final static String CHANNEL_BATTERY = "battery";
public final static String CHANNEL_MODE = "mode";
public final static String CHANNEL_ACTUALTEMP = "actual_temp";
public final static String CHANNEL_SETTEMP = "set_temp";
public final static String CHANNEL_SWITCH_STATE = "state";

public final static Collection<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Lists.newArrayList(
HEATHINGTHERMOSTAT_THING_TYPE, SWITCH_THING_TYPE, CubeBridge_THING_TYPE);

public final static Set<ThingTypeUID> SUPPORTED_DEVICE_THING_TYPES_UIDS =ImmutableSet.of(
HEATHINGTHERMOSTAT_THING_TYPE,SWITCH_THING_TYPE);


public final static Set<ThingTypeUID> SUPPORTED_BRIDGE_THING_TYPES_UIDS =ImmutableSet.of(
CubeBridge_THING_TYPE);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.openhab.binding.maxcube.config;
/**
* Copyright (c) 2014 openHAB UG (haftungsbeschraenkt) and others.
* 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
*/



/**
* Configuration class for {@link MaxCubeBinding} bridge
* used to connect to the maxCube device.
*
* @author Marcel Verpaalen - Initial contribution
*/

public class MaxCubeBridgeConfiguration {


public static final String IP_ADDRESS = "ipAddress";
public static final String PORT = "port";
public static final String REFRESH_INTERVAL = "refreshInterval";


/** The IP address of the MAX!Cube LAN gateway */
public String ipAddress;

/**
* The port of the MAX!Cube LAN gateway as provided at
* http://www.elv.de/controller.aspx?cid=824&detail=10&detail2=3484
*/
public int port = (int) 62910;

/** The refresh interval in ms which is used to poll given MAX!Cube */
public Long refreshInterval =(long) 60000;

/** The unique serial number for a device */
public String serialNumber;

}
Loading

0 comments on commit 751b7ec

Please sign in to comment.