Skip to content

Commit

Permalink
[hydrawise] Hydrawise Binding initial contribution (openhab#5877)
Browse files Browse the repository at this point in the history
Signed-off-by: digitaldan <dan@digitaldan.com>
  • Loading branch information
digitaldan authored and hww3 committed Jan 25, 2020
1 parent 828fe1e commit 1ea61e1
Show file tree
Hide file tree
Showing 43 changed files with 3,186 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
/bundles/org.openhab.binding.homematic/ @FStolte @gerrieg @mdicke2s
/bundles/org.openhab.binding.hpprinter/ @cossey
/bundles/org.openhab.binding.hue/ @cweitkamp
/bundles/org.openhab.binding.hydrawise/ @digitaldan
/bundles/org.openhab.binding.hyperion/ @tavalin
/bundles/org.openhab.binding.iaqualink/ @digitaldan
/bundles/org.openhab.binding.icloud/ @pgfeller
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@
<artifactId>org.openhab.binding.hue</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.hydrawise</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.hyperion</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.hydrawise/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions bundles/org.openhab.binding.hydrawise/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.hydrawise</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.hydrawise/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab2-addons
171 changes: 171 additions & 0 deletions bundles/org.openhab.binding.hydrawise/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Hydrawise Binding

![API Key](doc/logo.png)

The Hydrawise binding allows monitoring and control of [Hunter Industries's](https://www.hunterindustries.com/) line of [Hydrawise](https://www.hydrawise.com) internet connected irrigation systems.

## Supported Things

### Cloud Thing

The Cloud Thing type is the primary way most users will control and monitor their irrigation system.
This allows full control over zones, sensors and weather forecasts.
Changes made through this Thing type will be reflected in the Hydrawise mobile and web applications as well as in their reporting modules.

#### Cloud Thing Supported Channel Groups

| channel group ID |
|---------------------------------------|
| [Zones](#Zone-Channel-Group) |
| [All Zones](#All-Zones-Channel-Group) |
| [Sensor](#Sensor-Channel-Group) |
| [Forecast](#Sensor-Channel-Group) |
### Local Thing

The Local Thing type uses an undocumented API that allows direct HTTP access to a irrigation controller on the user's network.
This provides a subset of features compared to the Cloud Thing type limited to basic zone control.
Controlling zones through the local API will not be reported back to the cloud service or the Hydrawise mobile/web applications, and reporting functionality will not reflect the locally controlled state.

Use Cases

* The Local thing can be useful when testing zones, as there is no delay when starting/stopping zones as compared to the cloud API which can take anywhere between 5-15 seconds.
* This is also useful if you wish to not use the cloud scheduling at all and use openHAB as the irrigation scheduling system.

#### Local Thing Supported Channel Groups

| channel group ID |
|---------------------------------------|
| [Zones](#Zone-Channel-Group) |
| [All Zones](#All-Zones-Channel-Group) |

## Thing Configuration

### Cloud Thing

| Configuration Name | type | required | Comments |
|--------------------|---------|----------|------------------------------------------------------------------------------------|
| apiKey | String | True | |
| refresh | Integer | True | Defaults to a 30 seconds polling rate |
| controllerId | Integer | False | Optional id of the controller if you have more then one registered to your account |

To obtain your API key, log into your [Hydrawsie Account](https://app.hydrawise.com/config/login) and click on your account icon, then account details:

![Account](doc/settings.png)

Then copy the API key shown here:

![API Key](doc/apikey.png)

### Local Thing

| Configuration Name | type | required | Comments |
|--------------------|---------|----------|-----------------------------------------------------------------------------------------------------------------|
| host | String | True | IP or host name of the controller on your network |
| username | String | True | User name (usually admin) set on the touch panel of the controller |
| password | String | True | Password set on the touch panel of the controller. This can be found under the setting menu on the controller. |
| refresh | Integer | True | Defaults to a 30 seconds polling rate |

## Channels

### Channel Groups

#### Zone Channel Group

Up to 36 total zones are supported per Local or Cloud thing

| channel group ID | Description |
|------------------|---------------------------|
| zone1 | Zone 1 channel group |
| zone2 | Zone 1 channel group |
| ... | Zone 3 - 35 channel group |
| zone36 | Zone 36 channel group |

#### Sensor Channel Group

Up to 4 total sensors are supported per Cloud Thing

| channel group ID | Description |
|------------------|------------------------|
| sensor1 | Sensor 1 channel group |
| sensor2 | Sensor 2 channel group |
| sensor3 | Sensor 3 channel group |
| sensor4 | Sensor 4 channel group |

#### Forecast Channel Group

Up to 4 total weather forecasts are supported per Cloud Thing

| channel group ID | Description |
|------------------|-----------------|
| forecast1 | Todays Forecast |
| forecast2 | Day 2 Forecast |
| forecast3 | Day 3 Forecast |
| forecast4 | Day 4 Forecast |

#### All Zones Channel Group

A single all zone group are supported per Cloud or Local Thing

| channel group ID | Description |
|------------------|------------------------|
| allzones | commands for all zones |


### Channels

| channel ID | type | Groups | description | Read Write |
|-----------------|--------------------|----------------|---------------------------------------------|------------|
| name | String | zone, sensor | Descriptive name | R |
| icon | String | zone | Icon URL | R |
| time | Number | zone | Zone start time in seconds | R |
| type | Number | zone | Zone type | R |
| runcustom | Number | zone, allzones | Run zone for custom number of seconds | W |
| run | Switch | zone, allzones | Run/Start zone | RW |
| nextrun | DateTime | zone | Next date and time this zone will run | R |
| timeleft | Number | zone | Amount of seconds left for the running zone | R |
| input | Number | sensor | Sensor input type | R |
| mode | Number | sensor | Sensor mode | R |
| timer | Number | sensor | Sensor timer | R |
| offtimer | Number | sensor | Sensor off time | R |
| offlevel | Number | sensor | Sensor off level | R |
| active | Switch | sensor | Is sensor active / triggered | R |
| temperaturehigh | Number:Temperature | forecast | Daily high temperature | R |
| temperaturelow | Number:Temperature | forecast | Daily low temperature | R |
| conditions | String | forecast | Daily conditions description | R |
| day | String | forecast | Day of week of forecast (Mon-Sun) | R |
| humidity | Number | forecast | Daily humidity percentage | R |
| wind | Number:Speed | forecast | Daily wind speed | R |

## Full Example

```
Group SprinklerZones
Group SprinklerZone1 "1 Front Office Yard" (SprinklerZones)
String SprinklerZone1Name "1 Front Office Yard name" (SprinklerZone1) {channel="hydrawise:cloud:home:zone1#name"}
Switch SprinklerZone1Run "1 Front Office Yard Run" (SprinklerZone1) {channel="hydrawise:cloud:home:zone1#run"}
Switch SprinklerZone1RunLocal "1 Front Office Yard Run (local)" (SprinklerZone1) {channel="hydrawise:local:home:zone1#run"}
Number SprinklerZone1RunCustom "1 Front Office Yard Run Custom" (SprinklerZone1) {channel="hydrawise:cloud:home:zone1#runcustom"}
DateTime SprinklerZone1StartTime "1 Front Office Yard Start Time [%s]" (SprinklerZone1) {channel="hydrawise:cloud:home:zone1#nextruntime"}
Number SprinklerZone1TimeLeft "1 Front Office Yard Time Left" (SprinklerZone1) {channel="hydrawise:cloud:home:zone1#timeleft"}
String SprinklerZone1Icon "1 Front Office Yard Icon" (SprinklerZone1) {channel="hydrawise:cloud:home:zone1#icon"}
Group SprinklerZone2 "2 Back Circle Lawn" (SprinklerZones)
String SprinklerZone2Name "2 Back Circle Lawn name" (SprinklerZone2) {channel="hydrawise:cloud:home:zone2#name"}
Switch SprinklerZone2Run "2 Back Circle Lawn Run" (SprinklerZone2) {channel="hydrawise:cloud:home:zone2#run"}
Switch SprinklerZone2RunLocal "2 Back Circle Lawn Run (local)" (SprinklerZone2) {channel="hydrawise:local:home:zone2#run"}
Number SprinklerZone2RunCustom "2 Back Circle Lawn Run Custom" (SprinklerZone2) {channel="hydrawise:cloud:home:zone2#runcustom"}
DateTime SprinklerZone2StartTime "2 Back Circle Lawn Start Time" (SprinklerZone2) {channel="hydrawise:cloud:home:zone2#nextruntime"}
Number SprinklerZone2TimeLeft "2 Back Circle Lawn Time Left" (SprinklerZone2) {channel="hydrawise:cloud:home:zone2#timeleft"}
String SprinklerZone2Icon "2 Back Circle Lawn Icon" (SprinklerZone2) {channel="hydrawise:cloud:home:zone2#icon"}
Group SprinklerZone3 "3 Left of Drive Lawn" (SprinklerZones)
String SprinklerZone3Name "3 Left of Drive Lawn name" (SprinklerZone3) {channel="hydrawise:cloud:home:zone3#name"}
Switch SprinklerZone3Run "3 Left of Drive Lawn Run" (SprinklerZone3) {channel="hydrawise:cloud:home:zone3#run"}
Switch SprinklerZone3RunLocal "3 Left of Drive Lawn Run (local)" (SprinklerZone3) {channel="hydrawise:local:home:zone3#run"}
Number SprinklerZone3RunCustom "3 Left of Drive Lawn Run Custom" (SprinklerZone3) {channel="hydrawise:cloud:home:zone3#runcustom"}
DateTime SprinklerZone3StartTime "3 Left of Drive Lawn Start Time" (SprinklerZone3) {channel="hydrawise:cloud:home:zone3#nextruntime"}
Number SprinklerZone3TimeLeft "3 Left of Drive Lawn Time Left" (SprinklerZone3) {channel="hydrawise:cloud:home:zone3#timeleft"}
String SprinklerZone3Icon "3 Left of Drive Lawn Icon" (SprinklerZone3) {channel="hydrawise:cloud:home:zone3#icon"}
```

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions bundles/org.openhab.binding.hydrawise/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.hydrawise</artifactId>

<name>openHAB Add-ons :: Bundles :: Hydrawise Binding</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.hydrawise-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${project.version}/xml/features</repository>

<feature name="openhab-binding-hydrawise" description="Hydrawise Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.hydrawise/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* 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
*/
package org.openhab.binding.hydrawise.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.thing.ThingTypeUID;

/**
* The {@link HydrawiseBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Dan Cunningham - Initial contribution
*/
@NonNullByDefault
public class HydrawiseBindingConstants {

private static final String BINDING_ID = "hydrawise";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_CLOUD = new ThingTypeUID(BINDING_ID, "cloud");
public static final ThingTypeUID THING_TYPE_LOCAL = new ThingTypeUID(BINDING_ID, "local");

public static final String BASE_IMAGE_URL = "https://app.hydrawise.com/config/images/";

public static final String CHANNEL_GROUP_ALLZONES = "allzones";
public static final String CHANNEL_ZONE_RUN_CUSTOM = "runcustom";
public static final String CHANNEL_ZONE_RUN = "run";
public static final String CHANNEL_ZONE_STOP = "stop";
public static final String CHANNEL_ZONE_SUSPEND = "suspend";
public static final String CHANNEL_ZONE_NAME = "name";
public static final String CHANNEL_ZONE_ICON = "icon";
public static final String CHANNEL_ZONE_LAST_WATER = "lastwater";
public static final String CHANNEL_ZONE_TIME = "time";
public static final String CHANNEL_ZONE_TYPE = "type";
public static final String CHANNEL_ZONE_NEXT_RUN_TIME_TIME = "nextruntime";
public static final String CHANNEL_ZONE_TIME_LEFT = "timeleft";
public static final String CHANNEL_RUN_ALL_ZONES = "runall";
public static final String CHANNEL_STOP_ALL_ZONES = "stopall";
public static final String CHANNEL_SUSPEND_ALL_ZONES = "suspendall";
public static final String CHANNEL_SENSOR_NAME = "name";
public static final String CHANNEL_SENSOR_INPUT = "input";
public static final String CHANNEL_SENSOR_MODE = "mode";
public static final String CHANNEL_SENSOR_TIMER = "timer";
public static final String CHANNEL_SENSOR_OFFTIMER = "offtimer";
public static final String CHANNEL_SENSOR_OFFLEVEL = "offlevel";
public static final String CHANNEL_SENSOR_ACTIVE = "active";
public static final String CHANNEL_FORECAST_TEMPERATURE_HIGH = "temperaturehigh";
public static final String CHANNEL_FORECAST_TEMPERATURE_LOW = "temperaturelow";
public static final String CHANNEL_FORECAST_CONDITIONS = "conditions";
public static final String CHANNEL_FORECAST_DAY = "day";
public static final String CHANNEL_FORECAST_HUMIDITY = "humidity";
public static final String CHANNEL_FORECAST_WIND = "wind";
public static final String CHANNEL_FORECAST_ICON = "icon";
public static final String PROPERTY_CONTROLLER_ID = "controller";
public static final String PROPERTY_NAME = "name";
public static final String PROPERTY_DESCRIPTION = "description";
public static final String PROPERTY_LOCATION = "location";
public static final String PROPERTY_ADDRESS = "address";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 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
*/
package org.openhab.binding.hydrawise.internal;

/**
* The {@link HydrawiseCloudConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Dan Cunningham - Initial contribution
*/
public class HydrawiseCloudConfiguration {

/**
* Customer API key {@link https://app.hydrawise.com/config/account}
*/
public String apiKey;

/**
* refresh interval in seconds.
*/
public Integer refresh;

/**
* optional id of the controller to connect to
*/
public Integer controllerId;
}
Loading

0 comments on commit 1ea61e1

Please sign in to comment.