Skip to content

Commit

Permalink
[hive] Initial public version of my Hive binding.
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrownwsws committed Mar 17, 2020
1 parent b9aff61 commit 65764e4
Show file tree
Hide file tree
Showing 162 changed files with 9,745 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
/bundles/org.openhab.binding.hdpowerview/ @beowulfe
/bundles/org.openhab.binding.helios/ @kgoderis
/bundles/org.openhab.binding.heos/ @Wire82
/bundles/org.openhab.binding.hive/ @rbrownwsws
/bundles/org.openhab.binding.homematic/ @FStolte @gerrieg @mdicke2s
/bundles/org.openhab.binding.hpprinter/ @cossey
/bundles/org.openhab.binding.hue/ @cweitkamp
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 @@ -308,6 +308,11 @@
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.heos</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.hive</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
Expand Down
32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.hive/.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.hive/.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.hive</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.hive/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/openhab-addons
86 changes: 86 additions & 0 deletions bundles/org.openhab.binding.hive/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Hive Binding

<p>
<img src="https://www.hivehome.com/assets/hive-primary-logo-d6f32b5c6a0a3ecde57e3c6dafead4e6d8a4fb5230177bd85f3aedccf9d59382.svg" alt="Centrica Hive Limited logo" />
</p>

This binding integrates the [Hive smart home system](https://www.hivehome.com) using the Hive REST API.

_N.B. As this binding uses the Hive REST API it can only integrate Hive branded devices connected to a Hive Hub.
Setups that do not include a Hive Hub or connect to a different brand of Zigbee hub/bridge will not work with this binding._

| Hub Type | Image |
|--------------|-------|
| Hive Hub | <img src="https://bucketeer-e9a3f077-0ec6-47cc-a7da-226f8fd8c41c.s3-eu-west-1.amazonaws.com/app/image_sources/skus/HCD00010-ab3f78de42c32eef68fde6c90578eed4f6e88e5ac2a24df6f3a8aa0af5b38699.png" width="100" alt="Hive Hub" /> |
| Hive Hub 360 | <img src="https://images.ctfassets.net/mijf9lz5yt3u/6i0dFZIMOgV4uB065KVuRH/e35ed4b672d0a6d57a12dc754254befa/gallery-image-1.png" width="100" alt="Hive Hub 360" /> |

## Supported Things

_Please describe the different supported things / devices within this section._
_Which different types are supported, which models were tested etc.?_
_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/ESH-INF/thing``` of your binding._

<img src="https://images.ctfassets.net/mijf9lz5yt3u/3DfQ7wNAgd7JgMa2nYMc7W/8b639f5e277f6eed8e25b1c3a1d8ce6b/1_hive-active-hubless-heating.jpg" width="100" alt="hive active heating receiver" />

| Thing | Image | Supported | Tested |
|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|--------|
| Hive Thermostat V1 | <img src="https://bucketeer-e9a3f077-0ec6-47cc-a7da-226f8fd8c41c.s3-eu-west-1.amazonaws.com/app/image_sources/user-guides/hive-thermostat-old-b11c8e8d7866f541a6ed5ccc06fd30e014e689fdbecc0dfaed60f649dc22a493.png" width="100" alt="Hive Thermostat V1" /> |||
| Hive Thermostat V2 | <img src="https://images.ctfassets.net/mijf9lz5yt3u/6kf14gk9NgTjDAq2IkNN2u/916eb54a1eeb821400d0aef3a1ab354a/2_hive-thermostat.jpg" width="100" alt="Hive Thermostat" /> |||
| Hive Radiator Valve | <img src="https://images.ctfassets.net/mijf9lz5yt3u/2wF4YxLe93jGDAqRvVFxWv/a0d64ffd918e7f0dabd4cc07257542af/gallery-image-1.jpg" width="100" alt="Hive Radiator Valve" /> |||
| Hive Plug | <img src="https://images.ctfassets.net/mijf9lz5yt3u/6Lig0F2WtiPbDHj8SmB3zL/ce80da3d13cdfd06f1ed5c830c542445/gallery-image-1.jpg" width="100" alt="Hive Plug" /> |||
| Hive Motion Sensor | <img src="https://images.ctfassets.net/mijf9lz5yt3u/5Fu5Cp6T8M85mWgOO8xXOr/e116fe5b2ae9cfa7a4a0e5fa194ccce5/gallery-image-1.jpg" width="100" alt="Hive Motion Sensor" /> |||
| Hive Window or Door Sensor | <img src="https://images.ctfassets.net/mijf9lz5yt3u/1qLpKsGtOiD1UAk0l8MjTr/e4191b4d0bdc5cb30187c2d3219615e9/gallery-image-1.jpg" width="100" alt="Hive Window or Door Sensor" /> |||
| Hive Dimmable Light Bulb\* | <img src="https://images.ctfassets.net/mijf9lz5yt3u/2hWmSpizASY8vHfEMPYwpI/35d12e81d9a86a177e7879ac5b7cd61a/gallery-image-1.jpg" width="100" alt="Hive Dimmable Light Bulb" /> |||
| Hive Cool to Warm White Light Bulb\* | <img src="https://images.ctfassets.net/mijf9lz5yt3u/11R0N4QsLzu6gxmkLIq8Rg/82f79c892a378cf3d650ec47ea467b42/gallery-image-1.jpg" width="100" alt="Hive Cool to Warm Whit Light Bulb" /> |||
| Hive Colour Changing Light Bulb\* | <img src="https://images.ctfassets.net/mijf9lz5yt3u/4nELGVWquXwItc0XqCaHmJ/8b7d4052b6010a291eb0112e662f34cd/gallery-image-1.jpg" width="100" alt="Hive Colour Changing Light Bulb" /> |||
| Hive View | <img src="https://images.ctfassets.net/mijf9lz5yt3u/w24Irav7f1vHdd4UFUccM/ef4a3194d9b87e3e04fc269d77cbed86/gallery-image-1.jpg" width="100" alt="Hive View" /> |||
| Hive View Outdoor | <img src="https://images.ctfassets.net/mijf9lz5yt3u/3UTDzV9RyNeKrCBi3pDi8X/3648d3ae40cf353cd1d09bf24c13f7f9/gallery-image-2.jpg" width="100" alt="Hive View Outdoor" /> |||

\*Hive Light Bulbs come in B22, E27, E14 and GU10 variants. Only one of these variants is pictured.

## Discovery

_Describe the available auto-discovery features here. Mention for what it works and what needs to be kept in mind when using it._

## Binding Configuration

_If your binding requires or supports general configuration settings, please create a folder ```cfg``` and place the configuration file ```<bindingId>.cfg``` inside it. In this section, you should link to this file and provide some information about the options. The file could e.g. look like:_

```
# Configuration for the Philips Hue Binding
#
# Default secret key for the pairing of the Philips Hue Bridge.
# It has to be between 10-40 (alphanumeric) characters
# This may be changed by the user for security reasons.
secret=openHABSecret
```

_Note that it is planned to generate some part of this based on the information that is available within ```src/main/resources/ESH-INF/binding``` of your binding._

_If your binding does not offer any generic configurations, you can remove this section completely._

## Thing Configuration

_Describe what is needed to manually configure a thing, either through the (Paper) UI or via a thing-file. This should be mainly about its mandatory and optional configuration parameters. A short example entry for a thing file can help!_

_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/ESH-INF/thing``` of your binding._

## Channels

_Here you should provide information about available channel types, what their meaning is and how they can be used._

_Note that it is planned to generate some part of this based on the XML files within ```src/main/resources/ESH-INF/thing``` of your binding._

| channel | type | description |
|----------|--------|------------------------------|
| control | Switch | This is the control channel |

## Full Example

_Provide a full usage example based on textual configuration files (*.things, *.items, *.sitemap)._

## Any custom content here!

_Feel free to add additional sections for whatever you think should also be mentioned about your binding!_

[hive-hub]: ""
73 changes: 73 additions & 0 deletions bundles/org.openhab.binding.hive/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?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/xsd/maven-4.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.3-SNAPSHOT</version>
</parent>

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

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

<properties>
<jacoco.version>0.8.5</jacoco.version>
</properties>

<dependencies>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.15.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- Code coverage plugin -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<reporting>
<plugins>
<!-- For generating HTML test reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M4</version>
</plugin>

<!-- For generating HTML coverage reports -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
</plugins>
</reporting>

</project>
9 changes: 9 additions & 0 deletions bundles/org.openhab.binding.hive/src/main/feature/feature.xml
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.hive-${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/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-hive" description="Hive Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.hive/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2010-2020 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.hive.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

/**
* The {@link HiveAccountConfig} class contains fields mapping thing configuration parameters.
*
* @author Ross Brown - Initial contribution
*/
@NonNullByDefault
public final class HiveAccountConfig {
public @Nullable String username;
public @Nullable String password;
public @Nullable Integer pollingInterval;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/**
* Copyright (c) 2010-2020 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.hive.internal;

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

import java.time.Duration;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* The {@link HiveBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Ross Brown - Initial contribution
*/
@NonNullByDefault
public final class HiveBindingConstants {
public static final String BINDING_ID = "hive";

/* ######## Type UIDs ######## */
public static final ThingTypeUID THING_TYPE_ACCOUNT = new ThingTypeUID(BINDING_ID, "account");
public static final ThingTypeUID THING_TYPE_BOILER_MODULE = new ThingTypeUID(BINDING_ID, "boiler_module");
public static final ThingTypeUID THING_TYPE_HEATING = new ThingTypeUID(BINDING_ID, "heating");
public static final ThingTypeUID THING_TYPE_HOT_WATER = new ThingTypeUID(BINDING_ID, "hot_water");
public static final ThingTypeUID THING_TYPE_HUB = new ThingTypeUID(BINDING_ID, "hub");
public static final ThingTypeUID THING_TYPE_THERMOSTAT = new ThingTypeUID(BINDING_ID, "thermostat");
public static final ThingTypeUID THING_TYPE_TRV = new ThingTypeUID(BINDING_ID, "trv");
public static final ThingTypeUID THING_TYPE_TRV_GROUP = new ThingTypeUID(BINDING_ID, "trv_group");

/**
* The set of {@link ThingTypeUID}s supported by this binding.
*/
// @formatter:off
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.unmodifiableSet(Stream.of(
THING_TYPE_ACCOUNT,
THING_TYPE_BOILER_MODULE,
THING_TYPE_HEATING,
THING_TYPE_HOT_WATER,
THING_TYPE_HUB,
THING_TYPE_THERMOSTAT,
THING_TYPE_TRV,
THING_TYPE_TRV_GROUP
).collect(Collectors.toSet()));
// @formatter:on

/**
* The set of {@link ThingTypeUID}s that can be discovered
* (everything but accounts).
*/
public static final Set<ThingTypeUID> DISCOVERABLE_THING_TYPES_UIDS = Collections.unmodifiableSet(
SUPPORTED_THING_TYPES_UIDS.stream()
.filter(it -> it != THING_TYPE_ACCOUNT)
.collect(Collectors.toSet())
);

/* ######## Channel ids ######## */
public static final String CHANNEL_BATTERY_LEVEL = "battery-level";
public static final String CHANNEL_BATTERY_LOW = "battery-low";
public static final String CHANNEL_MODE_ON_OFF = "mode-on_off";
public static final String CHANNEL_MODE_OPERATING = "mode-operating";
public static final String CHANNEL_MODE_OPERATING_OVERRIDE = "mode-operating-override";
public static final String CHANNEL_STATE_OPERATING = "state-operating";
public static final String CHANNEL_TEMPERATURE_CURRENT = "temperature-current";
public static final String CHANNEL_TEMPERATURE_TARGET = "temperature-target";
public static final String CHANNEL_TEMPERATURE_TARGET_BOOST = "temperature-target-boost";
public static final String CHANNEL_IS_ON = "is_on";
public static final String CHANNEL_TRANSIENT_DURATION = "transient-duration";
public static final String CHANNEL_TRANSIENT_REMAINING = "transient-remaining";
public static final String CHANNEL_TRANSIENT_ENABLED = "transient-enabled";
public static final String CHANNEL_TRANSIENT_START_TIME = "transient-start_time";
public static final String CHANNEL_TRANSIENT_END_TIME = "transient-end_time";
public static final String CHANNEL_RADIO_LQI_AVERAGE = "radio-lqi-average";
public static final String CHANNEL_RADIO_LQI_LAST_KNOWN = "radio-lqi-last_known";
public static final String CHANNEL_RADIO_RSSI_AVERAGE = "radio-rssi-average";
public static final String CHANNEL_RADIO_RSSI_LAST_KNOWN = "radio-rssi-last_known";


/* ######## Config params ######## */
public static final String CONFIG_NODE_ID = "nodeId";

public static final Duration SETTLE_TIME = Duration.ofSeconds(5);

private HiveBindingConstants() {
throw new AssertionError();
}
}
Loading

0 comments on commit 65764e4

Please sign in to comment.