RobHofmann / HomeAssistant-GreeClimateComponent

Custom Gree climate component written in Python3 for Home Assistant. Controls AC's supporting the Gree protocol.
GNU General Public License v3.0
315 stars 105 forks source link

Problem with new AC's containing ewpe wifi modules #108

Closed NickB1 closed 6 months ago

NickB1 commented 3 years ago

Hi, I recently installed two "Saunier Duval" AC's which contain ewpe wifi modules that can be controlled using the ewpe-smart app. When trying to add one off the two AC units I'm getting the following error:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 198, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/asyncio/coroutines.py", line 124, in coro
    res = func(*args, **kw)
  File "/config/custom_components/gree/climate.py", line 118, in async_setup_platform
    GreeClimate(hass, name, ip_addr, port, mac_addr, timeout, target_temp_step, temp_sensor_entity_id, lights_entity_id, xfan_entity_id, health_entity_id, powersave_entity_id, sleep_entity_id, eightdegheat_entity_id, air_entity_id, hvac_modes, fan_modes, swing_modes, encryption_key, uid)
  File "/config/custom_components/gree/climate.py", line 165, in __init__
    self._encryption_key = self.GetDeviceKey().encode("utf8")
  File "/config/custom_components/gree/climate.py", line 247, in GetDeviceKey
    return self.FetchResult(cipher, self._ip_addr, self._port, self._timeout, jsonPayloadToSend)['key']
  File "/config/custom_components/gree/climate.py", line 230, in FetchResult
    data, addr = clientSock.recvfrom(64000)

My config:

- platform: gree
  name: Groundfloor
  host: 192.168.1.126
  port: 7000
  mac: 50:2C:C6:40:43:F8
  target_temp_step: 1

