mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Remove unnecessary async_setup method for Guardian (#52597)
This commit is contained in:
parent
5c07fb51a2
commit
2f1af9a254
@ -32,25 +32,20 @@ from .const import (
|
|||||||
)
|
)
|
||||||
from .util import GuardianDataUpdateCoordinator
|
from .util import GuardianDataUpdateCoordinator
|
||||||
|
|
||||||
DATA_LAST_SENSOR_PAIR_DUMP = "last_sensor_pair_dump"
|
|
||||||
|
|
||||||
PLATFORMS = ["binary_sensor", "sensor", "switch"]
|
PLATFORMS = ["binary_sensor", "sensor", "switch"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
|
||||||
"""Set up the Elexa Guardian component."""
|
|
||||||
hass.data[DOMAIN] = {
|
|
||||||
DATA_CLIENT: {},
|
|
||||||
DATA_COORDINATOR: {},
|
|
||||||
DATA_LAST_SENSOR_PAIR_DUMP: {},
|
|
||||||
DATA_PAIRED_SENSOR_MANAGER: {},
|
|
||||||
DATA_UNSUB_DISPATCHER_CONNECT: {},
|
|
||||||
}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Elexa Guardian from a config entry."""
|
"""Set up Elexa Guardian from a config entry."""
|
||||||
|
hass.data.setdefault(
|
||||||
|
DOMAIN,
|
||||||
|
{
|
||||||
|
DATA_CLIENT: {},
|
||||||
|
DATA_COORDINATOR: {},
|
||||||
|
DATA_PAIRED_SENSOR_MANAGER: {},
|
||||||
|
DATA_UNSUB_DISPATCHER_CONNECT: {},
|
||||||
|
},
|
||||||
|
)
|
||||||
client = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id] = Client(
|
client = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id] = Client(
|
||||||
entry.data[CONF_IP_ADDRESS], port=entry.data[CONF_PORT]
|
entry.data[CONF_IP_ADDRESS], port=entry.data[CONF_PORT]
|
||||||
)
|
)
|
||||||
@ -116,7 +111,6 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
if unload_ok:
|
if unload_ok:
|
||||||
hass.data[DOMAIN][DATA_CLIENT].pop(entry.entry_id)
|
hass.data[DOMAIN][DATA_CLIENT].pop(entry.entry_id)
|
||||||
hass.data[DOMAIN][DATA_COORDINATOR].pop(entry.entry_id)
|
hass.data[DOMAIN][DATA_COORDINATOR].pop(entry.entry_id)
|
||||||
hass.data[DOMAIN][DATA_LAST_SENSOR_PAIR_DUMP].pop(entry.entry_id)
|
|
||||||
for unsub in hass.data[DOMAIN][DATA_UNSUB_DISPATCHER_CONNECT][entry.entry_id]:
|
for unsub in hass.data[DOMAIN][DATA_UNSUB_DISPATCHER_CONNECT][entry.entry_id]:
|
||||||
unsub()
|
unsub()
|
||||||
hass.data[DOMAIN][DATA_UNSUB_DISPATCHER_CONNECT].pop(entry.entry_id)
|
hass.data[DOMAIN][DATA_UNSUB_DISPATCHER_CONNECT].pop(entry.entry_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user