async def _async_registry_updated(self, event: Event) -> None:
    'Handle entity registry update.'
    data = event.data
    if (data['action'] == 'remove'):
        (await self.async_removed_from_registry())
        self.registry_entry = None
        (await self.async_remove())
    if (data['action'] != 'update'):
        return
    ent_reg = (await self.hass.helpers.entity_registry.async_get_registry())
    old = self.registry_entry
    self.registry_entry = ent_reg.async_get(data['entity_id'])
    assert (self.registry_entry is not None)
    if self.registry_entry.disabled:
        (await self.async_remove())
        return
    assert (old is not None)
    if (self.registry_entry.entity_id == old.entity_id):
        self.async_write_ha_state()
        return
    (await self.async_remove(force_remove=True))
    assert (self.platform is not None)
    self.entity_id = self.registry_entry.entity_id
    (await self.platform.async_add_entities([self]))
Handle entity registry update.
async def _async_registry_updated(self, event: Event) -> None:
    
    data = event.data
    if (data['action'] == 'remove'):
        (await self.async_removed_from_registry())
        self.registry_entry = None
        (await self.async_remove())
    if (data['action'] != 'update'):
        return
    ent_reg = (await self.hass.helpers.entity_registry.async_get_registry())
    old = self.registry_entry
    self.registry_entry = ent_reg.async_get(data['entity_id'])
    assert (self.registry_entry is not None)
    if self.registry_entry.disabled:
        (await self.async_remove())
        return
    assert (old is not None)
    if (self.registry_entry.entity_id == old.entity_id):
        self.async_write_ha_state()
        return
    (await self.async_remove(force_remove=True))
    assert (self.platform is not None)
    self.entity_id = self.registry_entry.entity_id
    (await self.platform.async_add_entities([self]))