Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2233 from digitaldan/autelis-binding
Browse files Browse the repository at this point in the history
Initial Commit of the Autelis Pool Control binding for openHAB
  • Loading branch information
teichsta committed May 12, 2015
2 parents f4b1cd7 + c54fe3f commit 39224d1
Show file tree
Hide file tree
Showing 13 changed files with 942 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/.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.autelis</name>
<comment>This is the autelis binding of the open Home Automation Bus (openHAB)</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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
28 changes: 28 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Manifest-Version: 1.0
Private-Package: org.openhab.binding.autelis.internal
Ignore-Package: org.openhab.binding.autelis.internal
Bundle-License: http://www.eclipse.org/legal/epl-v10.html
Bundle-Name: openHAB Autelis Binding
Bundle-SymbolicName: org.openhab.binding.autelis
Bundle-Vendor: openHAB.org
Bundle-Version: 1.7.0.qualifier
Bundle-ManifestVersion: 2
Bundle-Description: This is the Autelis binding of the open Home Aut
omation Bus (openHAB)
Import-Package: org.apache.commons.lang,
org.openhab.core.binding,
org.openhab.core.events,
org.openhab.core.items,
org.openhab.core.library.items,
org.openhab.core.library.types,
org.openhab.core.types,
org.openhab.io.net.http,
org.openhab.model.item.binding,
org.osgi.framework,
org.osgi.service.component,
org.osgi.service.event,
org.slf4j
Bundle-DocURL: http://www.openhab.org
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Service-Component: OSGI-INF/binding.xml, OSGI-INF/genericbindingprovider.xml
Bundle-ClassPath: .
28 changes: 28 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/OSGI-INF/binding.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010-2015, openHAB.org 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.2.0" activate="activate" modified="modified" deactivate="deactivate" name="org.openhab.binding.autelis.binding" immediate="true" configuration-pid="org.openhab.autelis" configuration-policy="require">
<implementation class="org.openhab.binding.autelis.internal.AutelisBinding" />

<service>
<provide interface="org.osgi.service.event.EventHandler" />
</service>

<property name="event.topics" type="String" value="openhab/command/*" />

<reference bind="setEventPublisher" cardinality="1..1"
interface="org.openhab.core.events.EventPublisher" name="EventPublisher"
policy="dynamic" unbind="unsetEventPublisher" />
<reference bind="addBindingProvider" cardinality="1..n"
interface="org.openhab.binding.autelis.AutelisBindingProvider" name="AutelisBindingProvider"
policy="dynamic" unbind="removeBindingProvider" />

</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2010-2015, openHAB.org 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" name="org.openhab.binding.autelis.genericbindingprovider">
<implementation class="org.openhab.binding.autelis.internal.AutelisGenericBindingProvider"/>

<service>
<provide interface="org.openhab.model.item.binding.BindingConfigReader"/>
<provide interface="org.openhab.binding.autelis.AutelisBindingProvider"/>
</service>

</scr:component>
158 changes: 158 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
## Introduction

This is a OpenHab binding for Autelis pool controllers

