@brendanheyu glad you like it.
Great idea!
I think it’s not possible in the play_media part but I guess it can work as script entity picture. Will try right away
@brendanheyu glad you like it.
Great idea!
I think it’s not possible in the play_media part but I guess it can work as script entity picture. Will try right away
^^^^^^
And that is why this community rocks!
After rethinking this it’s a little more complicated than I thought. The script icon is configured in the customize section. I’m not sure if templating is possible there (which is neccessary, right?)
well, I was thinking you could somehow set the entity values…
My wife is playing Depeeche Mode in the kitchen via google music:
friendly_name: Kitchen Chromecast
volume_level: 0.8500000238418579
app_name: Google Play Music
media_content_type: music
media_artist: Depeche Mode
media_position: 0.43924600000002173
media_content_id: https://mclients.googleapis.com/music/mplay?mjck=Tfa2hobjzaoa6gzpleunkxo7ktu&pt=a&dv=1&slt=1489830526869&sig=O39tqQ9NPrQ-LiPSPGfU24E7QTk_
media_title: Blue Dress (Remastered)
media_position_updated_at: 2017-03-18T09:48:47.101252+00:00
is_volume_muted: false
app_id: 2872939A
supported_features: 21437
entity_picture: /api/media_player_proxy/media_player.kitchen_chromecast?token=c26f183b4abb458bdaff364ff4aa67f374cdca711b965bb33285dabb7378482c&cache=4ecb4
media_album_artist: Depeche Mode
media_duration: 338
I figured seeing we were already changing the media_content_id that we could somehow use the same trick?
I tried this:
customize:
script.radio538:
friendly_name: Start Playing
icon_template: >
{% if is_state("input_select.radio_station", "Radio 538") %} /local/radio538.png
{% elif is_state("input_select.radio_station", "Q-Music") %} /local/qmusic.jpg
{% else %} mdi:play
{% endif %}
No luck unfortunately, also no errors in my log file. Will try some more.
EDIT: We are basicaly trying the same thing, except you’re trying to change the device picture and I’m trying to change the script icon. I think configuration should be similair (in the customize section).
@brendanheyu I’m not sure if it’s even possible and I could not find a related topic for this challenge so I created a new topic:
https://community.home-assistant.io/t/templating-icons-in-customize-section/13993?u=bob_nl
Thanks mate, fingers crossed…
Whats the easiest way to add a Stop
button? I tried adapting the pauze
script above and switched media_player.media_pauze
for media_player.media_stop
(and media_player.stop_media
) but it won’t work?
radio539:
alias: Stop radio
sequence:
- service: media_player.stop_media
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Kitchen") %} media_player.kitchen
{% elif is_state("input_select.chromecast_radio", "Livingroom") %} media_player.livingroom
{% elif is_state("input_select.chromecast_radio", "Group") %} media_player.group
{% endif %}
media_player.media_stop
should work.
You can allways turn off your player, this definitely works:
media_player.turn_off
Finally got time to implement this and it works great. Right now I am just using the stations you provided but I hope to get some more of my own in there.
For anyone looking, this is a great source: https://www.internet-radio.com/
Thanks, @Bob_NL for a wonderful addition! I need to go out now and get a few more CC audios!
I’ve tried adding a couple of stations from internet-radio.com but can’t get any of them to play. My guess is that they may be of a different media_content_type.
So I have two questions:
How do you determine the media content type from the URL? The stations don’t seem to indicate the type:
http://us1.internet-radio.com:8105/
http://us3.internet-radio.com:8007/
If you have different media content types, do you have to create separate scripts for them or can you mix different types by simply blocking the types together in the script? How would you do this?
EDIT: OK, I have found out what types these are at least from just putting the URL in a browser:
http://us1.internet-radio.com:8105/ - audio/mpeg
http://us3.internet-radio.com:8007/ - appears to be MP3
@rpitera This works:
http://us3.internet-radio.com:8007/listen.mp3
And here is your Classic Rock Florida link:
http://listen.shoutcast.com/Classic-RockFlorida
Nice stations btw, I added them to my radio (Y)
Small update: volume slider settings now also effect the start of the stream instead of pre-defined volume settings.
Also I added some streams.
script:
radio538:
alias: Play Radio on Chromecast Audio
sequence:
- service: media_player.volume_set
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Livingroom") %} media_player.ca_livingroom
{% elif is_state("input_select.chromecast_radio", "Hall") %} media_player.ca_hall
{% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bed_room
{% elif is_state("input_select.chromecast_radio", "Bathroom") %} media_player.ca_bathroom
{% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.home_group
{% endif %}
volume_level: '{{ states.input_slider.volume_radio.state }}'
- service: media_player.play_media
data_template:
entity_id: >
{% if is_state("input_select.chromecast_radio", "Livingroom") %} media_player.ca_livingroom
{% elif is_state("input_select.chromecast_radio", "Hall") %} media_player.ca_hall
{% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bed_room
{% elif is_state("input_select.chromecast_radio", "Bathroom") %} media_player.ca_bathroom
{% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.home_group
{% endif %}
media_content_id: >
{% if is_state("input_select.radio_station", "Radio 538") %} http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3
{% elif is_state("input_select.radio_station", "Q-Music") %} http://icecast-qmusic.cdp.triple-it.nl/Qmusic_nl_live_96.mp3
{% elif is_state("input_select.radio_station", "3FM") %} http://icecast.omroep.nl/3fm-bb-mp3
{% elif is_state("input_select.radio_station", "100% NL") %} http://stream.100p.nl/100pctnl.mp3
{% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
{% elif is_state("input_select.radio_station", "Sky Radio") %} http://8623.live.streamtheworld.com:80/SKYRADIOAAC_SC
{% elif is_state("input_select.radio_station", "Arrow Classic Rock") %} http://91.221.151.155/listen.mp3
{% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
{% elif is_state("input_select.radio_station", "BNR Nieuwsradio") %} http://icecast-bnr.cdp.triple-it.nl/bnr_mp3_96_03
{% elif is_state("input_select.radio_station", "Smooth Jazz Tampa") %} http://us3.internet-radio.com:8007/listen.mp3
{% elif is_state("input_select.radio_station", "Classic Rock Florida") %} http://listen.shoutcast.com/Classic-RockFlorida
{% elif is_state("input_select.radio_station", "Bob Sinclar Radio") %} http://listen.shoutcast.com/prysmradio09-mp3
{% elif is_state("input_select.radio_station", "Chill Out Zone") %} http://air.chillout.zone:8000/radio
{% elif is_state("input_select.radio_station", "SLAM! Hardstyle") %} http://stream.radiocorp.nl/web11_mp3
{% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
{% elif is_state("input_select.radio_station", "Ambient Sleeping Pill") %} http://perseus.shoutca.st:8447/h
{% elif is_state("input_select.radio_station", "Radio Art - Sleep") %} http://live.radioart.com/fSleep.mp3
{% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
{% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
{% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
{% endif %}
media_content_type: 'audio/mp4'
Jep, scripname is still “radio538” because I started this project with only one radio station
P.S. All the sleepy stations are part of my “Wakeup alarm with radio and Lullaby on bedtime” project.
How do you create a Group with a Chromecast (not audio)?
You can’t add the old Chromecasts to a group. You can select multiple speakers as players like this:
entity_id: media_player.home_group, media_player.bed_room
Chances are they will be out of sync though.
So you use all chromecast audio for your Everywhere?
I use 3 Chromecast Audio’s, 2 regular Chromecasts and today I received my Google Home .
The Chromecast Audio’s and the Google Home are paired to a group. The regular Chromecasts I can use seperate if I like. I use the a regular Chromecast in my bedroom to play radio as part of my wakeup light with radio and lullaby as an example. The other Chromecast I only use for video.
I have an old HDMI CC v1 in my bedroom and I am getting another Logitech Hub this week for that room. I’m hoping to integrate it in some script to turn on the AVR and switch to the proper input when I select it in your radio (which I love and use a lot!). I may need a little guidance.
@rpitera Nice, should be fairly easy to setup. I don’t have a Harmony Hub myself. Let me know if you need any asisstance, I can always try .
Thanks - I think I can figure out the scripting of the remote but I’m unsure of where to put the call to the script in your existing script so I may ask you about that once I get it set up.
Too bad that Groupon doesn’t ship outside US or I would suggest it; I got my first hub/remote from them as a refurb three years ago and it works like a champ. I’m actually buying the second refurb from them as well.
Logitech does a great job on refurbs and you may want to see if that avenue is available in your area.