Lazy load zwave_js platforms when the first entity needs to be created (#49016)
* Lazy load zwave_js platforms when the first entity needs to be created * switch order to make things easier to understand * await task instead of using wait_for_done callback * gather tasks * switch from asyncio.create_task to hass.async_create_task * unsubscribe from callbacks before unloading platforms * Clean up as much as possible during entry unload, even if a platform unload fails
This commit is contained in:
parent
53853f035d
commit
cc40e681e2
2 changed files with 72 additions and 58 deletions
|
@ -8,20 +8,10 @@ CONF_NETWORK_KEY = "network_key"
|
|||
CONF_USB_PATH = "usb_path"
|
||||
CONF_USE_ADDON = "use_addon"
|
||||
DOMAIN = "zwave_js"
|
||||
PLATFORMS = [
|
||||
"binary_sensor",
|
||||
"climate",
|
||||
"cover",
|
||||
"fan",
|
||||
"light",
|
||||
"lock",
|
||||
"number",
|
||||
"sensor",
|
||||
"switch",
|
||||
]
|
||||
|
||||
DATA_CLIENT = "client"
|
||||
DATA_UNSUBSCRIBE = "unsubs"
|
||||
DATA_PLATFORM_SETUP = "platform_setup"
|
||||
|
||||
EVENT_DEVICE_ADDED_TO_REGISTRY = f"{DOMAIN}_device_added_to_registry"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue