Hi, I would like to run the following script in automation with a parameter pointing to the appropriate player entity:
alias: Radio volume fade-in
sequence:
- repeat:
sequence:
- service: media_player.volume_set
data:
entity_id: "{{ my_player }}"
volume_level: "{{ state_attr('my_player', 'volume_level') + 0.01 }}"
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 300
while:
- condition: numeric_state
entity_id: "{{ my_player }}" # <- this is wrong
attribute: volume_level
below: 0.2
mode: single
While I can set a variable “{{ my_player }}” in the “sequence” section, it causes the following error in the “while” section:
Message malformed: Entity {{ my_player }} is neither a valid entity ID nor a valid UUID for dictionary value @ data[‘sequence’][0][‘repeat’][‘while’][0][‘entity_id’]
How should I make it work?