tom_l
August 22, 2023, 12:54pm
2
That should have been fixed. The automations should now report as unavailable if they depend on missing devices. However that change may have made things worse:
opened 08:41AM - 15 Aug 23 UTC
closed 02:17AM - 25 Jan 24 UTC
integration: automation
stale
### The problem
[PR 94856 ](https://github.com/home-assistant/core/pull/94856… )was introduced to prevent automations that use devices from disappearing when those devices were unavailable and to mark the automations as unavailable instead.
However numerous users [are reporting](https://community.home-assistant.io/t/automations-wont-start-on-home-assistant-restart/601814?u=tom_l) (forum link) that if they have an automation with a missing device that home assistant fails to load correctly and reports the following error message:
```
2023-08-11 14:31:10.255 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: automation
2023-08-11 14:31:10.257 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: automation')
```
### What version of Home Assistant Core has the issue?
core-2023.8.2
### What was the last working version of Home Assistant Core?
core -2023.7.
### What type of installation are you running?
Home Assistant OS
### Integration causing the issue
Automation
### Link to integration documentation on our website
https://www.home-assistant.io/docs/automation/
### Diagnostics information
_No response_
### Example YAML snippet
```yaml
- id: '1691345676498'
alias: Princess Window R Open/Close
description: ''
trigger:
- platform: time
at: '21:00:00'
condition:
- type: is_open
condition: device
device_id: a84a65093ec671a93f09e00a34769ce9
entity_id: 702f5fe57949392deaaef8d89966e2f4
domain: binary_sensor
action:
- type: turn_on
device_id: 287d6dfad0dc0c36c5b8fd09238e5742
entity_id: light.king_bulb_ceiling
domain: light
brightness_pct: 90
alias: Turn on King Bulb
- service: notify.alexa_media_sphere
data:
data:
type: tts
message: Princess right window is open
mode: single
```
### Anything in the logs that might be useful for us?
```txt
2023-08-11 14:31:10.235 ERROR (MainThread) [homeassistant.setup] Error during setup of component automation
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 259, in async_setup
await _async_process_config(hass, config, component)
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 976, in _async_process_config
entities = await _create_automation_entities(hass, updated_automation_configs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 860, in _create_automation_entities
cond_func = await _async_process_if(hass, name, config_block)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 989, in _async_process_if
checks.append(await condition.async_from_config(hass, if_config))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 246, in async_from_config
return cast(ConditionCheckerType, await factory(hass, config))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/device_automation/condition.py", line 55, in async_condition_from_config
return trace_condition_function(platform.async_condition_from_config(hass, config))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/binary_sensor/device_condition.py", line 317, in async_condition_from_config
state_config = condition.state_validate_config(hass, state_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 1022, in state_validate_config
config[CONF_ENTITY_ID] = er.async_validate_entity_ids(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1395, in async_validate_entity_ids
return [async_validate_entity_id(registry, item) for item in entity_ids_or_uuids]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1395, in <listcomp>
return [async_validate_entity_id(registry, item) for item in entity_ids_or_uuids]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1364, in async_validate_entity_id
raise vol.Invalid(f"Unknown entity registry entry {entity_id_or_uuid}")
voluptuous.error.Invalid: Unknown entity registry entry 702f5fe57949392deaaef8d89966e2f4
2023-08-11 14:31:10.255 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: automation
2023-08-11 14:31:10.257 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: automation')
```
### Additional information
device_id: a84a65093ec671a93f09e00a34769ce9 used in the above automation was unavailable.
1 Like