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
317 stars 105 forks source link

AC Control not working #215

Closed thoutenbos closed 3 weeks ago

thoutenbos commented 4 weeks ago

Hello Rob,

I have two Gree AC that I would like to control with your integration. After configuration I can read all the settings, and they also update after changes to the AC. However I am unable to perform any control commands. Control works fine with https://github.com/tomikaa87/gree-remote using the same encryption key

My climate config:

  name: AC
  host: 10.0.0.13
  port: 7000
  mac: '50-2C-C6-D2-82-AB'
  target_temp_step: 1
  encryption_key: 'xxx'
  eightdegheat: 'input_boolean.ac_eightdegheat'

Here is the debug log:

2024-10-24 11:41:58.884 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2024-10-24 11:41:58.886 INFO (SyncWorker_16) [custom_components.gree.climate] set_hvac_mode(): heat
2024-10-24 11:41:58.886 INFO (SyncWorker_16) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2024-10-24 11:41:58.886 INFO (SyncWorker_16) [custom_components.gree.climate] Starting SyncState
2024-10-24 11:41:58.886 INFO (SyncWorker_16) [custom_components.gree.climate] Fetching(10.0.0.13, 7000, 10, {"cid":"app","i":0,"pack":"zZ4Uq0+49m4/PVsfu9EBLtU0xV8ThISe+Rcmh1X4PwOUtVD0YhCUry3qgKCTEsRlVzvqFKev+sBkAzD2ZRVKqKphZGKRzmWD36L0olyikKcv+IWt3ZbP66WLVjbtBU2uV/EM+usOj+q0HO86ecxNyKBUPzlypKKQUVSVGwqtrTOUSfrMFMypZx81x/tDmoVpX2qI+kgnBQp7gsWYNpc4dMCO44b46/tow8oy9gwAai5B4IqOUaEyh5VXdHjbGvir5s6BWIeHzZi1jKc13oagsEgxPUoks4LrPCMwHKY0ctgGw9l+izxxsM+7MxyAtquO","t":"pack","tcid":"50-2c-c6-d2-82-ab","uid":0})
2024-10-24 11:41:58.889 INFO (SyncWorker_16) [custom_components.gree.climate] 3
2024-10-24 11:41:59.013 INFO (SyncWorker_16) [custom_components.gree.climate] Setting acOptions with retrieved HVAC values
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Pow: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Mod: 4
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting SetTem: 21
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting WdSpd: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Air: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Blo: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Health: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting SwhSlp: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Lig: 1
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting SwingLfRig: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting SwUpDn: 2
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Quiet: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting Tur: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting StHt: 0
2024-10-24 11:41:59.014 INFO (SyncWorker_16) [custom_components.gree.climate] Setting TemUn: 0
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Setting HeatCoolType: 0
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Setting TemRec: 0
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Setting SvSt: 0
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Setting SlpMod: 0
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Setting TemSen: 53
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Done setting acOptions
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Overwriting acOptions with new settings
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Overwriting Pow: 1
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Overwriting Mod: 4
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Done overwriting acOptions
2024-10-24 11:41:59.015 INFO (SyncWorker_16) [custom_components.gree.climate] Fetching(10.0.0.13, 7000, 10, {"cid":"app","i":0,"pack":"1LoKaHQ7UJSO28YBU3lTsWMGJX9MepMa3SmC+tX7i2u4e6svYVTU+fL0N2pFiONb/l+6wkmx4s5i9jyqQDs2ESsfhMEVVEe2zvka4CSCgGqyc9BwaTs1jfTBGLYghm5F2SQVNna79lWOwUQzUAY3kxTdlG2S11OQhT2wwJnFtutwHMfC2KNgjwvbH1Wu8+EtLyGCU6BU6yc4DGxMWGQUhIiUnRdDhNdqo3T31IwiLnT3hp/oQcjMylH4SMJujdxYGtIvZTOFMhgj0CXZFv3kukJ+GZDIV8bU6l9mvLc59xY=","t":"pack","tcid":"50-2c-c6-d2-82-ab","uid":0})
2024-10-24 11:41:59.016 INFO (SyncWorker_16) [custom_components.gree.climate] 3
2024-10-24 11:42:09.027 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140124095295648] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 772, in async_handle_set_hvac_mode_service
    await self.async_set_hvac_mode(hvac_mode)
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 780, in async_set_hvac_mode
    await self.hass.async_add_executor_job(self.set_hvac_mode, hvac_mode)
TimeoutError: timed out

Do you have any tips to get this working?

Gr, Thijs

RobHofmann commented 4 weeks ago

You are getting a timeout. This means home assistant is not getting a timely response for some reason.

Can you try removing these lines from your config and see if that helps?:

encryption_key: 'xxx'
  eightdegheat: 'input_boolean.ac_eightdegheat'
thoutenbos commented 3 weeks ago

Unfortunately it is unable to retrieve the encryption key then If I only remove the 8deg then the error is the same (reading works but writing=timeout)

RobHofmann commented 3 weeks ago

Hmm im not sure why its getting a timeout then. Are you sure HASS can reach the HVAC? and that the IP & port are correct?

thoutenbos commented 3 weeks ago

Yes absolutely Also because reading out the current status does work And I see the packets being sent and received with a packet dump

I'll try to do a diff between the (working) gree-remote packet and the HomeAssistant-GreeClimateComponent packet. Maybe my AC has some specific differences that we could implement

RobHofmann commented 3 weeks ago

Yes thats the only way forward I think. From my side its pretty much impossible to debug this exact situation.

thoutenbos commented 3 weeks ago

Got it working now!

In the traces I noticed gree-remote was using the MAC in a different format. Removing all the dashes fixed it!

So instead of mac: '50-2C-C6-D2-82-AB'

I had to configure it like mac: '502cc6d282ab'

RobHofmann commented 3 weeks ago

Thanks for posting back. Interesting. Never seen it having to be registered this way. I'll make sure to put it in the docs :).