New Gree Air Conditioner Binding

openhab2
binding
airconditioning
Tags: #<Tag:0x00007fd3103f03f0> #<Tag:0x00007fd3103f0058> #<Tag:0x00007fd3103f7ec0>

(John Cunha) #1

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


OpenHab aircondition control
(Hector) #2

How do I install this


(John Cunha) #3

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


(Hector) #4

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.


(John Cunha) #5

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


(Hector) #6

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


(John Cunha) #7

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


(John Cunha) #8

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.


(Hector) #9

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


(Hector) #10

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”


(John Cunha) #11

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


(John Cunha) #12

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


(Hector) #13

Ok thanks for this effort


(John Cunha) #14

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


(John Cunha) #15

Just to be sure, the latest verion is 2.2.0.201801302025


(Hector) #16

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


(John Cunha) #17

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


(John Cunha) #18

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


(Hector) #19

Done!! is working now fine, Thanks

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


(John Cunha) #20

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