use async_on_remove for IPP Update Coordinator (#33596)

This commit is contained in:
Chris Talkington 2020-04-04 21:42:51 -05:00 committed by GitHub
parent 528c7f4871
commit 927c2314c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,11 +168,9 @@ class IPPEntity(Entity):
async def async_added_to_hass(self) -> None:
"""Connect to dispatcher listening for entity data notifications."""
self.coordinator.async_add_listener(self.async_write_ha_state)
async def async_will_remove_from_hass(self) -> None:
"""Disconnect from update signal."""
self.coordinator.async_remove_listener(self.async_write_ha_state)
self.async_on_remove(
self.coordinator.async_add_listener(self.async_write_ha_state)
)
async def async_update(self) -> None:
"""Update an IPP entity."""