Skip to content

Commit

Permalink
Bosch Indego Connect Binding (openhab#1202)
Browse files Browse the repository at this point in the history
Bosch Indego Connect Binding

Signed-off-by: Jonas Fleck [email protected] (github: jofleck)
  • Loading branch information
jofleck authored and fharni committed Feb 10, 2017
1 parent f51dcd1 commit 2655811
Show file tree
Hide file tree
Showing 22 changed files with 701 additions and 0 deletions.
13 changes: 13 additions & 0 deletions addons/binding/org.openhab.binding.boschindego/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/jackson-annotations-2.8.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.8.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-databind-2.8.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpclient-4.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.4.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/bosch-indego-controller-lib-0.8.jar"/>
<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>
1 change: 1 addition & 0 deletions addons/binding/org.openhab.binding.boschindego/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.boschindego/.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.boschindego</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="boschindego"
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>BoschIndego Binding</name>
<description>This is the binding for Bosch Indego Connect lawn mowers.</description>
<author>Jonas Fleck</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="boschindego"
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="indego">
<label>Bosch Indego</label>
<description>Indego which supports the connect feature.</description>
<channels>
<channel id="state" typeId="state"/>
<channel id="textualstate" typeId="textualstate"/>
<channel id="errorcode" typeId="errorcode"/>
<channel id="statecode" typeId="statecode"/>
<channel id="mowed" typeId="mowed"/>
<channel id="ready" typeId="ready"/>
</channels>
<config-description>
<parameter name="username" type="text" required="true">
<label>Username</label>
<description>Username for the Bosch Indego account.</description>
</parameter>
<parameter name="password" type="text" required="true">
<context>password</context>
<label>Password</label>
<description>Password for the Bosch Indego account.</description>
</parameter>
<parameter name="refresh" type="integer" min="60">
<label>Refresh interval</label>
<description>Specifies the refresh interval in seconds.</description>
<default>180</default>
</parameter>
</config-description>
</thing-type>

<!-- Sample Channel Type -->
<channel-type id="state">
<item-type>Number</item-type>
<label>Numeric state</label>
<state readOnly="false">
<options>
<option value="1">Mow</option>
<option value="2">Charge/Dock</option>
<option value="3">Pause</option>
</options>
</state>
</channel-type>
<channel-type id="errorcode" advanced="true">
<item-type>Number</item-type>
<label>Error Code</label>
<description>0 = no error</description>
<state readOnly="false"></state>
</channel-type>
<channel-type id="statecode" advanced="true">
<item-type>Number</item-type>
<label>State code</label>
<description>API-code of the Indego state</description>
<state readOnly="true">
<options>
<option value="0">Reading status</option>
<option value="257">Charging</option>
<option value="258">Docked</option>
<option value="259">Docked - Software update</option>
<option value="260">Docked</option>
<option value="261">Docked</option>
<option value="262">Docked - Loading map</option>
<option value="263">Docked - Saving map</option>
<option value="512">Mowing</option>
<option value="514">Relocalising</option>
<option value="515">Loading map</option>
<option value="516">Learning lawn</option>
<option value="517">Paused</option>
<option value="518">Border cut</option>
<option value="519">Idle in lawn</option>
<option value="769">Returning to Dock</option>
<option value="770">Returning to Dock</option>
<option value="771">Returning to Dock - Battery low</option>
<option value="772">Returning to Dock - Calendar timeslot ended</option>
<option value="773">Returning to Dock - Battery temp range</option>
<option value="774">Returning to Dock</option>
<option value="775">Returning to Dock - Lawn complete</option>
<option value="775">Returning to Dock - Relocalising</option>
</options>
</state>
</channel-type>
<channel-type id="textualstate">
<item-type>String</item-type>
<label>Textual State</label>
<description></description>
<state readOnly="true" />
</channel-type>
<channel-type id="mowed">
<item-type>Dimmer</item-type>
<label>Cut grass</label>
<description></description>
<state readOnly="true" pattern="%d %%"></state>
</channel-type>
<channel-type id="ready">
<item-type>Number</item-type>
<label>Ready</label>
<description>Indicates if mower is ready to mow</description>
<state readOnly="true">
<options>
<option value="0">not ready</option>
<option value="1">ready</option>
</options>
</state>
</channel-type>

</thing:thing-descriptions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: BoschIndego Binding
Bundle-SymbolicName: org.openhab.binding.boschindego;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .,
lib/bosch-indego-controller-lib-0.8.jar,
lib/httpclient-4.5.2.jar,
lib/httpcore-4.4.4.jar,
lib/jackson-annotations-2.8.6.jar,
lib/jackson-core-2.8.6.jar,
lib/jackson-databind-2.8.6.jar
Import-Package:
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.logging,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.thing.binding.builder,
org.eclipse.smarthome.core.thing.type,
org.eclipse.smarthome.core.types,
org.openhab.binding.boschindego,
org.openhab.binding.boschindego.handler,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.boschindego,
org.openhab.binding.boschindego.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) 2014-2016 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="binding.boschindego">

