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

Add guard to global updater #174

Merged
merged 2 commits into from
Aug 22, 2024
Merged

Add guard to global updater #174

merged 2 commits into from
Aug 22, 2024

Conversation

dmulcahey
Copy link
Contributor

This PR fixes an exception I ran into when building out the HA side of PR: #93

Traceback (most recent call last):
  File "/Users/dmulcahey/development/homeassistant/home-assistant/homeassistant/config_entries.py", line 819, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dmulcahey/development/homeassistant/home-assistant/homeassistant/components/zha/__init__.py", line 234, in async_unload_entry
    await ha_zha_data.gateway_proxy.shutdown()
  File "/Users/dmulcahey/development/homeassistant/home-assistant/homeassistant/components/zha/helpers.py", line 753, in shutdown
    await self.gateway.shutdown()
  File "/Users/dmulcahey/development/homeassistant/home-assistant/venv/lib/python3.12/site-packages/zha/application/gateway.py", line 741, in shutdown
    await device.on_remove()
  File "/Users/dmulcahey/development/homeassistant/home-assistant/venv/lib/python3.12/site-packages/zha/zigbee/device.py", line 773, in on_remove
    await platform_entity.on_remove()
  File "/Users/dmulcahey/development/homeassistant/home-assistant/venv/lib/python3.12/site-packages/zha/application/platforms/sensor/__init__.py", line 467, in on_remove
    self._device.gateway.global_updater.remove_update_listener(self.update)
  File "/Users/dmulcahey/development/homeassistant/home-assistant/venv/lib/python3.12/site-packages/zha/application/helpers.py", line 405, in remove_update_listener
    self._update_listeners.remove(listener)
ValueError: list.remove(x): x not in list

Copy link

codecov bot commented Aug 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.79%. Comparing base (2f06f00) to head (5d62314).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #174   +/-   ##
=======================================
  Coverage   95.79%   95.79%           
=======================================
  Files          61       61           
  Lines        9319     9323    +4     
=======================================
+ Hits         8927     8931    +4     
  Misses        392      392           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dmulcahey dmulcahey merged commit 409b580 into dev Aug 22, 2024
6 checks passed
@dmulcahey dmulcahey deleted the dm/add-updater-guard branch August 22, 2024 14:31
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.

2 participants