Skip to content

Conversation

@paimonsoror
Copy link

This should resolve the errors with the rate_limit_delay function, as well as subsequent async related errors that happen afterwards.

Resolves: #216

for component in PLATFORMS:
await hass.config_entries.async_forward_entry_setup(entry, component)
# Resolve deprecation in latest HA by moving to setups vs setup
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#235 is more thorough with the addition of error logging on fail

success = False
try:
success = hass.config_entries.async_forward_entry_unload(entry, component)
success = await hass.config_entries.async_forward_entry_unload(entry, component)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will fail, the function needs to be defined as async

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the changes manually and they seem to work but this PR making the line 96 function definition async.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gabosom odd, I could have sworn I tried that and still got errors. So did you set the def as a sync and keep the await?

I can give that another test and update the PR

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the await is added

success = await hass.config_entries.async_forward_entry_unload(entry, component)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'await' outside async function

After changing to async def _unload_component_entry the error goes away but 2 new errors appear

Error unloading entry govee for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 963, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 703, in async_unload_entry
    return await hass.data[DATA_COMPONENT].async_unload_entry(entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 237, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

and

Error setting up entry govee for govee
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 749, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/govee/__init__.py", line 69, in async_setup_entry
    raise PlatformNotReady()
homeassistant.exceptions.PlatformNotReady: None

But I think they are caused by me currently being rate-limited.

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.

AttributeError did you mean 'rate_limit_reset' after restart

4 participants