Autelis manufactures a network enabled pool interface for many popular pool systems. See [the Autelis webiste](http://www.autelis.com) and the [Autelis Command Protocol](http://www.autelis.com/wiki/index.php?title=Pool_Control_(PI)_HTTP_Command_Reference) for more information.

The binding is fairly complete and supports the following functionality.

* Read circuit, auxiliary, temperature, pump, chemistry and system values
* Control circuit, auxiliary lighting scenes, and temperature set points

## Installation

Copy the binding jar (org.openhab.autelis*.jar) to the addons directory

add the following to your openhab.cfg and comment out the relevant options
```
############################### Autelis Pool Control Binding #########################
#
# Host (name or ip) to connect to
# optional port (default 80)
# optional username and password (no default)
# optional refresh rate in millis (default 5000)
#
#autelis:refresh=5000
#autelis:host=poolcontrol
#autelis:port=80
#autelis:username=admin
#autelis:password=admin
```

## Items

format is
`{autelis:"parentNode.childElement"}`
or
`{autelis:"lightscmd"}`

An example to get the system version would be:

`{autelis="system.version"}`

* only 'equipment.*', 'temp.*' and 'lightscmd' items can be updated from openhab, everything else is read only.
* For lighting commands the following strings can be sent to a item configured with "{autels:"lightscmd"}" (through a mapped push button for example)
* 'alloff, allon, csync, cset, cswim, party, romance, caribbean, american, sunset, royalty, blue, green, red, white, magenta, hold, recall`

The following are a listing of possible values for the configuration string using a sample xml output from a Autelis controller:

```xml
<system>
<runstate>50</runstate>
<model>13</model>
<haddr>20</haddr>
<opmode>0</opmode>
<freeze>0</freeze>
<sensor1>0</sensor1>
<sensor2>0</sensor2>
<sensor3>0</sensor3>
<sensor4>0</sensor4>
<sensor5>0</sensor5>
<version>1.4.4</version>
<time>1425269492</time>
</system>
<equipment>
<circuit1>0</circuit1>
<circuit2>0</circuit2>
<circuit3>0</circuit3>
<circuit4>0</circuit4>
<circuit5>0</circuit5>
<circuit6>0</circuit6>
<circuit7>0</circuit7>
<circuit8>0</circuit8>
<circuit9>0</circuit9>
<circuit10></circuit10>
<circuit11></circuit11>
<circuit12></circuit12>
<circuit13></circuit13>
<circuit14></circuit14>
<circuit15></circuit15>
<circuit16></circuit16>
<circuit17></circuit17>
<circuit18></circuit18>
<circuit19></circuit19>
<circuit20>0</circuit20>
<feature1>0</feature1>
<feature2>0</feature2>
<feature3>0</feature3>
<feature4>0</feature4>
<feature5>0</feature5>
<feature6>0</feature6>
<feature7>0</feature7>
<feature8>0</feature8>
<feature9></feature9>
<feature10></feature10>
</equipment>
<temp>
<poolht>1</poolht>
<spaht>1</spaht>
<htstatus>0</htstatus>
<poolsp>71</poolsp>
<spasp>101</spasp>
<pooltemp>60</pooltemp>
<spatemp>60</spatemp>
<airtemp>55</airtemp>
<tempunits>F</tempunits>
<htpump>0</htpump>
</temp>
<pumps>
<pump1>0,0,0</pump1>
<pump2></pump2>
<pump3></pump3>
<pump4></pump4>
<pump5></pump5>
<pump6></pump6>
<pump7></pump7>
<pump8></pump8>
</pumps>
<chlor>
<chloren>1</chloren>
<poolsp>50</poolsp>
<spasp>0</spasp>
<salt>58</salt>
<super>0</super>
<chlorerr>0</chlorerr>
<chlorname>Intellichlor--40</chlorname>
</chlor>
```

## More Item Examples

```
String PoolVersion "Version [%s]" {autelis="system.version"}
Number PoolSetPoint "Pool SetPoint [%d]" {autelis="temp.poolsp"}
Number PoolTemp "Pool Temp [%d]" {autelis="temp.pooltemp"}
Number PoolSpaTemp "Spa Temp [%d]" {autelis="temp.spatemp"}
Number PoolAirTemp "Air Temp [%d]" {autelis="temp.airtemp"}
Number PoolSpaSetPoint "Spa SetPoint [%d]" {autelis="temp.spasp"}
Number PoolChemSalt "Salt Levels [%d]" {autelis="chlor.salt"}
Switch PoolSpaMode "Spa Mode [%s]" {autelis="equipment.circuit1"}
Switch PoolMode "Pool Mode [%s]" {autelis="equipment.circuit6"}
Switch PoolWaterfall "Waterfall [%s]" {autelis="equipment.circuit2"}
Switch PoolSpaLight "Spa Light [%s]" {autelis="equipment.circuit3"}
Switch PoolLight "Pool Light [%s]" {autelis="equipment.circuit4"}
String PoolLightCmd {autelis="lightscmd"}
```

6 changes: 6 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/main/java/,\
src/main/resources/
bin.includes = META-INF/,\
.,\
OSGI-INF/
output.. = target/classes/
35 changes: 35 additions & 0 deletions bundles/binding/org.openhab.binding.autelis/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<parent>
<groupId>org.openhab.bundles</groupId>
<artifactId>binding</artifactId>
<version>1.7.0-SNAPSHOT</version>
</parent>

<properties>
<bundle.symbolicName>org.openhab.binding.autelis</bundle.symbolicName>
<bundle.namespace>org.openhab.binding.autelis</bundle.namespace>
<deb.name>openhab-addon-binding-Autelis</deb.name>
<deb.description>openhab addon binding Autelis</deb.description>
</properties>

<modelVersion>4.0.0</modelVersion>
<groupId>org.openhab.binding</groupId>
<artifactId>org.openhab.binding.autelis</artifactId>

<name>openHAB Autelis Binding</name>

<packaging>eclipse-plugin</packaging>

<build>
<plugins>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2010-2015, openHAB.org 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.autelis;

import org.openhab.core.binding.BindingProvider;
import org.openhab.core.items.Item;

/**
*
* Provides a mapping between openHAB {@link Item}s and a Autelis Pool controller.
* @author Dan Cunningham
* @since 1.7.0
*/
public interface AutelisBindingProvider extends BindingProvider {

/**
* Returns an {@link Item} for a given item name
* @param itemName
* @return {@link Item} for the given item name
*/
public Item getItem(String itemName);

/**
* Returns the binding configuration for an item as a {@link String}
* @param itemName
* @return {@link String}
*/
public String getAutelisBindingConfigString(String itemName);
}
Loading

0 comments on commit 39224d1

Please sign in to comment.