New Gree Air Conditioner Binding

I have written an openhab2 binding for wifi-enabled Gree Air Conditioners.

It is not thoroughly tested and I would like to make it available to a wider audience for testing before I create a pull request on github.

If anybody is interested in testing it, the GitHub location is as follows:

Below is a screenshot of my sitemap example.

Regards,
John

3 Likes

How do I install this

Hi Hector,
This binding can be downloaded from Here

Further documentation can be found Here

To install the binding,

  • copy the Jar file (above) to the ā€˜addonsā€™ folder of your Openhab installation (usually /opt/openhab/addons).
    Copying the jar file to the addons folder will automatically instal it in Openhab
  • Next in Openhab, open PaperUI and go to the Inbox
  • Press the ā€˜+ā€™ at the top of the screen to add a new Thing
  • ā€˜Gree Air Bindingā€™ should now be listed in the available Bindings to be added
  • Select ā€˜Gree Air Bindingā€™
  • Keep pressing the right arrow until you see a screen titled ā€œConfigure Gree AirConditionerā€
  • Enter the IP Address of your Gree Airconditioner in the ā€œNetwork Addressā€ field.
    NOTE: Your airconditioner must have a static IP address.
  • Finally press the Tick button at the top of the screen.
  • The AirConditioner should now be installed.

Let me know if you need any more help

Hello

I assign a fix ip to the Air but it say offline on Openhab, but I can ping the IP and also I can control the air using the GreeSmart iPhone App

also I see this

[ome.core.thing.internal.ThingManager] - Initializing handler for thing ā€˜greeair:greeairthing:b2d08bb1ā€™ takes more than 5000ms.

Hi Hector,
What model of air conditioner do you have?
Also, can you install the ā€žwifi smartā€ smart phone app from Gree and see if that can connect to you air-conditioner?
It kight be possible that your air-conditioner is ā€žlockedā€. Check the documentatuon of your airconditionerā€¦
My Openhab binding uses exactly tye same protocol and commands as the original Gree appā€¦
Thanks,
John

Hello

My air conditioner is a AIRMAX brand but it use the ā€œWifiSmart Appā€ or the ā€œGree Smart Appā€ I assign an IP via the Router. I will try the disable and reenable the binding when I get home I will update the status. Iā€™m currentle using the 2 apps

WifiSmart with account for cloud and local access

GreeSmart for local access

ā€“
I will try to find how to check is the device is not lock and try to unlock it

Thanks for your support

Hi Hector,
When thia binding initializes a connection to the airconditioner, it interrogates the device and checks that the manufacturer=ā€žgreeā€.
Tonight I will add some debug info to the binding and we can try to see what your device returns.
John

Hi Hector,

Iā€™ve updated the binding to provide some more trace information.

Please download and install the binding from Here

Replace the binding in your Openhab installation.

Next, in Karaf console, set the log-level for the binding as follows:
log:set TRACE org.openhab.binding.greeair

In Karaf, make sure that you have my latest binding by typing:
openhab> bundle:list | grep Gree

You should see somethign like :
10 Ć¢ Active Ć¢ 80 Ć¢ 2.2.0.201801291954 Ć¢ GreeAir Binding
(make sure the bold numbers above match what you get)

Next, in openhab PaperUI try to add your airconditioner.

