Skip to content

Commit

Permalink
[gree] Initial contribution (openhab#7504)
Browse files Browse the repository at this point in the history
* re-factoring WIP

Signed-off-by: Markus Michels <markus7017@gmail.com>
  • Loading branch information
markus7017 authored and andrewfg committed Aug 31, 2020
1 parent 74ddb87 commit 7c9632d
Show file tree
Hide file tree
Showing 37 changed files with 2,905 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 @@ -70,6 +70,7 @@
/bundles/org.openhab.binding.gardena/ @gerrieg
/bundles/org.openhab.binding.globalcache/ @mhilbush
/bundles/org.openhab.binding.gpstracker/ @gbicskei
/bundles/org.openhab.binding.gree/ @markus7017
/bundles/org.openhab.binding.groheondus/ @FlorianSW
/bundles/org.openhab.binding.harmonyhub/ @digitaldan
/bundles/org.openhab.binding.hdanywhere/ @kgoderis
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 @@ -344,6 +344,11 @@
<artifactId>org.openhab.binding.gpstracker</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.gree</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.groheondus</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.gree/.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.gree/.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.gree</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.gree/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
141 changes: 141 additions & 0 deletions bundles/org.openhab.binding.gree/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# GREE Binding

This binding integrates GREE Air Conditioners.

Note: The GREE Air Conditioner must already be setup on the WiFi network and must have a fixed IP Address.

## Supported Things

This binding supports one Thing type `airconditioner`.

## Discovery

Once the GREE is on the network (WiFi active) it could be discovery automatically.
An IP broadcast message is sent and every responding unit gets added to the Inbox.

## Binding Configuration

No binding configuration is required.

## Thing Configuration

| Channel Name | Type | Description |
|------------------|------------|-----------------------------------------------------------------------------------------------|
| ipAddress | IP Address | IP address of the unit. |
| broadcastAddress | IP Address | Broadcast address being used for discovery, usually derived from the IP interface address. |
| refresh | Integer | Refresh interval in seconds for polling the device status. |

The Air Conditioner's IP address is mandatory, all other parameters are optional.
If the broadcast is not set (default) it will be derived from openHAB's network setting (PaperUI:Configuration:System:Network Settings).
Only change this if you have a good reason to.

## Channels

The following channels are supported for fans:

| Channel Name | Item Type | Description |
|---------------|-----------|---------------------------------------------------------------------------------------------------|
| power | Switch | Power on/off the Air Conditioner |
| mode | String | Sets the operating mode of the Air Conditioner |
| | | Mode can be one of auto/cool/eco/dry/fan/heat or on/off |
| | | Check the Air Conditioner's operating manual for supported modes. |
| temperature | Number:Temperature | Sets the desired room temperature |
| air | Switch | Set on/off the Air Conditioner's Air function if applicable to the Air Conditioner model |
| dry | Switch | Set on/off the Air Conditioner's Dry function if applicable to the Air Conditioner model |
| health | Switch | Set on/off the Air Conditioner's Health function if applicable to the Air Conditioner model |
| turbo | Switch | Set on/off the Air Conditioner's Turbo Mode. |
| quiet | String | Set Quiet Mode: off/auto/quiet |
| swingUpDown | Number | Sets the vertical (up..down) swing action on the Air Conditioner, |
| | | OFF: 0, Full Swing: 1, Up: 2, MidUp: 3, Mid: 4, Mid Down: 5, Down : 6 |
| swingLeftRight| Number | Sets the horizontal (left..right) swing action on the Air Conditioner |
| | | OFF: 0, Full Swing: 1, Left: 2, Mid Left: 3, Mid: 4, Mid Right: 5, Right : 6 |
| windspeed | Number | Sets the fan speed on the Air conditioner Auto:0, Low:1, MidLow:2, Mid:3, MidHigh:4, High:5 |
| | | The number of speeds depends on the Air Conditioner model. |
| powersave | Switch | Set on/off the Air Conditioner's Power Saving function if applicable to the Air Conditioner model |
| light | Switch | Enable/disable the front display on the Air Conditioner if applicable to the Air Conditioner model|
| | | Full Swing: 1, Up: 2, MidUp: 3, Mid: 4, Mid Down: 5, Down : 6 |


When changing mode, the air conditioner will be turned on unless "off" is selected.

## Full Example

**Things**

```
Thing gree:airconditioner:a1234561 [ ipAddress="192.168.1.111", refresh=2 ]
```

**Items**

```
Switch AirconPower { channel="gree:airconditioner:a1234561:power" }
Number AirconMode { channel="gree:airconditioner:a1234561:mode" }
Switch AirconTurbo { channel="gree:airconditioner:a1234561:turbo" }
Switch AirconLight { channel="gree:airconditioner:a1234561:light" }
Number AirconTemp "Temperature [%.1f °C]" {channel="gree:airconditioner:a1234561:temperature" }
Number AirconSwingVertical { channel="gree:airconditioner:a1234561:swingUpDown" }
Number AirconSwingHorizontal { channel="gree:airconditioner:a1234561:swingLeftRight" }
Number AirconFanSpeed { channel="gree:airconditioner:a1234561:windspeed" }
Switch AirconAir { channel="gree:airconditioner:a1234561:air" }
Switch AirconDry { channel="gree:airconditioner:a1234561:dry" }
Switch AirconHealth { channel="gree:airconditioner:a1234561:health" }
Switch AirconPowerSaving { channel="gree:airconditioner:a1234561:powersave" }
```

**Sitemap**

This is an example of how to set up your sitemap.

```
Frame label="Controls"
{
Switch item=AirconMode label="Mode" mappings=["auto"="Auto", "cool"="Cool", "eco"="Eco", "dry"="Dry", "fan"="Fan", "turbo"="Turbo", "heat"="Heat", "on"="ON", "off"="OFF"]
Setpoint item=AirconTemp label="Set temperature" icon=temperature minValue=16 maxValue=30 step=1
}
Frame label="Fan Speed"
{
Switch item=AirconFanSpeed label="Fan Speed" mappings=[0="Auto", 1="Low", 2="Medium Low", 3="Medium", 4="Medium High", 5="High"] icon=fan
}
Frame label="Fan-Swing Direction"
{
Switch item=AirconSwingVertical label="Direction V" mappings=[0="Off", 1="Full", 2="Up", 3="Mid-up", 4="Mid", 5="Mid-low", 6="Down"] icon=flow
Switch item=AirconSwingHorizontal label="Direction H" mappings=[0="Off", 1="Full", 2="Left", 3="Mid-left", 4="Mid", 5="Mid-right", 6="Right"] icon=flow
}
Frame label="Options"
{
Switch item=AirconTurbo label="Turbo" icon=fan
Switch item=AirconLight label="Light" icon=light
Switch item=AirconAir label="Air" icon=flow
Switch item=AirconDry label="Dry" icon=rain
Switch item=AirconHealth label="Health" icon=smiley
Switch item=AirconPowerSaving label="Power Saving" icon=poweroutlet
}
```

**Example**

This example shows how to make a GREE Air Conditioner controllable by Google HA (A/C mode + temperature)

**Items**

```
Group Gree_Modechannel "Gree" { ga="Thermostat" } // allows mapping for Google Home Assistent
Switch GreeAirConditioner_Power "Aircon" {channel="gree:airconditioner:a1234561:power", ga="Switch"}
Number GreeAirConditioner_Mode "Aircon Mode" {channel="gree:airconditioner:a1234561:mode", ga="thermostatMode"}
Number GreeAirConditioner_Temp "Aircon Temperature" {channel="gree:airconditioner:a1234561:temperature}
Switch GreeAirConditioner_Lightl "Light" {channel="gree:airconditioner:a1234561:light"}
```

**Rules**

```
rule "Mode changed"
when
Item GreeAirConditioner_Mode changed
then
if(GreeAirConditioner_Mode.state == "cool" ) {
logInfo("A/C", "Cooling has be turned on")
}
end
```
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.gree/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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.7-SNAPSHOT</version>
</parent>

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

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

</project>
9 changes: 9 additions & 0 deletions bundles/org.openhab.binding.gree/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.gree-${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-gree" description="Gree Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.gree/${project.version}</bundle>
</feature>
</features>
Loading

0 comments on commit 7c9632d

Please sign in to comment.