Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # script for playing radio from URL in Home Assistant without delay
- # optionally 'title' and 'image' can be specified to display in the specified media player(s)
- alias: Radio Graj
- fields:
- entity_id:
- name: Media player entitity ID(s)
- required: true
- example: media_player.jbl_salon
- selector:
- entity:
- multiple: true
- domain: media_player
- url:
- name: Radio link
- description: Link of the radio
- required: true
- example: http://195.150.20.7/rmf_fm
- selector:
- text: null
- title:
- name: Media player title
- required: false
- example: Radio ZET
- selector:
- text: null
- image:
- name: Media player background image
- required: false
- example: /local/radio/logo_radio_zet.png
- selector:
- text: null
- force_play:
- name: Force to play immediately
- description: Required if playback for the specified URL is delayed for several seconds
- required: false
- selector:
- boolean: null
- sequence:
- - service: media_player.play_media
- data:
- media_content_id: "{{url}}"
- media_content_type: music
- extra:
- metadata:
- metadataType: 1
- title: "{{title}}"
- images:
- - url: "{{image}}"
- target:
- entity_id: "{{entity_id}}"
- - if:
- - condition: template
- value_template: "{{force_play is defined and force_play == true}}"
- then:
- - service: media_player.media_play
- target:
- entity_id: "{{entity_id}}"
- mode: single
- icon: mdi:radio
- #####################################################################################
- #usage in the Mini Media Player card
- shortcuts:
- buttons:
- - id: script.radio_graj
- name: RMF FM
- type: script
- data:
- title: RMF FM
- url: http://195.150.20.7/rmf_fm
- image: /local/radio/logo_rmf_fm.png
- force_play: true
- - id: script.radio_graj
- name: Radio ZET
- type: script
- data:
- title: Radio ZET
- url: http://zet-net-01.cdn.eurozet.pl:8400/
- image: /local/radio/logo_radio_zet.png
- #####################################################################################
- #usage as the service (image location /config/www/radio)
- service: script.radio_graj
- data:
- entity_id:
- - media_player.jbl_sypialnia
- - media_player.jbl_salon
- url: http://195.150.20.7/rmf_fm
- title: RMF FM
- image: /local/radio/logo_rmf_fm.png
- force_play: true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement