Sorry if it’s a newbie question, none of this is my native language and I’ve been been googeling all day without luck.
How can I set a variable and use it for output as an attribute? For some reason, currentPrice won’t keep its value past the first print in this example:
#Template:
# sensor:
- name: "test"
state: >-
{% set currentPrice = 1234 %}
{{ currentPrice }}
attributes:
some_attribute: >-
{{ currentPrice }}
Last line doesn’t work - the output is just an empty string:
some_attribute: ''