mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
restore_state: do not crash if domain not defined (#6714)
This commit is contained in:
parent
8325f9db8a
commit
de231cf9ab
@ -142,7 +142,12 @@ def async_reproduce_state(hass, states, blocking=False):
|
||||
else:
|
||||
service_domain = state.domain
|
||||
|
||||
domain_services = hass.services.async_services()[service_domain]
|
||||
domain_services = hass.services.async_services().get(service_domain)
|
||||
|
||||
if not domain_services:
|
||||
_LOGGER.warning(
|
||||
"reproduce_state: Unable to reproduce state %s (1)", state)
|
||||
continue
|
||||
|
||||
service = None
|
||||
for _service in domain_services.keys():
|
||||
@ -157,8 +162,8 @@ def async_reproduce_state(hass, states, blocking=False):
|
||||
break
|
||||
|
||||
if not service:
|
||||
_LOGGER.warning("reproduce_state: Unable to reproduce state %s",
|
||||
state)
|
||||
_LOGGER.warning(
|
||||
"reproduce_state: Unable to reproduce state %s (2)", state)
|
||||
continue
|
||||
|
||||
# We group service calls for entities by service call
|
||||
|
Loading…
x
Reference in New Issue
Block a user