Show how to only allow one instance

This commit is contained in:
ludeeus
2020-04-20 17:54:58 +00:00
parent a53b0f75a1
commit a727e061d6
6 changed files with 31 additions and 17 deletions

View File

@ -43,11 +43,9 @@ class BlueprintEntity(entity.Entity):
async def async_added_to_hass(self):
"""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):
"""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):
"""Update Brother entity."""