entity = hass.data[DATA_ZIGATE_DEVICES][ieee]
component.async_remove_entity(entity.entity_id)
del hass.data[DATA_ZIGATE_DEVICES][ieee]
You should use key instead of ieee.
And you should use command:
hass.add_job(component.async_remove_entity(entity.entity_id)) instead of component.async_remove_entity(entity.entity_id)
Hi Doudz, I find that you add entity with command (for ZiGateSwitch)
But, in function device_removed, you do this:
You should use key instead of ieee. And you should use command:
hass.add_job(component.async_remove_entity(entity.entity_id))
instead ofcomponent.async_remove_entity(entity.entity_id)