The new functionality “native type support for templates” has broken a script. I can not find a solution and aks for assistance.
With option “legacy_template” set to true, the script works perfect!
This is my script - it has one parameter “snapshot_url”:
sequence:
- service: notify.file_service
data:
message: |
{% set file_rec = {
'timestamp': now().strftime("%Y-%m-%d %H:%M:%S")|string,
'pic_url': snapshot_url} %}
{{ file_rec | to_json }}
The script produces following error message:
Logger: homeassistant.components.script.write_filesensor
Source: helpers/script.py:1122
Integration: Skript ([documentation](https://www.home-assistant.io/integrations/script), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+script%22))
First occurred: 15:00:47 (1 occurrences)
Last logged: 15:00:47
Write Filesensor: Error executing script. Invalid data for call_service at pos 1: template value should be a string for dictionary value @ data['message']
Logger: homeassistant
Source: core.py:1405
First occurred: 15:00:47 (1 occurrences)
Last logged: 15:00:47
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
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 710, in async_run
await super().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 1405, 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['message']
Has anbody a hint for me?