Now, look in the openhab.log and you shuold see something like:
2018-01-29 21:09:59.614 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAirconHandler for greeair:greeairthing:d7abbf8d is initializing
2018-01-29 21:09:59.630 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAirconHandler config for greeair:greeairthing:d7abbf8d is GreeAirconConfig{ipAddress=1.1.1
2018-01-29 21:09:59.632 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Sending scan packet to %s
2018-01-29 21:09:59.727 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Response received from address /192.168.1.96
2018-01-29 21:09:59.728 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Response : {ā€œtā€:ā€œdevā€,ā€œcidā€:ā€œf4911e04c3b3ā€,ā€œbcā€:ā€œgreeā€,ā€œbrandā€:ā€œgreeā€,"catalog
2

Im most interested in the reply in Bold.

At the moment, my binding checks that bc=gree and brand=gree
Maybe yours is differentā€¦
Can you paste here that Binding Response?

Thanks,
John

p.s. remember to set your log-level back to error so that your logfile doesnt get too big.

Hello

**openhab> bundle:list | grep Gree **
228 ā”‚ Active ā”‚ 80 ā”‚ 2.2.0.201801291954 ā”‚ GreeAir Binding
----------------------------------------

2018-01-29 23:37:58.304 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAirconHandler for greeair:greeairthing:b2d08bb1 is initializing
2018-01-29 23:37:58.314 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAirconHandler config for greeair:greeairthing:b2d08bb1 is GreeAirconConfig{ipAddress=192.168.10.54}
2018-01-29 23:37:58.321 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Sending scan packet to %s
==> /var/log/openhab2/events.log <==
2018-01-29 23:37:58.304 [hingStatusInfoChangedEvent] - ā€˜greeair:greeairthing:b2d08bb1ā€™ changed from UNINITIALIZED to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2018-01-29 23:38:03.307 [WARN ] [ome.core.thing.internal.ThingManager] - Initializing handler for thing ā€˜greeair:greeairthing:b2d08bb1ā€™ takes more than 5000ms.
2018-01-29 23:38:03.331 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAircon found 0 Gree Devices during scanning
==> /var/log/openhab2/events.log <==
2018-01-29 23:38:03.343 [hingStatusInfoChangedEvent] - ā€˜greeair:greeairthing:b2d08bb1ā€™ changed from INITIALIZING to OFFLINE

====
NETWORK SCAN RESULTS
192.168.10.54 f4:91:1e:09:cb:0c ZHUHAI EWPE INFORMATION TECHNOLOGY INC

I was making some research I found "EWPE is a subsidiary of Gree Electric Appliances, Inc.

It is possible to try the Brand and BC to be ā€œEWPEā€ or lowercase ā€œewpeā€

Hi Hector,
Looking at the logs, your Airconditioner is not replying to the interrogation packet sent to it by the binding.
(it is not replying at all so the binding doesnt get to the part where it checks if itā€™s a ā€˜Greeā€™).

The only thing I can think is happening is if the Airconditioner is locked to your phone.
This is documented on page 7 of the ā€œGree Wifi smartā€ app manual:
http://global.gree.com/data/cms/archive/201604(3)/17121/sc.pdf

_Step 1: Tap and hold ā€œa0b417acā€ to enter the page ā€œEdit deviceā€. Tap ā€œImageā€ to _
_select the source of image. Select from ā€œDefault imagesā€ or ā€œTake photoā€ or ā€œChoose _
_from photosā€ and save an image. _

_Step 2: Tap ā€œNameā€ to change device name, Save it and the new device name will _
be shown. enable button ā€˜Lock deviceā€™ to lock the device other smart phone canā€™t search the device now

Can you follow the steps above using the Gree Wifi Smart App and make sure that the ā€˜Lock Deviceā€™ option is NOT set?

Thanks,
John

Just as I finished writing the mail above, I suddenly realised what is the problemā€¦
(I still think itā€™s worth to make sure that your airconditioner is nore locked to your phone).

If it is not, then I think I know what the problem isā€¦

Looking at your logsā€¦ your device has an IP address of 192.168.10.54
My binding expects the network address to be 192.168.1.XX and is therefore broadcasting to 192.168.1.255
Since your device is on 192.168.10.XX it does not get the broadcastā€¦
In your case the broadcast address should be 192.168.10.255

I need to make some changes to the Binding to calculate the broadcast address based on the IP you set in the configuration of the Thingā€¦

Please be patient while I make some changesā€¦

NOTE: We will still need to examine the results of the response of your device once we get passed this problemā€¦

John

Ok thanks for this effort

Hi Hector,

Iā€™ve updated the binding to handle a configurable Broadcast address.
The address is now part of the attributes of the Thing and has a default value of 255.255.255.255 which might work for you.

If my default Broadcast address doesnt work for you, please calculate the correct address using this:
https://remotemonitoringsystems.ca/broadcast.php

Please download the latest version and try againā€¦ from HERE

Again, your airconditioner might reply with a different manufacturer but we wil get to that problem if it comes up.

Thanks,
John

Just to be sure, the latest verion is 2.2.0.201801302025

wujuuuu!!! Is Working Thanks

The problem was the broadcast ip

Below is the Log I just change it to ERROR

How I can create a update button on the site mat to get the current status of the air for example the air is on On state but on openhab is no update yet it only update is I turn it off then on

I will like to create a "Get Current status or Refresh Status button on the sitemap to get the current values of the item without changing the status


2018-01-30 22:23:08.282 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAirconHandler config for greeair:greeairthing:b2d08bb1 is GreeAirconConfig{ipAddress=192.168.10.54}
2018-01-30 22:23:08.288 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Sending scan packet to /255.255.255.255
2018-01-30 22:23:08.364 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Response received from address /192.168.10.54
2018-01-30 22:23:08.367 [TRACE] [nding.greeair.handler.GreeAirHandler] - Greeair Binding Response : {ā€œtā€:ā€œdevā€,ā€œcidā€:ā€œf4911e09ce0bā€,ā€œbcā€:ā€œgreeā€,ā€œbrandā€:ā€œgreeā€,ā€œcatalogā€:ā€œgreeā€,ā€œmacā€:ā€œf4911e09ce0bā€,ā€œmidā€:ā€œ10001ā€,ā€œmodelā€:ā€œgreeā€,ā€œnameā€:ā€œMaster Roomā€,ā€œseriesā€:ā€œgreeā€,ā€œvenderā€:ā€œ1ā€,ā€œverā€:ā€œV1.1.13ā€,ā€œlockā€:0}
2018-01-30 22:23:13.288 [WARN ] [ome.core.thing.internal.ThingManager] - Initializing handler for thing ā€˜greeair:greeairthing:b2d08bb1ā€™ takes more than 5000ms.
2018-01-30 22:23:13.377 [DEBUG] [nding.greeair.handler.GreeAirHandler] - GreeAircon found 1 Gree Devices during scanning
2018-01-30 22:23:13.584 [INFO ] [nding.greeair.handler.GreeAirHandler] - Gree AirConditioner Device greeair:greeairthing:b2d08bb1 from was Succesfully bound
==> /var/log/openhab2/events.log <==
2018-01-30 22:23:13.599 [hingStatusInfoChangedEvent] - ā€˜greeair:greeairthing:b2d08bb1ā€™ changed from INITIALIZING to ONLINE
==> /var/log/openhab2/openhab.log <==
2018-01-30 22:23:13.602 [DEBUG] [nding.greeair.handler.GreeAirHandler] - Start Greeair automatic refresh with 1 second intervals
2018-01-30 22:23:13.611 [DEBUG] [nding.greeair.handler.GreeAirHandler] - Greeair executing automatic update of values

Hi Hector,

Thats great news :slight_smile:

The binding checks the status of the airconditioner every second and updates the status of any items. So you should not need to do it yourself.

So just for me to understandā€¦
Now the device is online and you can created items etc?
Can you turn the device on and off using the openhab item?
The problem now is that item statuses are not in sync with the device?

Have you checked the event.log to see if statuses are changing or if there are any errors?

Thanks,
John

The refresh interval is configured in the Thing configuration in Openhab.
This refresh interval is how often Openhab queries the air conditioner for itā€™s current status.

Can you check your value?
In PaperUI: Configuration->Things->->Press the pencil button at the top->
Look at the value in the ā€œRefresh time intervalā€ field.
Mine is set to value 1 which means Openhab will query the airconditioner every second.

If that is not the problem, I will add some trace info to the log to show the status being returned from the airconditioner.

Thanks,
John

Done!! is working now fine, Thanks

I just create a custom sitemap and items file is working fine

Excellent news :slight_smile:
Let me know if you have any other issues
John