mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Allow multiple config entries in Honeywell (#108263)
* Address popping all entires when unloading * optimize hass data
This commit is contained in:
parent
154fe8631a
commit
484584084a
@ -85,8 +85,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
data = HoneywellData(config_entry.entry_id, client, devices)
|
data = HoneywellData(config_entry.entry_id, client, devices)
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = data
|
||||||
hass.data[DOMAIN][config_entry.entry_id] = data
|
|
||||||
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(config_entry, PLATFORMS)
|
||||||
|
|
||||||
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
|
config_entry.async_on_unload(config_entry.add_update_listener(update_listener))
|
||||||
@ -105,7 +104,7 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||||||
config_entry, PLATFORMS
|
config_entry, PLATFORMS
|
||||||
)
|
)
|
||||||
if unload_ok:
|
if unload_ok:
|
||||||
hass.data.pop(DOMAIN)
|
hass.data[DOMAIN].pop(config_entry.entry_id)
|
||||||
return unload_ok
|
return unload_ok
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user