I am getting this error in an automation.
2020-09-27 22:17:01 ERROR (MainThread) [homeassistant.components.automation.lights_off_failsafe] Lights Off Failsafe: Repeat at step 2: Error executing script. Invalid data for call_service at pos 2: not a valid value for dictionary value @ data['entity_id']
2020-09-27 22:17:01 ERROR (MainThread) [homeassistant.components.automation.lights_off_failsafe] Lights Off Failsafe: Error executing script. Invalid data for repeat at pos 2: not a valid value for dictionary value @ data['entity_id']
2020-09-27 22:17:01 ERROR (MainThread) [homeassistant.components.automation.lights_off_failsafe] While executing automation automation.lights_off_failsafe
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 426, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 944, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 198, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 206, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 512, in _async_repeat_step
await async_run_sequence(iteration, extra_msg)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 494, in async_run_sequence
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 626, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 375, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 944, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 198, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 206, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 413, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1269, in async_call
processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 208, in __call__
return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 287, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 283, in _exec
v = func(v)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
return schema(data)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: not a valid value for dictionary value @ data['entity_id']
The automation is a failsafe for turning some milights on and off. Sometimes, turning them on or off doesn’t work the first time… a quirk of the radio in those lights I think. So I wrote an automation to repeat the on/off command triggered by the state of the lights changing. However I have 4 groups so I test for last_triggered to determine which lights to hit again with the command.
The template seems good in the ediitor.
The above error last night was from turning the lounge and desk lights off.
Anyway, here is the off automation:
- id: '1532478833426'
alias: Lights Off Failsafe
trigger:
- platform: state
from: 'on'
to: 'off'
entity_id: light.lounge, light.dining, light.desk, light.office
condition: []
mode: restart
action:
- service: automation.turn_off
entity_id: automation.lights_on_failsafe
- repeat:
count: '2'
sequence:
- delay: '00:00:02'
- service: light.turn_off
data:
entity_id: >
{%- if (as_timestamp(now()) - as_timestamp(states.light.lounge.last_changed)
< 10) -%} {%- set h0='light.lounge' -%} {%- else -%} {%- set h0='' -%} {%- endif -%}
{%- if (as_timestamp(now()) - as_timestamp(states.light.dining.last_changed)
< 10) -%} {%- set h1='light.dining' -%} {%- else -%} {%- set h1='' -%} {%- endif -%}
{%- if (as_timestamp(now()) - as_timestamp(states.light.desk.last_changed)
< 10) -%} {%- set h2='light.desk' -%} {%- else -%} {%- set h2='' -%} {%- endif -%}
{%- if (as_timestamp(now()) - as_timestamp(states.light.office.last_changed)
< 10) -%} {%- set h3='light.office' -%} {%- else -%} {%- set h3='' -%} {%- endif -%}
{{ ' '+ [h0, h1, h2, h3]|join(', ')|trim(', ') }}
- delay: '00:00:03'
- service: automation.turn_on
entity_id: automation.lights_on_failsafe
@petro if anyone can see my error it’s you…