MyCool
(mike)
August 8, 2021, 4:25am
1
Hi I’m stuck not sure if this can be done with local media in a input select
Basically I have some binary sensors around the house that trigger automations that play a local stored .mp3 file for example my driveway CCTVs line crossing that activates the automation and plays a local stored mp3 file, atm I have to manually change the selected mp3 in my automation.yaml file it’s such a pain. Basically I’m trying to create a input select so I can change the mp3 that is played via a drop-down box but unsure the best way to go about it below is closest I could get. Any help please would be much appreciated
music_list:
name: Music List
options:
- audiotest1
- audiotest2
- default
initial: default
icon: mdi:music-note
- service: media_player.play_media
data_template:
entity_id: media_player.living_room
media_content_type: 'music'
media_content_id: >
{% if is_state("input_select.music_list", "default") %}
http://192.168.1.100:8123/local/default.mp3
{%-elif is_state("input_select.musuc_list", "beach") %}
http://192.168.1.100:8123/local/beach.mp3
{% else %}
http://192.168.1.100:8123/local/beach.mp3
{% endif %}
MyCool
(mike)
August 8, 2021, 4:31am
2
Ok bellow works
But I would like to be able to send to multiple media devices instead of needing two separate automations
Both google speakers
mp3_driveway_alarm_list:
name: Driveway Alarm MP3
options:
- PulpFictionRemix
- Yoda-BLR-Hmm-Ha
- MessageAlert
- Carlpoppa2
initial: Carlpoppa2
icon: mdi:music-note
################################# USE To Add More into list ########################
# {%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
# http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
####################################################################################
- alias: Driveway Linecrossing MP3 G1
trigger:
platform: state
entity_id: binary_sensor.driveway_line_crossing
to: 'on'
action:
- service: media_player.volume_set
data_template:
entity_id:
- media_player.family_room_speaker
volume_level: 1
- service: media_player.play_media
data_template:
entity_id: media_player.family_room_speaker
media_content_type: 'music'
media_content_id: >
{% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
http://192.168.1.100:8123/local/MessageAlert.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% else %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% endif %}
################################# USE To Add More into list ########################
# {%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
# http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
####################################################################################
- alias: Driveway Linecrossing MP3 G2
trigger:
platform: state
entity_id: binary_sensor.driveway_line_crossing
to: 'on'
action:
- service: media_player.volume_set
data_template:
entity_id:
- media_player.bedroom_speaker
volume_level: 1
- service: media_player.play_media
data_template:
entity_id: media_player.bedroom_speaker
media_content_type: 'music'
media_content_id: >
{% if is_state("input_select.mp3_driveway_alarm_list", "Yoda-BLR-Hmm-Ha") %}
http://192.168.1.100:8123/local/Yoda-BLR-Hmm-Ha.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "MessageAlert") %}
http://192.168.1.100:8123/local/MessageAlert.mp3
{%-elif is_state("input_select.mp3_driveway_alarm_list", "carlpoppa2") %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% else %}
http://192.168.1.100:8123/local/carlpoppa2.mp3
{% endif %}
################################# USE To Add More into list ########################
# {%-elif is_state("input_select.mp3_driveway_alarm_list", "PulpFictionRemix") %}
# http://192.168.1.100:8123/local/PulpFictionRemix_1.mp3
####################################################################################
MyCool
(mike)
August 8, 2021, 7:27am
3
Yay fixed my own issue using groups can’t believe how easy it was all the time I wasted best part speakers now play in sink.
If anyone has away I could Do all this better please let me know as I’m still a noob lol
Cards Driveway Alert