I want to transform this automation:
- alias: Set Radio Volume
initial_state: true
trigger:
platform: state
entity_id: input_number.volume
action:
service: media_player.volume_set
data_template:
entity_id: '{% if is_state("input_select.radio_player", "Birou") %} media_player.bedroom_speaker
{% elif is_state("input_select.radio_player", "Dormitor") %} media_player.dormitor_4
{% elif is_state("input_select.radio_player", "Baie") %} media_player.wifi_icybox
{% elif is_state("input_select.radio_player", "Living") %} media_player.blu_ray_home_theatre_system
{% elif is_state("input_select.radio_player", "Peste tot") %} group.media
{% elif is_state("input_select.radio_player", "PC") %} media_player.squeezelite_3
{% endif %}
'
volume_level: '{{ states.input_number.volume.state }}'
from yaml in NR
I tried something simple
[{“id”:“233f0dcd.0c5962”,“type”:“inject”,“z”:“470a6334.f5c6fc”,“name”:“”,“props”:[{“p”:“payload”},{“p”:“topic”,“vt”:“str”}],“repeat”:“”,“crontab”:“”,“once”:false,“onceDelay”:0.1,“topic”:“”,“payload”:“”,“payloadType”:“date”,“x”:180,“y”:1540,“wires”:[[“391b3805.56b338”]]},{“id”:“391b3805.56b338”,“type”:“api-call-service”,“z”:“470a6334.f5c6fc”,“name”:“Vol. set”,“server”:“60dbe2c9.20830c”,“version”:1,“debugenabled”:true,“service_domain”:“media_player”,“service”:“volume_set”,“entityId”:“media_player.bedroom_speaker”,“data”:“{ "volume_level": ‘{{ states.input_number.volume.state }}’ }”,“dataType”:“json”,“mergecontext”:“”,“output_location”:“”,“output_location_type”:“none”,“mustacheAltTags”:false,“x”:460,“y”:1540,“wires”:[]},{“id”:“60dbe2c9.20830c”,“type”:“server”,“name”:“Home Assistant”,“legacy”:false,“addon”:true,“rejectUnauthorizedCerts”:true,“ha_boolean”:“y|yes|true|on|home|open”,“connectionDelay”:true,“cacheJson”:true}]
but I get an error: