Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async_track_state_change -> async_track_state_change_eventaccording #155

Merged
merged 3 commits into from
May 6, 2024

Conversation

toughvj
Copy link
Contributor

@toughvj toughvj commented May 6, 2024

changed async_track_state_change with async_track_state_change_eventaccording to https://developers.home-assistant.io/blog/2024/04/13/deprecate_async_track_state_change/

@RobHofmann
Copy link
Owner

Hi! Thanks for this PR. I've tried running your version, but i'm getting these errors:

RuntimeError: no running event loop
2024-05-06 11:58:32.458 ERROR (MainThread) [homeassistant.components.climate] Error while setting up gree platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/gree/climate.py", line 126, 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 211, in __init__
    hass, powersave_entity_id, self._async_powersave_entity_state_changed)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 324, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'GreeClimate' object has no attribute '_async_powersave_entity_state_changed'. Did you mean: '_async_air_entity_state_changed'?
2024-05-06 11:58:32.594 ERROR (MainThread) [homeassistant.components.climate] Error while setting up gree platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/gree/climate.py", line 126, 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 211, in __init__
    hass, powersave_entity_id, self._async_powersave_entity_state_changed)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 324, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'GreeClimate' object has no attribute '_async_powersave_entity_state_changed'. Did you mean: '_async_air_entity_state_changed'?
2024-05-06 11:58:32.678 ERROR (MainThread) [homeassistant.components.climate] Error while setting up gree platform for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/gree/climate.py", line 126, 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 211, in __init__
    hass, powersave_entity_id, self._async_powersave_entity_state_changed)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 324, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'GreeClimate' object has no attribute '_async_powersave_entity_state_changed'. Did you mean: '_async_air_entity_state_changed'?
2024-05-06 11:58:40.419 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.
2024-05-06 11:58:40.466 ERROR (MainThread) [homeassistant.components.mobile_app.notify] Requested entity was not found. This message is generated externally to Home Assistant.

It might be me doing something wrong!

@toughvj
Copy link
Contributor Author

toughvj commented May 6, 2024

my mistake, it should be ok now.

@RobHofmann RobHofmann merged commit 04f863a into RobHofmann:master May 6, 2024
@RobHofmann
Copy link
Owner

Seems to work like a charm! Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants