Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gree] Initial contribution #7504

Merged
merged 48 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
ac59558
rebased
markus7017 Apr 29, 2020
868041f
re-factoring WIP
markus7017 Apr 27, 2020
ac32754
re-factoring WIP
markus7017 Apr 27, 2020
d087ba6
re-factoring WIP
markus7017 Apr 28, 2020
319b367
re-factoring WIP
markus7017 Apr 29, 2020
01bfa0b
German translation added, refactoring completed
markus7017 Apr 29, 2020
912bf12
ignore SocketTimeoutException on background status refresh
markus7017 Apr 29, 2020
de7d6e6
module re-added to pom.xml
markus7017 Apr 29, 2020
d1677a9
review changes
markus7017 Apr 30, 2020
2f27216
Added translations for mode and windspeed values
markus7017 May 1, 2020
10d3419
Support got Aircon model (thanks @piotras) Support Google GD commands on
markus7017 May 2, 2020
2a753b3
Hungarian translation removed for now, seems to have some characterset
markus7017 May 2, 2020
ba6ad55
mode channel is now String (supports Number as backward compatibility)
markus7017 May 3, 2020
1b928a8
naming of binding id and channel names adjusted
markus7017 May 4, 2020
9b1d436
New channels swingLeftRight, quiet; channel swingvertical renamed to
markus7017 May 31, 2020
536dff4
review changes
markus7017 May 31, 2020
a383233
more review changes
markus7017 May 31, 2020
533e236
getOnOffType() fixed
markus7017 May 31, 2020
0035358
updated channel handling (support for UBM)
markus7017 Jun 1, 2020
94fd14d
various options descriptors added
markus7017 Jun 2, 2020
b3df5cc
rebased to 2.5.6
markus7017 Jun 6, 2020
1846cc4
review changes
markus7017 Jun 6, 2020
cd3073b
review changes; GreeDiscovery class turned into a Component, but this
markus7017 Jun 7, 2020
5f205c4
various typos in language properties fixed; thing-type.xml uses @text/
markus7017 Jun 7, 2020
f39b4d2
replace StringUtils.isNumber() by native code
markus7017 Jun 7, 2020
7e85fe1
discovery fixed, review changes, README updated
markus7017 Jun 7, 2020
f1e730b
spotless formatting applied
markus7017 Jun 7, 2020
1c64aff
Turned GreeAirDevice into @NonNullByDefault, test pending
markus7017 Jun 8, 2020
5f5f5bb
review changes
markus7017 Jun 8, 2020
e2fad29
more changes from review
markus7017 Jun 9, 2020
3f990a5
more review changes (contants for cmd and property values, turn
markus7017 Jun 11, 2020
e7b4c66
review changes; fixed mode on/off
markus7017 Jun 14, 2020
3f8726e
review changes
markus7017 Jun 14, 2020
f7f5999
review changes, support Celsius and Fahrenheit based on QuantityType
markus7017 Jun 16, 2020
6ec9f36
removed C/F conversion (handled by the framework)
markus7017 Jun 16, 2020
f84b33b
activate() method removed
markus7017 Jun 16, 2020
5a2754c
review changes
markus7017 Jun 16, 2020
446e738
fixed typo in properties id (..), thingId added to debug outputs
markus7017 Jun 17, 2020
ddbba49
Update status 3sec after a command was sent; avoid NPE when no response
markus7017 Jun 17, 2020
a466834
review changes, ONLINE/OFFLINE handling, missing localized messages
markus7017 Jun 20, 2020
5c171d8
review changes
markus7017 Jun 22, 2020
fdde046
commit
markus7017 Jun 24, 2020
b33acc6
gree added
markus7017 Jun 24, 2020
cad9ffd
ordering fixed
markus7017 Jun 24, 2020
d185fbe
order change reverted
markus7017 Jun 24, 2020
77a3e2f
review change, force status update on init
markus7017 Jun 25, 2020
d02afd6
removed empty line
markus7017 Jun 25, 2020
079b745
duplicate removed
markus7017 Jun 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,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 @@ -331,6 +331,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
147 changes: 147 additions & 0 deletions bundles/org.openhab.binding.gree/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# 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 units gets added to the Inbox.
markus7017 marked this conversation as resolved.
Show resolved Hide resolved

## Binding Configuration

No binding configuration is required.

#### Manual Thing Creation

Fans can be manually created in the *PaperUI* or *HABmin*, or by placing a *.things* file in the *conf/things* directory. See example below.


markus7017 marked this conversation as resolved.
Show resolved Hide resolved
## 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 | Sets the desired room temperature |
markus7017 marked this conversation as resolved.
Show resolved Hide resolved
| 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 AirconTempSet { channel="gree:airconditioner:a1234561:temperature" }
markus7017 marked this conversation as resolved.
Show resolved Hide resolved
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**

```
markus7017 marked this conversation as resolved.
Show resolved Hide resolved
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>
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