@koles142 wrote:
Hi, I would like use script with chromecast radio. I’m trying work with this script:
group: radio: name: Radio entities: - input_select.radio_station - input_select.chromecast_radio - script.radio - input_number.volume_radio input_select: radio_station: name: 'Wybierz stację:' options: - RMF FM - Radio ZET - Radio Złote Przeboje - Radio Wrocław initial: RMF FM icon: mdi:radio chromecast_radio: name: 'Wybierz głośnik:' options: - Kuchnia - Sypialnia - Salon initial: Kuchnia icon: mdi:speaker-wireless input_number: volume_radio: name: Głośność icon: mdi:volume-high min: 0 max: 30 step: 1 initial: 7 automation: - alias: Włącz radio hide_entity: True trigger: - platform: state entity_id: input_select.radio_station action: - service: script.radio - alias: Głośność trigger: platform: state entity_id: input_number.volume_radio action: service: media_player.volume_set data_template: entity_id: > {% if is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.lounge_speakers {% elif is_state("input_select.chromecast_radio", "Sypialnia") %} media_player.bedroom {% elif is_state("input_select.chromecast_radio", "Salon") %} media_player.house {% endif %} volume_level: '{{ states.input_number.volume_radio.state }}' script: radio: alias: Włącz radio sequence: - service: media_player.volume_set data_template: entity_id: > {% if is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.lounge_speakers {% elif is_state("input_select.chromecast_radio", "Sypialnia") %} media_player.bedroom {% elif is_state("input_select.chromecast_radio", "Salon") %} media_player.house {% endif %} volume_level: '{{states.input_number.volume_radio.state}}' - service: media_player.play_media data_template: entity_id: > {% if is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.lounge_speakers {% elif is_state("input_select.chromecast_radio", "Sypialnia") %} media_player.bedroom {% elif is_state("input_select.chromecast_radio", "Salon") %} media_player.house {% endif %} media_content_id: > {% if is_state("input_select.radio_station", "RMF FM") %} http://195.150.20.242:8000/rmf_fm {% elif is_state("input_select.radio_station", "Radio ZET") %} http://antgre-01.cdn.eurozet.pl:8000/;stream {% elif is_state("input_select.radio_station", "Radio Złote Przeboje") %} http://mainstream.radioagora.pl/zloteprzeboje.mp3 {% elif is_state("input_select.radio_station", "Radio Wrocław") %} http://stream4.nadaje.com:9240/prw {% endif %} radio_off: alias: Wyłącz radio sequence: - service: media_player.turn_off data_template: entity_id: > {% if is_state("input_select.chromecast_radio", "Kuchnia") %} media_player.lounge_speakers {% elif is_state("input_select.chromecast_radio", "Sypialnia") %} media_player.bedroom {% elif is_state("input_select.chromecast_radio", "Salon") %} media_player.house {% endif %}
After run the script I have error in log:
Error executing script script.radio. Invalid data for call_service at pos 1: value must be at most 1 for dictionary value @ data['volume_level']
Have you any idea, where problem is?
Thank you.
Posts: 3
Participants: 2