Last active
December 18, 2022 17:23
-
-
Save Mearman/48f0afd0e5dbb1a39fcfafb3ecdb0b3c to your computer and use it in GitHub Desktop.
Home Assistant Media Player Script Blueprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: Radio Player | |
| description: >- | |
| A script that sends an actionable notification with a confirmation before | |
| running the specified action. | |
| domain: script | |
| source_url: https://gist.githubusercontent.com/Mearman/48f0afd0e5dbb1a39fcfafb3ecdb0b3c/raw/radio_script_blueprint.yaml | |
| input: | |
| output_targets: | |
| default: [] | |
| name: Output Media Player Targets | |
| description: >- | |
| The targets to play the media on. | |
| selector: | |
| target: | |
| entity: | |
| domain: media_player | |
| volume_level: | |
| name: Volume Level | |
| description: >- | |
| The volume level to set the media player to. | |
| default: 0.4 | |
| selector: | |
| number: | |
| min: 0 | |
| max: 1 | |
| step: 0.1 | |
| mode: slider | |
| media_content_id: | |
| name: Media Content ID | |
| description: >- | |
| The ID of the media to play. This can be a URL, a local file path, or a | |
| media source ID. | |
| default: "http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_med/ak/bbc_6music.m3u8" | |
| media_content_type: | |
| name: Media Content Type | |
| description: >- | |
| The type of media to play. This can be a MIME type, such as | |
| `audio/mpeg`, or a media source type, such as `app`. | |
| default: "audio/mpeg" | |
| mode: restart | |
| sequence: | |
| - alias: "Set Volume" | |
| service: media_player.volume_set | |
| target: !input output_targets | |
| data: | |
| volume_level: 0 | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 1 | |
| milliseconds: 0 | |
| - alias: "Set Volume" | |
| service: media_player.volume_set | |
| target: !input output_targets | |
| data: | |
| volume_level: !input volume_level | |
| - delay: | |
| hours: 0 | |
| minutes: 0 | |
| seconds: 1 | |
| milliseconds: 0 | |
| - alias: "Play Radio" | |
| service: media_player.play_media | |
| target: !input output_targets | |
| data: | |
| media_content_id: !input media_content_id | |
| media_content_type: !input media_content_type | |
| enqueue: play |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment