French Radio Media Player

I created a French Radio Media Player view that allows you to enjoy web radio using the Mini Media Player custom card.

So I just would like to share this with you ! Here is the github.

Enjoy.

Hi, i recive this error:

2020-04-26 13:05:13 WARNING (MainThread) [homeassistant.components.input_select] Invalid option:  (possible options: Radio Parsifal, Radio DeeJay, Radio Fantastica, Radio KissKiss)

Hi
If you add new radio or change some radio’s name, you have to add the values in the input_select and cards

Hey @bastienh
I just started trying to make your radio “card” work.
I get an error:

My media player is media_player.livingroom_sonos
Did I do it right?
Maybe it doesn’t work with the sonos?
I know it’s been a while, sorry to bug you. :wink:
This is my radio.yaml code. I have it set as a popup card.

action: fire-dom-event
browser_mod:
  command: popup
  title: RADIO
  style:
    .: |
      :host .content {
        width: 60em;
        height: 100%;
      }
  card:
    type: vertical-stack
    cards:
      - type: entities
        state_color: true
        card_mod:
          class: top-level-graph
        entities:
          - type: custom:mini-media-player
            entity: media_player.livingroom_sonos           
            icon: mdi:radio
            artwork: cover
            min_volume: 1
            max_volume: 60
            hide:
              power_state: false
              icon_state: false
              info: true
            shortcuts:
              columns: 2 # Max buttons per row
              hide_when_off: true
              buttons:
                - icon: mdi:volume-minus
                  type: service
                  id: script.down_vol_radio
                  data:
                    media: livingroom_sonos
                - icon: mdi:volume-plus
                  type: service
                  id: script.up_vol_radio
                  data:
                    media: livingroom_sonos
            
          - type: conditional
            conditions:
              - entity: media_player.livingroom_sonos 
                state_not: 'off'
            card:
                type: horizontal-stack
                cards:
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'RFM'
                    card:
                      type: picture
                      image: /local/images/radio/NRJ_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'RFM'
                    card:
                      type: picture
                      image: /local/images/radio/NRJ.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: RFM
                          media: livingroom_sonos
                          
                          
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Skyrock'
                    card:
                      type: picture
                      image: /local/images/radio/Fun_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Skyrock'
                    card:
                      type: picture
                      image: /local/images/radio/Fun.jpg?v=0.103
                      tap_action: 
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Skyrock
                          media: livingroom_sonos
                                  
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'BFM'
                    card:
                      type: picture
                      image: /local/images/radio/BFM_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'BFM'
                    card:
                      type: picture
                      image: /local/images/radio/BFM.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: BFM
                          media: livingroom_sonos
                               
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Virgin'
                    card:
                      type: picture
                      image: /local/images/radio/Skyrock_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Virgin'
                    card:
                      type: picture
                      image: /local/images/radio/Skyrock.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Virgin
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Nostalgie'
                    card:
                      type: picture
                      image: /local/images/radio/Nostalgie_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Nostalgie'
                    card:
                      type: picture
                      image: /local/images/radio/Nostalgie.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Nostalgie
                          media: livingroom_sonos
                          
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'RadioNova'
                    card:
                      type: picture
                      image: /local/images/radio/Hitsradio_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'RadioNova'
                    card:
                      type: picture
                      image: /local/images/radio/Hitsradio.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: RadioNova
                          media: livingroom_sonos

          - type: conditional
            conditions:
              - entity: media_player.livingroom_sonos 
                state_not: 'off'
            card:
                type: horizontal-stack
                cards:
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Mouv'
                    card:
                      type: picture
                      image: /local/images/radio/Scoop_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Mouv'
                    card:
                      type: picture
                      image: /local/images/radio/Scoop.jpg?v=0.103
                      tap_action: 
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Mouv
                          media: livingroom_sonos
                                    
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Europe1'
                    card:
                      type: picture
                      image: /local/images/radio/FG_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Europe1'
                    card:
                      type: picture
                      image: /local/images/radio/FG.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Europe1
                          media: livingroom_sonos
                          
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'JazzSoul'
                    card:
                      type: picture
                      image: /local/images/radio/FGchic_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'JazzSoul'
                    card:
                      type: picture
                      image: /local/images/radio/FGchic.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: JazzSoul
                          media: livingroom_sonos
                          
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Franceinter'
                    card:
                      type: picture
                      image: /local/images/radio/FGdeep_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Franceinter'
                    card:
                      type: picture
                      image: /local/images/radio/FGdeep.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Franceinter
                          media: livingroom_sonos
                          
                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'Franceinfo'
                    card:
                      type: picture
                      image: /local/images/radio/FGunder_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'Franceinfo'
                    card:
                      type: picture
                      image: /local/images/radio/FGunder.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: Franceinfo
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state: 'RTL'
                    card:
                      type: picture
                      image: /local/images/radio/MTI_selected.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.stop_radio
                        service_data:
                          media: livingroom_sonos

                  - type: conditional
                    conditions:
                      - entity: input_select.radio_station_livingroom_sonos
                        state_not: 'RTL'
                    card:
                      type: picture
                      image: /local/images/radio/MTI.jpg?v=0.103
                      tap_action:
                        action: call-service
                        service: script.start_radio
                        service_data:
                          radio: RTL
                          media: livingroom_sonos

I think this might be the problem.
Seems like conditionals don’t work in popup browser windows using browser-mod

Hi, yes I also think that it is the problem

Hello
It’s an old subjet but…

I try to use this package, but script seems have a problem
Can someone help to rewrite without error message and perhaps with succesful

The scripts

up_vol_radio:
  alias: Up volume on Media Player
  sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: >
          media_player.{{ media }}
        volume_level: >
          {% set next_vol = states['media_player.' + media].attributes.volume_level | float + 0.02 %}
            {{ next_vol }}
            
down_vol_radio:
  alias: Down volume on Media Player
  sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: >
          media_player.{{ media }}
        volume_level: >
          {% set next_vol = states['media_player.' + media].attributes.volume_level | float - 0.02 %}
            {{ next_vol }}
            
stop_radio:
  alias: Stop Radio on Media Player
  sequence:
    - service: media_player.media_stop
      data_template:
        entity_id: >
          media_player.{{ media }}
    - service: input_select.select_option
      data_template:
        entity_id: >
          input_select.radio_station_{{ media }}
        option: 'Aucune'
          
                
start_radio:
  alias: Play Radio on Media Player
  sequence:
    - service: input_select.select_option
      data_template:
        entity_id: >
          input_select.radio_station_{{ media }}
        option: '{{ radio }}'
    # - service: media_player.volume_set
      # data_template:
        # entity_id: >
          # media_player.{{ media }}
        # volume_level: '0.20'
    - service: media_player.play_media
      data_template:
        entity_id: >
          media_player.{{ media }}
        media_content_id: >
          {% if(radio == "Skyrock") %} http://icecast.skyrock.net/s/natio_mp3_128k
          {% elif(radio == "NRJ") %} http://cdn.nrjaudio.fm/audio1/fr/30001/mp3_128.mp3?origine=fluxradios
          {% elif(radio == "Fun") %} http://streaming.radio.funradio.fr/fun-1-44-128
          {% elif(radio == "Nostalgie") %} http://cdn.nrjaudio.fm/audio1/fr/30601/mp3_128.mp3?origine=fluxradios
          {% elif(radio == "BFM") %} http://chai5she.cdn.dvmr.fr/bfmbusiness
          {% elif(radio == "Virgin") %} http://ais-live.cloud-services.paris:8000/virgin.mp3
          {% elif(radio == "FG") %} http://radiofg.impek.com/fg
          {% elif(radio == "MTI") %} http://radiomti.ice.infomaniak.ch/radiomti.mp3
          {% elif(radio == "Scoop") %} http://radioscooplyon.ice.infomaniak.ch/radioscoop-lyon-128.mp3
          {% elif(radio == "FGunder") %} http://radiofg.impek.com/ufg
          {% elif(radio == "FGdeep") %} http://radiofg.impek.com/fgd
          {% elif(radio == "FGchic") %} http://radiofg.impek.com/fgc
          {% elif(radio == "Hitsradio") %} https://playerservices.streamtheworld.com/api/livestream-redirect/977_JAMZ.mp3
          {% endif %}
        media_content_type: 'audio/mp4' 
    - service: media_player.media_pause
      data_template:
        entity_id: >
          media_player.{{ media }}
    - delay: 
        milliseconds: 800
    - service: media_player.media_play
      data_template:
        entity_id: >
          media_player.{{ media }}
        

Message error
Actions: template value should be a string for dictionary value @ data[1][‹ data_template ›
Thank’s for the help

Hi. it would be necessary to be more precise on the location of the error

Hello
Thank’s for the help
I reinstall all the original French media player radio
I test with 2 radio
the problem i have now is when i want to start the radio

Logger: pychromecast.controllers
Source: components/cast/media_player.py:512
First occurred: 20:46:05 (3 occurrences)
Last logged: 20:47:01

PLAY command requested but no session is active.

When the google stop after few minutes i have this msg

Logger: homeassistant.components.script.stop_radio
Source: helpers/script.py:1792
Integration: Script (documentation, issues)
First occurred: 21:00:26 (1 occurrences)
Last logged: 21:00:26

Stop Radio on Media Player: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['option']

and this

Logger: homeassistant.helpers.template
Source: helpers/template.py:2318
First occurred: 21:00:26 (1 occurrences)
Last logged: 21:00:26

Template variable warning: 'radio' is undefined when rendering '{{ radio }}'