I also tried other tools (https://github.com/arthurkrupa/gree-hvac-mqtt-bridge, https://github.com/tomikaa87/gree-remote). Both give an error stating the final block length is incorrect when trying to decode the pack response on the discovery broadcast.

Also used adb for checking debug output of the ewpe-smart app, this is the output when starting the app.

08-18 00:30:25.191 24531 24531 E GR_DeviceManage: start scan
08-18 00:30:25.271 24531 24898 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"n41kOE3qj41G7nQ4FtiOAQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDL/YhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5s6a0eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgt/Wq2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.127  port:7000
08-18 00:30:25.276 24531 24898 D GR_DeviceManage: 192.168.1.127dev pack:{"t":"dev","cid":"502cc64041e3","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64041e3","mid":"10001","model":"gree","name":"c64041e3","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:25.281 24531 24898 E GR_DeviceManage: 解析scan包  扫描到了502cc64041e3
08-18 00:30:25.281 24531 24898 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64041e3
08-18 00:30:25.424 24531 24898 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"QGOCZUUhPgObyeYYof53XQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDrzThOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5u6qYeFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgl8Ua2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.126  port:7000
08-18 00:30:25.426 24531 24898 D GR_DeviceManage: 192.168.1.126dev pack:{"t":"dev","cid":"502cc64043f8","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64043f8","mid":"10001","model":"gree","name":"c64043f8","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:25.427 24531 24898 E GR_DeviceManage: 解析scan包  扫描到了502cc64043f8
08-18 00:30:25.428 24531 24898 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64043f8
08-18 00:30:25.439 24531 24898 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"QGOCZUUhPgObyeYYof53XQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDrzThOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5u6qYeFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgl8Ua2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.126  port:7000
08-18 00:30:25.441 24531 24898 D GR_DeviceManage: 192.168.1.126dev pack:{"t":"dev","cid":"502cc64043f8","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64043f8","mid":"10001","model":"gree","name":"c64043f8","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:25.442 24531 24898 E GR_DeviceManage: 解析scan包  扫描到了502cc64043f8
08-18 00:30:25.442 24531 24898 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64043f8
08-18 00:30:25.480 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"QGOCZUUhPgObyeYYof53XQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDrzThOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5u6qYeFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgl8Ua2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.126  port:7000
08-18 00:30:25.482 24494 24653 D GR_DeviceManage: 192.168.1.126dev pack:{"t":"dev","cid":"502cc64043f8","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64043f8","mid":"10001","model":"gree","name":"c64043f8","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:25.483 24494 24653 E GR_DeviceManage: 解析scan包  扫描到了502cc64043f8
08-18 00:30:25.483 24494 24653 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64043f8
08-18 00:30:25.593 24531 24898 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"n41kOE3qj41G7nQ4FtiOAQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDL/YhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5s6a0eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgt/Wq2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.127  port:7000
08-18 00:30:25.595 24531 24898 D GR_DeviceManage: 192.168.1.127dev pack:{"t":"dev","cid":"502cc64041e3","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64041e3","mid":"10001","model":"gree","name":"c64041e3","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:25.596 24531 24898 E GR_DeviceManage: 解析scan包  扫描到了502cc64041e3
08-18 00:30:25.596 24531 24898 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64041e3
08-18 00:30:25.602 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"n41kOE3qj41G7nQ4FtiOAQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDL/YhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5s6a0eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgt/Wq2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.127  port:7000
08-18 00:30:25.604 24494 24653 D GR_DeviceManage: 192.168.1.127dev pack:{"t":"dev","cid":"502cc64041e3","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64041e3","mid":"10001","model":"gree","name":"c64041e3","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:25.604 24494 24653 E GR_DeviceManage: 解析scan包  扫描到了502cc64041e3
08-18 00:30:25.605 24494 24653 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64041e3
08-18 00:30:25.659 24494 24597 I GR_DeviceManage: send bind mac:502cc64041e3 ip: 192.168.1.127 port:7000
08-18 00:30:25.663 24494 24597 I GR_DeviceManage: send bind mac:502cc64043f8 ip: 192.168.1.126 port:7000
08-18 00:30:25.679 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"iwXzzHquHuzklfCBI+lCTw==","pack":"JtoKliwtq5m94pPceGVXWs4iqtkA1xf0YwdiCerfl63CNCFNhgQnaNK3m/jmA7TJ0/OlU5e3VeI4+5jGYrzWjLPPnRE="}   Ip:192.168.1.127  port:7000
08-18 00:30:25.680 24494 24653 D GR_DeviceManage: bindok pack:{"t":"bindok","mac":"502cc64041e3","key":"LtBiQw0l5a18Y4N9","r":200}
08-18 00:30:25.682 24494 24653 D GR_DeviceManage: deviceList.size:3 key:LtBiQw0l5a18Y4N9 mac:502cc64041e3
08-18 00:30:25.682 24494 24653 D GR_DeviceManage: 收到bind发送查询状态502cc64041e3
08-18 00:30:25.686 24494 24653 I GR_DeviceManage: QueryStatuesSingle send data to device IP:192.168.1.127 port:7000 data:{"cid":"app","i":0,"pack":"TiRe/GtmLjJEnHRXvUNKH/T17IdygkfUbKChUhQwUlpw1GoxJ2oyOtj422dw/5TVbnDn1s7zQtP1/QvAqR7rgsT4LqH2pPkct/dXqCEB5+moACBFuc4LZ7Jn/wHTbNhOiCOqewHWYoy8PPCZ49g0AeeaUuoCL5oVaKTggjlu3km1KdBODtsAZxKfPqxxjD+x8/s=","t":"pack","tag":"gkSgQvO6zIOYZzIrnTOAEw==","tcid":"502cc64041e3","uid":2100237}
08-18 00:30:25.688 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"TCYEztGjJF6gFBxxKIy/kg==","pack":"JtoKliwtq5m94pPceGVXWs4iqtkA1xf0YwdiCerfla7JNCFNhgQnaNK35L31XIOPlan7YNzHY4ESjpjGYrzWjLPPnRE="}   Ip:192.168.1.126  port:7000
08-18 00:30:25.692 24494 24653 D GR_DeviceManage: bindok pack:{"t":"bindok","mac":"502cc64043f8","key":"31Q6f1v6kRzHoWdL","r":200}
08-18 00:30:25.693 24494 24653 D GR_DeviceManage: deviceList.size:3 key:31Q6f1v6kRzHoWdL mac:502cc64043f8
08-18 00:30:25.694 24494 24653 D GR_DeviceManage: 收到bind发送查询状态502cc64043f8
08-18 00:30:25.697 24494 24653 I GR_DeviceManage: QueryStatuesSingle send data to device IP:192.168.1.126 port:7000 data:{"cid":"app","i":0,"pack":"08QvhF5V9Nkyy0N1apSvyqCgNnN8WcHZvTKh2bUO5VJr2kffkn6twiiXWZEd5VRtoiVQ3rZB5G5I278eiB5/p8g5BA3xFZep/uwWpG47UgxMOIq+L/n3ppS7G5doQ0q7Q4qMEdOwK+A4iCqrkXa+hDKexaauAmz6XP7izWgL6KkAthe6qv1YYe3lcjppTYZKGvE=","t":"pack","tag":"bqOr77jUcPMjb7YTidobIA==","tcid":"502cc64043f8","uid":2100237}
08-18 00:30:25.709 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":0,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"zSebq2dMNrLwdn0IQxQvcw==","pack":"TiRJsT03aGlrnAgapwAFH4ayuMMDjkuODOnlBlMvUjs9wmonNw5ne6/1lichjsv6GEXlg8D9NP79zhrg5F2lhcnAP6H2pOcFgKFZplcM5c+yACBFhMoSVvUm/2ydVPhRqGTle2CbVZ2YHKvFpKkffrHVH6tIestUerqhj243i1+obqIATrwGNwqRb5V/nC+uhf+F31hmNxV8NF0XgNu/ZA3NfbQK68cA7BC5WbKOcDQ1ugfXnbefRiwEvIldDfjZcVOypVNODwpGplg8ytBj1VHs"}   Ip:192.168.1.127  port:7000
08-18 00:30:25.711 24494 24653 D GR_DeviceManage: 192.168.1.127prase status pack:{"t":"dat","mac":"502cc64041e3","r":200,"cols":["Pow","HeatCoolType","Mod","TemUn","SetTem","TemRec","StHt","SvSt","host","name","AllErr","ModelType"],"dat":[0,0,1,0,22,0,0,0,"dis.gree.com","c64041e3",0,32776]}
08-18 00:30:25.729 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":0,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"zelWQx+La6X3OGEuSJ9OBQ==","pack":"08Q4yQgEsoIdyz84cNfgytLnYjcNVc2D3Xvlj/Ea5TMmzEfJghr4g1+aFNFMlAtC1BBSi7hPkkNA6K4+xV0xoMUBFQ3xFYmwyboYqhg2UCpWOIq+Ev3ul9P6G/ome2qkY83DEbL9HPEcqHH31geV+2TRiOfkVz27TuCjwD9Svb8f8m706ppeMfXrIwNnXZZVbPU5Ai9gUEW4l3I9IES6YVM12v4Ju+ZdL6Wl8szbRS2GceU2SVRi+6GFt+NkjRWprIiyrXOI1EkhRnRudn9K+5O6"}   Ip:192.168.1.126  port:7000
08-18 00:30:25.732 24494 24653 D GR_DeviceManage: 192.168.1.126prase status pack:{"t":"dat","mac":"502cc64043f8","r":200,"cols":["Pow","HeatCoolType","Mod","TemUn","SetTem","TemRec","StHt","SvSt","host","name","AllErr","ModelType"],"dat":[0,0,1,0,22,0,0,0,"dis.gree.com","c64043f8",0,32776]}
08-18 00:30:26.137 24494 24935 I GR_DeviceManage: SendDataToDeviceSync:502cc64041e3 data:{"cols":["hid"],"mac":"502cc64041e3","t":"status"}
08-18 00:30:26.139 24494 24935 E GR_DeviceManage: SendDataToDeviceSync:local Mac 502cc64041e3 ip:192.168.1.127 port7000  key:WdKs1Fm2B6Q2f6Ub
08-18 00:30:26.145 24494 24936 I GR_DeviceManage: SendDataToDeviceSync:502cc64043f8 data:{"cols":["hid"],"mac":"502cc64043f8","t":"status"}
08-18 00:30:26.147 24494 24936 E GR_DeviceManage: SendDataToDeviceSync:local Mac 502cc64043f8 ip:192.168.1.126 port7000  key:vdKsZhp5e0t5i0x5
08-18 00:30:26.198 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"n41kOE3qj41G7nQ4FtiOAQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDL/YhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5s6a0eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgt/Wq2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.127  port:7000
08-18 00:30:26.199 24494 24653 D GR_DeviceManage: 192.168.1.127dev pack:{"t":"dev","cid":"502cc64041e3","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64041e3","mid":"10001","model":"gree","name":"c64041e3","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:26.199 24494 24653 E GR_DeviceManage: 解析scan包  扫描到了502cc64041e3
08-18 00:30:26.199 24494 24653 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64041e3
08-18 00:30:26.256 24531 24531 D GR_DeviceManage: is Remote=false count:2
08-18 00:30:26.267 24494 24588 I GR_DeviceManage: send bind mac:502cc64041e3 ip: 192.168.1.127 port:7000
08-18 00:30:26.269 24494 24588 I GR_DeviceManage: send bind mac:502cc64043f8 ip: 192.168.1.126 port:7000
08-18 00:30:26.291 24531 24898 I GR_DeviceManage: 接收数据:{"t":"pack","i":0,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"zelWQx+La6X3OGEuSJ9OBQ==","pack":"08Q4yQgEsoIdyz84cNfgytLnYjcNVc2D3Xvlj/Ea5TMmzEfJghr4g1+aFNFMlAtC1BBSi7hPkkNA6K4+xV0xoMUBFQ3xFYmwyboYqhg2UCpWOIq+Ev3ul9P6G/ome2qkY83DEbL9HPEcqHH31geV+2TRiOfkVz27TuCjwD9Svb8f8m706ppeMfXrIwNnXZZVbPU5Ai9gUEW4l3I9IES6YVM12v4Ju+ZdL6Wl8szbRS2GceU2SVRi+6GFt+NkjRWprIiyrXOI1EkhRnRudn9K+5O6"}   Ip:192.168.1.126  port:7000
08-18 00:30:26.296 24531 24898 D GR_DeviceManage: 192.168.1.126prase status pack:{"t":"dat","mac":"502cc64043f8","r":200,"cols":["Pow","HeatCoolType","Mod","TemUn","SetTem","TemRec","StHt","SvSt","host","name","AllErr","ModelType"],"dat":[0,0,1,0,22,0,0,0,"dis.gree.com","c64043f8",0,32776]}
08-18 00:30:26.297 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"iwXzzHquHuzklfCBI+lCTw==","pack":"JtoKliwtq5m94pPceGVXWs4iqtkA1xf0YwdiCerfl63CNCFNhgQnaNK3m/jmA7TJ0/OlU5e3VeI4+5jGYrzWjLPPnRE="}   Ip:192.168.1.127  port:7000
08-18 00:30:26.298 24494 24653 D GR_DeviceManage: bindok pack:{"t":"bindok","mac":"502cc64041e3","key":"LtBiQw0l5a18Y4N9","r":200}
08-18 00:30:26.298 24494 24653 D GR_DeviceManage: deviceList.size:3 key:LtBiQw0l5a18Y4N9 mac:502cc64041e3
08-18 00:30:26.299 24494 24653 D GR_DeviceManage: 收到bind发送查询状态502cc64041e3
08-18 00:30:26.301 24494 24653 I GR_DeviceManage: QueryStatuesSingle send data to device IP:192.168.1.127 port:7000 data:{"cid":"app","i":0,"pack":"TiRe/GtmLjJEnHRXvUNKH/T17IdygkfUbKChUhQwUlpw1GoxJ2oyOtj422dw/5TVbnDn1s7zQtP1/QvAqR7rgsT4LqH2pPkct/dXqCEB5+moACBFuc4LZ7Jn/wHTbNhOiCOqewHWYoy8PPCZ49g0AeeaUuoCL5oVaKTggjlu3km1KdBODtsAZxKfPqxxjD+x8/s=","t":"pack","tag":"gkSgQvO6zIOYZzIrnTOAEw==","tcid":"502cc64041e3","uid":2100237}
08-18 00:30:26.321 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"TCYEztGjJF6gFBxxKIy/kg==","pack":"JtoKliwtq5m94pPceGVXWs4iqtkA1xf0YwdiCerfla7JNCFNhgQnaNK35L31XIOPlan7YNzHY4ESjpjGYrzWjLPPnRE="}   Ip:192.168.1.126  port:7000
08-18 00:30:26.322 24494 24653 D GR_DeviceManage: bindok pack:{"t":"bindok","mac":"502cc64043f8","key":"31Q6f1v6kRzHoWdL","r":200}
08-18 00:30:26.322 24494 24653 D GR_DeviceManage: deviceList.size:3 key:31Q6f1v6kRzHoWdL mac:502cc64043f8
08-18 00:30:26.322 24494 24653 D GR_DeviceManage: 收到bind发送查询状态502cc64043f8
08-18 00:30:26.325 24494 24653 I GR_DeviceManage: QueryStatuesSingle send data to device IP:192.168.1.126 port:7000 data:{"cid":"app","i":0,"pack":"08QvhF5V9Nkyy0N1apSvyqCgNnN8WcHZvTKh2bUO5VJr2kffkn6twiiXWZEd5VRtoiVQ3rZB5G5I278eiB5/p8g5BA3xFZep/uwWpG47UgxMOIq+L/n3ppS7G5doQ0q7Q4qMEdOwK+A4iCqrkXa+hDKexaauAmz6XP7izWgL6KkAthe6qv1YYe3lcjppTYZKGvE=","t":"pack","tag":"bqOr77jUcPMjb7YTidobIA==","tcid":"502cc64043f8","uid":2100237}
08-18 00:30:26.326 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":0,"uid":0,"cid":"502cc64041e3","tcid":"","tag":"zSebq2dMNrLwdn0IQxQvcw==","pack":"TiRJsT03aGlrnAgapwAFH4ayuMMDjkuODOnlBlMvUjs9wmonNw5ne6/1lichjsv6GEXlg8D9NP79zhrg5F2lhcnAP6H2pOcFgKFZplcM5c+yACBFhMoSVvUm/2ydVPhRqGTle2CbVZ2YHKvFpKkffrHVH6tIestUerqhj243i1+obqIATrwGNwqRb5V/nC+uhf+F31hmNxV8NF0XgNu/ZA3NfbQK68cA7BC5WbKOcDQ1ugfXnbefRiwEvIldDfjZcVOypVNODwpGplg8ytBj1VHs"}   Ip:192.168.1.127  port:7000
08-18 00:30:26.328 24494 24653 D GR_DeviceManage: 192.168.1.127prase status pack:{"t":"dat","mac":"502cc64041e3","r":200,"cols":["Pow","HeatCoolType","Mod","TemUn","SetTem","TemRec","StHt","SvSt","host","name","AllErr","ModelType"],"dat":[0,0,1,0,22,0,0,0,"dis.gree.com","c64041e3",0,32776]}
08-18 00:30:26.336 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":1,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"QGOCZUUhPgObyeYYof53XQ==","pack":"JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDrzThOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5u6qYeFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgl8Ua2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="}   Ip:192.168.1.126  port:7000
08-18 00:30:26.338 24494 24653 D GR_DeviceManage: 192.168.1.126dev pack:{"t":"dev","cid":"502cc64043f8","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc64043f8","mid":"10001","model":"gree","name":"c64043f8","series":"gree","vender":"1","ver":"V2.0.0","lock":0}
08-18 00:30:26.338 24494 24653 E GR_DeviceManage: 解析scan包  扫描到了502cc64043f8
08-18 00:30:26.338 24494 24653 D GR_DeviceManage: 解析scan包 加入新设备 mac502cc64043f8
08-18 00:30:26.368 24494 24653 I GR_DeviceManage: 接收数据:{"t":"pack","i":0,"uid":0,"cid":"502cc64043f8","tcid":"","tag":"zelWQx+La6X3OGEuSJ9OBQ==","pack":"08Q4yQgEsoIdyz84cNfgytLnYjcNVc2D3Xvlj/Ea5TMmzEfJghr4g1+aFNFMlAtC1BBSi7hPkkNA6K4+xV0xoMUBFQ3xFYmwyboYqhg2UCpWOIq+Ev3ul9P6G/ome2qkY83DEbL9HPEcqHH31geV+2TRiOfkVz27TuCjwD9Svb8f8m706ppeMfXrIwNnXZZVbPU5Ai9gUEW4l3I9IES6YVM12v4Ju+ZdL6Wl8szbRS2GceU2SVRi+6GFt+NkjRWprIiyrXOI1EkhRnRudn9K+5O6"}   Ip:192.168.1.126  port:7000
08-18 00:30:26.370 24494 24653 D GR_DeviceManage: 192.168.1.126prase status pack:{"t":"dat","mac":"502cc64043f8","r":200,"cols":["Pow","HeatCoolType","Mod","TemUn","SetTem","TemRec","StHt","SvSt","host","name","AllErr","ModelType"],"dat":[0,0,1,0,22,0,0,0,"dis.gree.com","c64043f8",0,32776]}

Both devices seem to respond with the same data to the discovery broadcast, so I assume they use the same encryption key at this stage. Any idea what could be happening? Maybe the protocol changed for newer devices? The firmware version on the wifi module is V1.08.

NickB1 commented 3 years ago

Did some testing in Python with data from the discovery packet in the app log together with the generic key. Also tried a different key that can be seen further down the log with a corresponding packet. No luck, I'm getting "ValueError: Data must be aligned to block boundary in ECB mode" for all combinations. Seems like they are using a different encryption scheme?

import base64
from Crypto.Cipher import AES

key1 = "a3K8Bx%2r8Y7#xDh"
data1 = "JtoKliwtrZWlpNCVOSARFZVjvdMQgUTwNFRgDL/YhOTTdG5N10M5OI3w9aCGCJffjfuyCITofrMT4JbII6+A1" \
       "+2Qyk7gfwk5dZR2EayhdZgEoOSGGofp1NG/tZ5s6a0eFq+2oChWDqTDGSfh0Qvsoz/uHnpJj7cgLseHEa1Qy49usnE8T0XpY+Hirgt" \
       "/Wq2y2vzlARuL1vKmpT7wkMRwPTuo1zE7mhrFvdLWdzI6Z6osCeD6tdJoLaE7k6FHvghQKe+boL4="

key2 = "LtBiQw0l5a18Y4N9"
data2 = "TiRJsT03aGlrnAgapwAFH4ayuMMDjkuODOnlBlMvUjs9wmonNw5ne6/1lichjsv6GEXlg8D9NP79zhrg5F2lhcnAP6H2pOcFgKFZplcM5c" \
        "+yACBFhMoSVvUm/2ydVPhRqGTle2CbVZ2YHKvFpKkffrHVH6tIestUerqhj243i1+obqIATrwGNwqRb5V/nC+uhf+F31hmNxV8NF0XgNu" \
        "/ZA3NfbQK68cA7BC5WbKOcDQ1ugfXnbefRiwEvIldDfjZcVOypVNODwpGplg8ytBj1VHs"

if __name__ == '__main__':

    data = base64.b64decode(data1 )
    cipher = AES.new(key1 .encode("utf8"), AES.MODE_ECB)
    plaintext = cipher.decrypt(data)
    print(plaintext.decode("utf-8", 'ignore'))
RobHofmann commented 3 years ago

Possibly yes. They use a different implementation apparently. Im afraid I can't help here.

Feel free to make a PR with support for your model if you do find it out.

NickB1 commented 3 years ago

Not sure if it is due to the ac being a different model. You can see "model":"gree" coming back a lot in the app log. The ac units also work fine using the gree app. So it might be an update to their protocol? These are the wifi modules used: https://www.airco-shop.be/a-64517282/bulex-airco/bulex-wifi-module/

RobHofmann commented 3 years ago

Maybe yes. I haven't encountered this on my devices. Maybe someone else encountered this as well.

QVolkaert commented 3 years ago

I have the same wifi module (but with the vaillant brand, same webshop though), and although it works with the gree+ app and the ewpe app I can't add them either, same error as @NickB1 . gree.py gives the following output:

Traceback (most recent call last): File "gree.py", line 190, in <module> search_devices() File "gree.py", line 95, in search_devices pack = json.loads(decrypt_generic(resp['pack'])) File "gree.py", line 61, in decrypt_generic return decrypt(pack_encoded, GENERIC_KEY) File "gree.py", line 55, in decrypt pack_decrypted = decryptor.update(pack_decoded) + decryptor.finalize() File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 159, in finalize data = self._ctx.finalize() File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 179, in finalize "The length of the provided data is not a multiple of " ValueError: The length of the provided data is not a multiple of the block length.

If there's anything I can do to help please shout :)

NickB1 commented 3 years ago

The decoded pack also shows "ver":"V2.0.0", all older examples I have seen have V1.x.x so I suspect they made some changes. The app will probably need to be disassembled to look into the new protocol? Have given up and made an MQTT to Ir bridge using the IRremoteESP8266 library for now to be able to control the AC. Let me know if I can be of any help.

jodewee commented 2 years ago

Hi, i have exact the same issue using the same model of wifi and airco. Did you make any progress? i'm trying to get the encryption key from the android package

SanderBelmans commented 1 year ago

The decoded pack also shows "ver":"V2.0.0", all older examples I have seen have V1.x.x so I suspect they made some changes. The app will probably need to be disassembled to look into the new protocol? Have given up and made an MQTT to Ir bridge using the IRremoteESP8266 library for now to be able to control the AC. Let me know if I can be of any help.

Hi Nick, I have the same AC's. I was looking into this integration, to bad it doesnt work, so I am not going to try. Any documentation on the IR integration? I'm quite the noob...

NickB1 commented 1 year ago

Hi Nick, I have the same AC's. I was looking into this integration, to bad it doesnt work, so I am not going to try. Any documentation on the IR integration? I'm quite the noob...

I used an ESP32 board with Tasmota (https://tasmota.github.io/docs/Tasmota-IR/#sending-ir-commands, GREE as vendor). For use in home assistant I would recommend using ESPHome (https://esphome.io/components/climate/climate_ir.html?highlight=ir). The boards are connected to the power connector that's used for the original modules, it has 5V on it. A 4pin 2.54mm JST connector fits. I taped the boards in the bottom of the compartment to the right of the ac unit, the IR led pointing straight upwards seems to work best.

jodewee commented 5 months ago

@NickB1 i had it solved with this new build of the integration, the new encryption method is supported now