StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
616 stars 111 forks source link

Update __init__.py #723

Open safehome-jdev opened 1 year ago

safehome-jdev commented 1 year ago

Replace the deprecated async_get_registry to the new async_get method! You cannot await async_get so it was removed. If there's a valid reason it should wait on a promise, let me know and I'm we can figure something out. Let me know if this closes this long-standing issue for you 👍🏼

Ringo982 commented 1 year ago

Hey guys, what i have to do to solve this problem? Detected integration that uses deprecated async_get_registry to access entity registry, use async_get instead. Please report issue to the custom integration author for shelly using this method at custom_components/shelly/init.py, line 356: await self.hass.helpers.entity_registry.async_get_registry()

Have i to modify the init.py as mentioned above? Many thanks

Senbei123 commented 1 year ago

Any chance, that this will be merged in the master? I still have the issue with version HA 2022.12 and latest shelly. Next to the warning it causes issues:

Logger: homeassistant
Source: helpers/entity.py:517
First occurred: 22:43:55 (24 occurrences)
Last logged: 23:23:21
Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 517, in async_update_ha_state
    raise RuntimeError(f"Attribute hass is None for {self}")
RuntimeError: Attribute hass is None for <Entity Shelly 2 - 55BB55-2 - Switch: off>
safehome-jdev commented 1 year ago

@Ringo982 @Senbei123

AFAIK the pull hasn't been approved; perhaps the dev is taking an extended vacation 🤷🏽‍♂️? I haven't heard anything from StryaHem about this; I've used this fix in my environment and do not have any problems. Copy/paste the contents of my file over your own __init__.py file to fix the issue. Or wait until pull is approved/merged