There are allready included (at least some of them). Just make sure they are connected to the same network. They should show up as media_players. To force discovery add this to your configuration.yaml
:
media_player:
- platform: cast
There are allready included (at least some of them). Just make sure they are connected to the same network. They should show up as media_players. To force discovery add this to your configuration.yaml
:
media_player:
- platform: cast
I cannot find the error in this automation.
There is a slight error somewhere, but HA do not find any errors in the code.
- alias: "Media: Vad ska spelas i köket"
trigger:
platform: state
entity_id: input_select.chromecast_audio_kitchen
action:
service: media_player.play_media
data_template:
media_content_id: >
{% if is_state("input_select.chromecast_audio_kitchen", "Sveriges Radio P1") %}
http://sverigesradio.se/topsy/direkt/132-hi.mp3
{% elif is_state("input_select.chromecast_audio_kitchen", "Sveriges Radio P2") %}
http://sverigesradio.se/topsy/direkt/2562-hi-mp3
{% elif is_state("input_select.chromecast_audio_kitchen", "Sveriges Radio P3") %}
http://sverigesradio.se/topsy/direkt/164-hi-mp3
{% elif is_state("input_select.chromecast_audio_kitchen", "Sveriges Radio P4 Stockholm") %}
http://sverigesradio.se/topsy/direkt/701-hi.mp3
{% elif is_state("input_select.chromecast_audio_kitchen", "Sveriges Radio P4 PLUS") %}
http://sverigesradio.se/topsy/direkt/4951-hi.mp3
{% elif is_state("input_select.chromecast_audio_kitchen", "Sveriges Radio Ekot direkt") %}
http://sverigesradio.se/topsy/direkt/4540-hi-mp3
{% endif %}
media_content_type: 'audio/mp4'
Here’s the corresponding input selector
chromecast_audio_kitchen:
name: Vad ska spelas i köket
options:
- Tyst
- Sveriges Radio P1
- Sveriges Radio P2
- Sveriges Radio P3
- Sveriges Radio P4 Stockholm
- Sveriges Radio P4 PLUS
- Sveriges Radio Ekot direkt
initial: Tyst
icon: mdi:radio
When I change the input selector, nothing is streaming to my chromecast.
The device is working since I can cast to it from my phone.
Thanks for the list of Swedish radio stations. We live in the US and my Swedish wife will appreciate them!
Happy to hear that @johnnyletrois.
More channels can be found here (in swedish, but she will understand):
Back to my problem, I did not specify the entity_id of the input_select. My bad.
You did not specify the entity_id of the player:
service: media_player.play_media
data_template:
entity_id: media_player.XXX
media_content_id: >
Great idea! I’ve implemented something similar for my multi-room audio setup. The way to do it without a bunch of if-else conditions is as follows:
service: media_player.play_media
data_template:
entity_id: media_player.casatunes
media_content_id: "{{ {
'Illinois Street Lounge' : 'http://ice1.somafm.com/secretagent-128-mp3',
'Secret Agent' : 'http://ice1.somafm.com/secretagent-128-mp3',
'Groove Salad' : 'http://ice1.somafm.com/groovesalad-256-mp3',
'Sonic Universe' : 'http://ice1.somafm.com/sonicuniverse-192-mp3',
'Left Coast 70s' : 'http://ice1.somafm.com/seventies-320-mp3',
'Underground 80s' : 'http://ice1.somafm.com/u80s-256-mp3',
'Beat Blender': 'http://ice1.somafm.com/beatblender-128-mp3',
'DEF CON Radio' : 'http://ice1.somafm.com/defcon-256-mp3'
}[states('input_select.radio_station')] }}"
media_content_type: "audio/mp4"
I haven’t listened to this station for years, thank you for reminding me of it, I’ll add it to my playlist too
I did something similar but a little different as I didn’t like that you can neither set title nor image via the HA Google Cast component.
Will you share the code for this? I really am interested and i like it…
This looks great, would you mind sharing the code?
Hi. I found this web site with thousands url links to radio stations cataloged per country. Enjoy
http://www.hendrikjansen.nl/henk/streaming.html#za
Has anybody used this successfully? media_player.media_seek to seek through an mp3? Ideally I would have an input_number as a slider. I wasn’t able to seek successfully.
- service: media_player.media_seek
data:
entity_id: media_player.office_speaker
seek_position: 50
Me three please!!! And what do the buttons do exactly?
@lkhdas I’m also interested in how you’ve got the media title, image, volume level, and controls all in one interface. Can you please share what you’re using to do this?
EDIT: I think I’ve found it. I assume this is it? Custom UI: Mini media player
Yes that’s it
cast = pychromecast.Chromecast(HOST, timeout=5, tries=2) cast.wait(timeout=5) media_controller = cast.media_controller media_controller.play_media(MEDIA, 'audio/mp3', title=TITLE, thumb=IMAGE, stream_type='LIVE') media_controller.block_until_active(timeout=5)
This is the code to have media title and image for Chromecast
Thanks for sharing. Sorry for what may be a silly question but…where does this code go? Any additional details you can provide would be much appreciated.
I use it in appdaemon but it’d probably be easier to use it as python_script. Either way you will need to adjust it to your scenario.
Bob, although this feature is very popular me personally your script gave me lot of headache and it still does. Latest problem : Platform cast not ready yet. Retrying in 30 seconds and the music indeed start in 30 seconds
I am close to quitting this even if i invested a lot of time and money
I’m just wondering, on my version the script doesn’t appear the the same “block” as the other radio controls. It still works just sends my ocd into a spin…?
check your group setup