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

Unable to connect to ac #174

Closed ShiinaKin closed 5 months ago

ShiinaKin commented 5 months ago

Describe the bug

Setup of platform gree is taking longer than 60 seconds. Startup will proceed without waiting any longer. I have tried to reset the WiFi of A/C and other methods in the issues.

Configuration

- platform: gree
  name: Badroom-AC
  host: 192.168.1.163
  port: 7000
  mac: 'e8:16:56:4f:fa:f0'
  target_temp_step: 1
  encryption_version: 2
  temp_sensor: sensor.ble_temperature_3
  lights: input_boolean.bedroom_ac_lights
  health: input_boolean.bedroom_ac_health
  sleep: input_boolean.bedroom_ac_sleep
  powersave: input_boolean.bedroom_ac_powersave

Platform:

Additional context It should be noted that, my firmware of A/C is v1.25, maybe they made some changes to the protocol.

Logs

2024-06-16 09:03:37.554 INFO (MainThread) [custom_components.gree.climate] Setting up Gree climate platform
2024-06-16 09:03:37.554 INFO (MainThread) [custom_components.gree.climate] Adding Gree climate device to hass
2024-06-16 09:03:37.554 INFO (MainThread) [custom_components.gree.climate] Initialize the GREE climate device
2024-06-16 09:03:37.555 INFO (MainThread) [custom_components.gree.climate] Retrieving HVAC encryption key
2024-06-16 09:03:37.578 INFO (MainThread) [custom_components.gree.climate] Fetching(192.168.1.163, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89K2vs2Bb39BUckg7tMAzgfkbQU3H+DJw/DAIDhZ2Qc4K46l9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"e816564ffaf0","uid": 0, "tag" : "bVOOJvDa6Gh7tX1aARVZAA=="})
2024-06-16 09:03:47.582 ERROR (MainThread) [homeassistant.components.climate] Setup of platform gree is taking longer than 60 seconds. Startup will proceed without waiting any longer.
RobHofmann commented 5 months ago

Did you also try the v1 encryption?

ShiinaKin commented 5 months ago

Did you also try the v1 encryption?

This is indeed something I did not try, as the README say that v1.21 should use encryption version 2, and now it works fine, thanks for the reply.

Also hope to specify this in the README, that may help somebody like me.

A/C model is KFG-35GW(35549)FNhAc-B1(WIFI)

Tempmail1234-pass commented 5 months ago

@ShiinaKin It worked for you using the v1 encryption? can you send me the full climate.yaml and configuration.yaml files please? Also do I need to first connect my A/C to gree+ app first and then run download the integration or do I need to reset my A/C wifi by powering off and pressing wifi and mode first?

ShiinaKin commented 5 months ago

@ShiinaKin It worked for you using the v1 encryption? can you send me the full climate.yaml and configuration.yaml files please?

- platform: gree
  name: Badroom-AC
  host: 192.168.1.201
  port: 7000
  mac: 'e816564ffaf0'
  target_temp_step: 1
  encryption_version: 1
  uid: 0
  temp_sensor: sensor.ble_temperature_3
  xfan: input_boolean.bedroom_ac_xfan
  lights: input_boolean.bedroom_ac_lights
  health: input_boolean.bedroom_ac_health
  sleep: input_boolean.bedroom_ac_sleep
  powersave: input_boolean.bedroom_ac_powersave
  auto_xfan: true
  auto_light: false
  horizontal_swing: true
ShiinaKin commented 5 months ago

@ShiinaKin It worked for you using the v1 encryption? can you send me the full climate.yaml and configuration.yaml files please? Also do I need to first connect my A/C to gree+ app first and then run download the integration or do I need to reset my A/C wifi by powering off and pressing wifi and mode first?

My steps:

  1. use gree+ and add a/c as my device, it will also let the a/c connect to your own wifi
  2. find the mac in the device info footer, and find it's ip by router management
  3. option: fixed the ip with mac by router management
  4. try to ping the ip of a/c, it will get resp if everything is ok
  5. edit climate.yaml & restart HA
  6. done

may helpful for u

Tempmail1234-pass commented 5 months ago

@ShiinaKin The A/C name in Gree+ app must be the same for the climate.yaml file? Also the Mac adress should be separeted by '-' or ':', am I wrong?

ShiinaKin commented 5 months ago

@ShiinaKin The A/C name in Gree+ app must be the same for the climate.yaml file? Also the Mac adress should be separeted by '-' or ':', am I wrong?

don't need to be same, and as you see "tcid":"e816564ffaf0", the mac finally will be processing like this partten, but you also could try it, i can use it without split.

Tempmail1234-pass commented 5 months ago

@ShiinaKin Thanks. I don't see any logs, is my configuration.yaml fine?

# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

logger:
  default: info
  logs:
    custom_components.gree: debug
    custom_components.gree.climate: debug

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
climate: !include climate.yaml

Do I only have to click?

Restart Home Assistant? This will interrupt all running automations and scripts.

ShiinaKin commented 5 months ago

@ShiinaKin Thanks. I don't see any logs, is my configuration.yaml fine?

# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

logger:
  default: info
  logs:
    custom_components.gree: debug
    custom_components.gree.climate: debug

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
climate: !include climate.yaml

Do I only have to click?

Restart Home Assistant? This will interrupt all running automations and scripts.

seems good, use the fully restart, not just reload yaml.

and in my practice, the a/c will appear in the home page of HA, and be an entity, not a device

Tempmail1234-pass commented 5 months ago

@ShiinaKin Not working (Unavailable entity), is it fine?

- platform: gree
  name: ac
  host: 192.168.0.165
  port: 7000
  mac: '9424b8b7cc08'
  target_temp_step: 1
  encryption_version: 1
ShiinaKin commented 5 months ago

@ShiinaKin Not working (Unavailable entity), is it fine?

- platform: gree
  name: ac
  host: 192.168.0.165
  port: 7000
  mac: '9424b8b7cc08'
  target_temp_step: 1
  encryption_version: 1

at lease you will see the failed log

try to ping 192.168.0.165, i dont know your network env detail, can't help more

Tempmail1234-pass commented 5 months ago

@ShiinaKin This is indeed the right IP and mac, see this https://github.com/tomikaa87/gree-remote/issues/63#issuecomment-2176795210

Tempmail1234-pass commented 5 months ago

@ShiinaKin My bad, I looked for the logs in the wrong place, this is my log:

2024-06-19 11:43:10.909 INFO (MainThread) [homeassistant.components.climate] Setting up gree.climate
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] Setting up Gree climate platform
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] Adding Gree climate device to hass
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] Initialize the GREE climate device
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] name(): ac
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] name(): ac
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] supported_features(): 441
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2024-06-19 11:43:10.909 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-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2024-06-19 11:43:10.909 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2024-06-19 11:43:10.910 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2024-06-19 11:43:10.910 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2024-06-19 11:43:10.910 INFO (MainThread) [custom_components.gree.climate] supported_features(): 441
2024-06-19 11:43:10.910 INFO (MainThread) [custom_components.gree.climate] Gree climate device added to hass()
2024-06-19 11:43:10.910 INFO (MainThread) [custom_components.gree.climate] Retrieving HVAC encryption key
2024-06-19 11:43:10.912 INFO (MainThread) [custom_components.gree.climate] Fetching(192.168.0.165, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEXAMwiuNsAzgfkbQU3H+DJn/zDIm9Xj1Y9Kdit9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8b7cc08","uid": 0, "tag" : "0O6hIyG+4TwGey8NFvt5uQ=="})
2024-06-19 11:43:10.928 INFO (MainThread) [custom_components.gree.climate] Starting SyncState
2024-06-19 11:43:10.928 INFO (MainThread) [custom_components.gree.climate] Could not connect with device.

I have the "tag" which is good, but it

Could not connect with device

What should I try? This is what I tried


- platform: gree
  name: ac
  host: 192.168.0.165
  port: 7000
  mac: '9424b8b7cc08'
  target_temp_step: 1
  encryption_version: 2
jodewee commented 5 months ago

@Tempmail1234-pass , do you use the release 2.11 or the latest (2.12)?

Tempmail1234-pass commented 5 months ago

@jodewee latest (2.12), why?

jodewee commented 5 months ago

@jodewee latest (2.12), why?

same issue over here since 2.12. Uninstall it, and install the 2.11 version; that should work just fine

jodewee commented 5 months ago

@Tempmail1234-pass can you post or upload you full log?

ShiinaKin commented 5 months ago

from the log, your problom has essentially different with me.

the HA connect to the a/c successfully, but cannot communicate with it, it more likely the protocol prob.

and after i see the commit for 2.12, it just support the horizontal swing and add some err retry & log

see:

https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent/blob/a4f1b8a67da47a2738363a13acf1dfe004179954/custom_components/gree/climate.py#L603

Tempmail1234-pass commented 5 months ago

@jodewee I can't believe it!!! After countless days and hours of trying it finally worked🤩, I can't thank you enough! THANK YOU SO MUCH!😀

jodewee commented 5 months ago

@RobHofmann & @toughvj ; clearly the 2.12 release breaks the integration for devices with the new encryption method. If i can help with testing or implementing a possible fix next week, just let me know.

RobHofmann commented 5 months ago

Yeah. We need to wait for @toughvj here. Next week we'll do further investigations :).

For now stick to 2.11.