<implementation class="org.openhab.binding.boschindego.internal.BoschIndegoHandlerFactory"/>

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

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

This is the Binding for Bosch Indego Connect lawn mowers.

Thank´s to zazaz-de who found out how the API works. His [Java Library](https://github.com/zazaz-de/iot-device-bosch-indego-controller) made this Binding possible.

## Configuration of the thing


Currently the binding supports ***indego*** mowers as a thing type with this parameters:

| parameter | datatype | required |
|---|---|---|
| username | String | yes |
| password | String | yes |
| refresh | integer| no (default: 180, minimum: 60)|

The refresh interval is specified in seconds.

A possible entry in your thing file could be:

```
boschindego:indego:lawnmower [username="[email protected]", password="idontneedtocutthelawnagain", refresh=120]
```


## Channels

channel | item-type | description |
|---|---|---|
| state | Number | You can send commands to this channel to control the mower and read the simplified state from it (1=mow, 2=return to dock, 3=pause)|
| errorcode | Number | Errorcode of the mower (0=no error, readonly) |
| statecode | Number | Detailed state of the mower. I included English and German map-files to read the state easier (readonly)|
|textualstate| String| State as a text. (readonly)|
|ready | Number | Shows if the mower is ready to mow (1=ready, 0=not ready, readonly)|
|mowed | Dimmer | Cut grass in percent (readonly)|

For example you can use this sitemap entry to control the mower manually:

```
Switch item=indegostate mappings=[ 1="Mow", 2="Return",3="Pause" ]
```

## Meaning of the numeric statecodes

You can use this as .map file

```
0=Reading status
257=Charging
258=Docked
259=Docked - Software update
260=Docked
261=Docked
262=Docked - Loading map
263=Docked - Saving map
513=Mowing
514=Relocalising
515=Loading map
516=Learning lawn
517=Paused
518=Border cut
519=Idle in lawn
769=Returning to Dock
770=Returning to Dock
771=Returning to Dock - Battery low
772=Returning to dock - Calendar timeslot ended
773=Returning to dock - Battery temp range
774=Returning to dock
775=Returning to dock - Lawn complete
776=Returning to dock - Relocalising
```




15 changes: 15 additions & 0 deletions addons/binding/org.openhab.binding.boschindego/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!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>
<h3>Third Party Content</h3>
<ul>
<li><a href="https://github.com/zazaz-de/iot-device-bosch-indego-controller/">API for Bosch Indego Connect</a>: Controller application and API for Bosch Indego Connect, under Apache 2.0 license</li>
</ul>
</body>
</html>
13 changes: 13 additions & 0 deletions addons/binding/org.openhab.binding.boschindego/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source.. = src/main/java/
output.. = target/classes
bin.includes = META-INF/,\
.,\
OSGI-INF/,\
ESH-INF/,\
lib/bosch-indego-controller-lib-0.8.jar,\
lib/httpclient-4.5.2.jar,\
lib/httpcore-4.4.4.jar,\
lib/jackson-annotations-2.8.6.jar,\
lib/jackson-core-2.8.6.jar,\
lib/jackson-databind-2.8.6.jar

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions addons/binding/org.openhab.binding.boschindego/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.boschindego</artifactId>
<version>2.1.0-SNAPSHOT</version>

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

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright (c) 2014-2016 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.boschindego;

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

/**
* The {@link BoschIndegoBinding} class defines common constants, which are
* used across the whole binding.
*
* @author Jonas Fleck - Initial contribution
*/
public class BoschIndegoBindingConstants {

public static final String BINDING_ID = "boschindego";

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

// List of all Channel ids
public final static String STATE = "state";
public final static String TEXTUAL_STATE = "textualstate";
public final static String MOWED = "mowed";
public final static String ERRORCODE = "errorcode";
public final static String STATECODE = "statecode";
public final static String READY = "ready";

}
Loading

0 comments on commit 2655811

Please sign in to comment.