OK, my first and only error in the log so far after updating to beta 117.0b1 caused by the new templating options for native types
please have a look with me how to solve this using the CC variable. I know its not core, but this shouldn’t have ti do with that.
error:
While executing automation automation.update_last_motion
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 1010, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 245, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1402, in async_call
processed_data = handler.schema(service_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: template value should be a string for dictionary value @ data['attributes_template']
and relevant part of the automation:
action:
- delay:
seconds: 2
- service: variable.set_variable
data:
variable: last_motion
attributes_template: >
{
"history_1":"{{states('variable.last_motion')}}",
"history_2":"{{state_attr('variable.last_motion','history_1')}}",
"history_3":"{{state_attr('variable.last_motion','history_2')}}",
"history_4":"{{state_attr('variable.last_motion','history_3')}}",
"history_5":"{{state_attr('variable.last_motion','history_4')}}",
"history_6":"{{state_attr('variable.last_motion','history_5')}}",
"history_7":"{{state_attr('variable.last_motion','history_6')}}",
"history_8":"{{state_attr('variable.last_motion','history_7')}}",
"history_9":"{{state_attr('variable.last_motion','history_8')}}",
"history_10":"{{state_attr('variable.last_motion','history_9')}}"
}
value: >
{{trigger.to_state.name|replace(' sensor motion','')}}:
{{as_timestamp(trigger.from_state.last_changed)|timestamp_custom('%X')}}