#How to define variables with the GUI block?
1 messages · Page 1 of 1 (latest)
Curious why it is giving me curly brackets then
It's an empty dict
Represented in JSON syntax
Remove that and follow the examples in the docs to populate it with whatever you want
Ah, so it doesn't crash I suppose
However, am getting an error when creating the automation like this following the example. Am I missing something?
You're missing the {{ }} in your variable definition
And you need to quote it
See how you used the template properly below
Oh right. And also quotes, like so?
Please share text rather than images
variables:
new_volume: "{{ state_attr('media_player.chromecastultra1943', 'volume_level')) }}"
action: media_player.volume_set
metadata: {}
data:
volume_level: "{{ new_volume }}"
target:
device_id: 62676f98a5d747221ed9faf9fb48d8f7
Yes
Message malformed: invalid template (TemplateSyntaxError: unexpected ')') for dictionary value @ data['actions'][0]['choose'][1]['sequence'][1]['sequence'][0]['variables']['new_volume']
Bonus paranthesis
You gave an extra )
Gosh darn it's late. Thanks for the help by the way!
I'm finishing it up right now, trying to add multiple variables
variables:
curr_volume: " {{ state_attr('media_player.chromecastultra1943', 'volume_level') }}"
increment: 0.05
action: media_player.volume_set
metadata: {}
data:
volume_level: "{{ curr_volume }} + {{ increment }}"
target:
device_id: 62676f98a5d747221ed9faf9fb48d8f7