mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Initialize Shelly runtime_data in async_setup_entry (#141315)
This commit is contained in:
parent
3775f15461
commit
05ead4d1f5
@ -111,6 +111,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ShellyConfigEntry) -> bool:
|
||||
"""Set up Shelly from a config entry."""
|
||||
entry.runtime_data = ShellyEntryData([])
|
||||
|
||||
# The custom component for Shelly devices uses shelly domain as well as core
|
||||
# integration. If the user removes the custom component but doesn't remove the
|
||||
# config entry, core integration will try to configure that config entry with an
|
||||
@ -162,7 +164,8 @@ async def _async_setup_block_entry(
|
||||
device_entry = None
|
||||
|
||||
sleep_period = entry.data.get(CONF_SLEEP_PERIOD)
|
||||
runtime_data = entry.runtime_data = ShellyEntryData(BLOCK_SLEEPING_PLATFORMS)
|
||||
runtime_data = entry.runtime_data
|
||||
runtime_data.platforms = BLOCK_SLEEPING_PLATFORMS
|
||||
|
||||
# Some old firmware have a wrong sleep period hardcoded value.
|
||||
# Following code block will force the right value for affected devices
|
||||
@ -273,7 +276,8 @@ async def _async_setup_rpc_entry(hass: HomeAssistant, entry: ShellyConfigEntry)
|
||||
device_entry = None
|
||||
|
||||
sleep_period = entry.data.get(CONF_SLEEP_PERIOD)
|
||||
runtime_data = entry.runtime_data = ShellyEntryData(RPC_SLEEPING_PLATFORMS)
|
||||
runtime_data = entry.runtime_data
|
||||
runtime_data.platforms = RPC_SLEEPING_PLATFORMS
|
||||
|
||||
if sleep_period == 0:
|
||||
# Not a sleeping device, finish setup
|
||||
|
Loading…
x
Reference in New Issue
Block a user