Closed brahmafear closed 3 years ago
Workaround: Changing format of above to this seems to work:
- service: variable.set_variable
data:
variable: rf_input
value_template: >-
# {% set payload = trigger.payload %}
# {% set json = payload|from_json %}
# {% set message = json.message %}
# {{ message.id }}, {{ message.unit }}, {{ message.state }}
{{ trigger.payload }}
attributes: >
{% set payload = trigger.payload %}
{% set json = payload|from_json %}
{% set message = json.message %}
{
"id": "{{message.id}}",
"unit": "{{message.unit}}",
"state": "{{message.state}}"
}
check this: https://github.com/rogro82/hass-variables/issues/47
it has been resolved, next to that, a fork of this repo has also been made, to update this seemingly abandoned repo.
Excellent. I scanned for existing issues before posting - no idea how I missed 47.
Interesting that the workaround of changing “attributes_template” to “attributes” works without the code changes Frenck lists in the other issue. Thanks.
Since native types for templates was enabled in HA 0.118, most of my automations involving service calls for hass-variables are throwing this error:
voluptuous.error.MultipleInvalid: template value should be a string for dictionary value @ data['attributes_template']
Here's an example of one of the autos that is causing the issue:
This all worked fine pre-0.118. Any ideas how to make the yaml multiline string be interpreted as a string?