deCONZ allow unloading of config entry#14115
Conversation
| hass.services.async_remove(DOMAIN, SERVICE_DECONZ) | ||
| deconz.close() | ||
| for component in ['binary_sensor', 'light', 'scene', 'sensor']: | ||
| hass.async_add_job(hass.config_entries.async_forward_entry_unload( |
There was a problem hiding this comment.
No reason to async_add_job, you can just await them.
| if sensor and sensor.type in DECONZ_SENSOR: | ||
| if sensor.type in DECONZ_REMOTE: | ||
| DeconzEvent(hass, sensor) | ||
| hass.data[DATA_DECONZ_EVENT].append(DeconzEvent(hass, sensor)) |
There was a problem hiding this comment.
@balloob do you want me to move the creation of the events and the class definition to be created by the setup entry method instead?
There was a problem hiding this comment.
Since it's just firing events, it should indeed be handled at the component level. It should not be done in the sensor platform.
| config_entry, component)) | ||
|
|
||
| hass.data[DATA_DECONZ_EVENT] = [DeconzEvent(hass, sensor) | ||
| for sensor in deconz.sensors.values() if sensor.type in DECONZ_REMOTE] |
There was a problem hiding this comment.
continuation line under-indented for visual indent
| CONF_API_KEY, CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_STOP) | ||
| from homeassistant.core import callback | ||
| from homeassistant.const import (CONF_API_KEY, CONF_EVENT, | ||
| CONF_HOST, CONF_ID, CONF_PORT, EVENT_HOMEASSISTANT_STOP) |
There was a problem hiding this comment.
continuation line under-indented for visual indent
|
Looks good! Ok to merge when tests pass. Btw I've added some config entry documentation to https://developers.home-assistant.io and would love some feedback on it since you're the biggest user now 🙂 |
|
I'll have a look at it during the day 👍 |
Description:
Allow unloading deCONZ config entries and all its' entities
Checklist:
tox. Your PR cannot be merged unless tests passIf the code does not interact with devices: