Webradio abspielen

Hallo,

wie im Titel schon geschrieben, möchte ich über einen (später evtl. mehrere) Chromecast-Lautsprecher abspielen.

Über eine Mediensteuerkarte kann ich meine Musik und auch über RadioBrowser Webradiostationen auswählen und abspielen.

Allerdings ist die Auswahl im Radio-Browser freundlich gesagt grauenhaft.
Optimal wäre es natürlich, auf einem Dashboard einfach mehrere Radiostationen als einzelne Buttons zu haben.
Gibt es dafür irgend eine Möglichkeit oder kann man die grauenhafte Auswahl im Radio Browser irgendwie verbessern oder zumindest irgendwie Favoriten anlegen?

Moin,

ich habe mir damals mit den Mushroom Chips Buttons gebaut:

Mushroom
grafik

type: custom:mushroom-chips-card
chips:
  - type: entity
    entity: input_button.radio_bbc_radio_1_dance
    content_info: name
    name: BBC 1 Dance
    tap_action:
      action: call-service
      service: input_button.press
      service_data: {}
      target:
        entity_id: input_button.radio_bbc_radio_1_dance
  - type: entity
    entity: input_button.radio_bob
    content_info: name
    name: BoB!
    tap_action:
      action: call-service
      service: input_button.press
      service_data: {}
      target:
        entity_id: input_button.radio_bob
  - type: entity
    entity: input_button.radio_hamburg
    content_info: name
    name: Hamburg
    tap_action:
      action: call-service
      service: input_button.press
      service_data: {}
      target:
        entity_id: input_button.radio_hamburg
  - type: entity
    entity: input_button.radio_ndr2
    content_info: name
    name: NDR2
    tap_action:
      action: call-service
      service: input_button.press
      service_data: {}
      target:
        entity_id: input_button.radio_ndr2
alignment: center

Und dann noch die Automatisierung:

alias: Radio > Wohnung
description: Spielt den Gewählten Sender auf der Lautsprecher gruppe Wohnung.
mode: single
triggers:
  - entity_id: input_button.radio_bbc_radio_1_dance
    id: bbc
    trigger: state
  - entity_id: input_button.radio_bob
    id: bob
    trigger: state
  - entity_id: input_button.radio_hamburg
    id: hamburg
    trigger: state
  - entity_id: input_button.radio_ndr2
    id: ndr2
    trigger: state
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: bbc
        sequence:
          - target:
              entity_id: media_player.wohnung
            data:
              media_content_id: >-
                media-source://radio_browser/6e64bd71-cd36-4f6f-ba64-462d3b6298ea
              media_content_type: audio/aac
            metadata:
              title: BBC Radio 1 Dance
              thumbnail: >-
                https://rmp.files.bbci.co.uk/playspace/img/apple-touch-icon.96d5401f35.png
              media_class: music
              children_media_class: null
              navigateIds:
                - {}
                - media_content_type: app
                  media_content_id: media-source://radio_browser
                - media_content_type: music
                  media_content_id: media-source://radio_browser/tag
                - media_content_type: music
                  media_content_id: media-source://radio_browser/tag/electronic
            action: media_player.play_media
      - conditions:
          - condition: trigger
            id: bob
        sequence:
          - target:
              entity_id: media_player.wohnung
            data:
              media_content_id: >-
                media-source://radio_browser/52af7de9-a207-43e0-91c3-d1a71d999b40
              media_content_type: audio/mpeg
            metadata:
              title: Radio Bob
              thumbnail: https://www.radiobob.de/_nuxt/icons/icon_512.cUMc34Nz2jc.png
              media_class: music
              children_media_class: null
              navigateIds:
                - {}
                - media_content_type: app
                  media_content_id: media-source://radio_browser
                - media_content_type: music
                  media_content_id: media-source://radio_browser/country/DE
            action: media_player.play_media
      - conditions:
          - condition: trigger
            id: hamburg
        sequence:
          - target:
              entity_id: media_player.wohnung
            data:
              media_content_id: >-
                media-source://radio_browser/15c35b54-4148-4a33-a298-048769f2f97a
              media_content_type: audio/aac
            metadata:
              title: "Radio Hamburg "
              thumbnail: https://www.radiohamburg.de/
              media_class: music
              children_media_class: null
              navigateIds:
                - {}
                - media_content_type: app
                  media_content_id: media-source://radio_browser
                - media_content_type: music
                  media_content_id: media-source://radio_browser/country/DE
            action: media_player.play_media
      - conditions:
          - condition: trigger
            id: ndr2
        sequence:
          - target:
              entity_id: media_player.wohnung
            data:
              media_content_id: >-
                media-source://radio_browser/1816a038-6963-4e81-b930-ed3d21ec59ef
              media_content_type: audio/aac
            metadata:
              title: NDR 2 - Hamburg | 48 kBit/s AAC
              thumbnail: https://www.ndr.de/favicon-196x196.png
              media_class: music
              children_media_class: null
              navigateIds:
                - {}
                - media_content_type: app
                  media_content_id: media-source://radio_browser
                - media_content_type: music
                  media_content_id: media-source://radio_browser/country/DE
            action: media_player.play_media

die schon 6 Monate nicht mehr lief.

Mache inzwischen alles über Music Assistant.
Da kannst du auch Radio Stationen als Favoriten speichern damit du die nicht ewig suchen musst.
Funktioniert auch gut mit Chromecast.

LG
Tobi

music assistant ist meiner Meinung nach dann doch etwas mit Kanonen auf Spatzen geschossen.

Die Lösung mit den Buttons gefällt mir da schon viel besser. Aber ich habe Fragen:

  • Ich habe mushroom installiert und den Code für (ich vermute, einen der Buttons), sehe aber die Buttons nicht.

  • sehe ich es richtig, daß die Buttons lediglich die Automatisierung auslöst bzw. von dieser abgefragt wird?

  • wenn ja, geht das auch ohne mushroom mit den normalen Lovelace Buttons?

  • wenn nein, wo muss der Code hin. Ich vermute, in den Abschnitt eines Dashboards.

  • Wo muss der Code der Automatisierung hin? Vermutlich in eine neue Automatisierung?

  • woher bekomme ich die media_content_id?

Dazu muss ich sagen, daß ich mit YAML etwas auf Kriegsfuß nicht einmal tieferen Sinn in den Einrückungen erkennen kann.
Alles, was ich bisher gemacht habe, habe ich größtenteils auch ohne all zu tief in den Eingeweiden der YAML-Dateien herumzuwühlen, hinbekommen.

Jop die lösen nur die Automatisierung aus über Helfer Tasten (input_button)

Ja geht auch, hatte es bei mir halt damit gemacht.

Ja einfach in eine Neue Automatisierung → über die 3Punkte oben rechts auf YAML umstellen und einfügen.
Danach kannst du wieder auf die UI umstellen und die Automatisierung bearbeiten.

Du kannst es einfach über die UI auswählen, musst halt einmal durch den Radiobrowser durch.

Bild (Klick)

LG
Tobi

Danke. :slight_smile:

Die Verbindung Mediaplayer → Automatisierung hat bei mir irgendwie gefehlt.
Ich war irgendwie bei dem Media-Player-Karte hängen geblieben und bin nicht darauf gekommen, daß man ja auch in Automatisierungen Medien wiedergeben kann.
Durch dein Bild hat es bei mir Klick gemacht.

Kannst dir auch das mal ansehen

So habe ich es bei mir auch aufgebaut.

Danke, das sah bis zum Anlegen der Scripte ziemlich gut aus, aber dann wieder dieses herumwühlen in YAML…

Was ich suche ist eigentlich ein Player, wo ich mir genau das ersparen kann.

Ich habe mir jetzt für jeden einzelnen Sender (umständlich genug) eine Automatisierung angelegt, die ich über einen Button auf dem Dashboard aufrufe.

type: custom:button-card
name: RadioBob
entity: media_player.google_dot_2
show_icon: false
show_name: false
styles:
  card:
    - height: 80px
    - background-image: >-
        url("https://play-lh.googleusercontent.com/pVzlKoFW-dXjcAHbqzwqIcL4CkgDgdxGHYvr7vUauFWXDOBfDn1VbFRQaQvpZpaMpQ=w240-h480-rw")
    - background-size: 70px 70px
    - background-position: center
    - background-repeat: no-repeat
    - background-color: transparent
tap_action:
  action: call-service
  service: mass.play_media
  data:
    media_id: RadioBob
    media_type: radio
  target:
    device_id: d982cac64da7a1ea166f8243abd78c3d

So löse ich das.
Die MediaID lässt sich finden indem du den Sender im Musicassistant (Addon RadioBrowser) suchst und abspielst und dann in den Entwicklerwerkzeugen nach der MediaID schaust.

Und hier noch eine Card, die dann Cover (wenn verfügbar), Titel, Interpret usw. Anzeigt (wenn Player spielt … ansonsten nicht zu sehen)

type: custom:button-card
entity: sensor.uhrzeit
show_state: false
show_icon: false
show_name: false
styles:
  grid:
    - position: relative
  card:
    - height: 482px
    - justify-self: center
  state:
    - justify-self: center
  custom_fields:
    zeit:
      - position: absolute
      - top: 5%
      - bottom: 25%
      - left: 5%
      - right: 5%
    datum:
      - position: absolute
      - top: 35%
      - bottom: 25%
      - left: 10%
      - right: 10%
    muell:
      - position: absolute
      - top: 50%
      - bottom: 25%
      - left: 25%
      - right: 25%
    muell1:
      - position: absolute
      - top: 70%
      - bottom: 25%
      - left: 25%
      - right: 25%
    cover:
      - position: absolute
      - top: 0%
      - bottom: 0%
      - left: 0%
      - right: 0%
      - z-index: 0
      - margin-top: "-40px"
    media:
      - position: absolute
      - top: 80%
      - bottom: 0%
      - left: 0%
      - right: 0%
      - z-index: 1
    moon:
      - position: absolute
      - top: "-7%"
      - bottom: 0%
      - left: 0%
      - right: 0%
      - z-index: 1
custom_fields:
  moon:
    card:
      type: custom:button-card
      entity: sensor.moon_phase
      show_name: false
      show_state: true
      show_icon: true
      size: 40px
      styles:
        card:
          - background: transparent
          - border: 0
        state:
          - font-size: 1rem
          - font-weight: 300
      card_mod:
        style: |
          ha-card {
            box-shadow: none;
          }          
  media:
    card:
      type: conditional
      conditions:
        - condition: state
          entity: media_player.jbl_link_bar
          state: playing
      card:
        card_mod:
          style: |
            ha-card {
              box-shadow: none;
        type: custom:mushroom-template-card
        primary: |
          {{ state_attr('media_player.jbl_link_bar', 'media_title') }}
        secondary: >
          {{ state_attr('media_player.jbl_link_bar', 'media_artist') }} {{- '\n'
          -}} {{ state_attr('media_player.jbl_link_bar', 'media_album_name') }}
        multiline_secondary: true
        fill_container: true
        entity: media_player.jbl_link_bar
        tap_action:
          action: more-info
  cover:
    card:
      type: custom:button-card
      entity: media_player.jbl_link_bar
      show_state: false
      show_name: false
      show_icon: false
      show_entity_picture: |-
        {% if is_state("media_player.jbl_link_bar", "playing") -%}
          true
        {%- else -%}
          false
        {%- endif %}
      size: 100
      styles:
        card:
          - background: transparent
          - opacity: 20%
          - border: 0
        state:
          - font-size: 1.6rem
          - font-weight: 300
      card_mod:
        style: |
          ha-card {
            box-shadow: none;
          }          
  muell:
    card:
      type: custom:button-card
      entity: sensor.muellnaechster_muell
      show_state: true
      show_name: false
      show_icon: true
      size: 50px
      styles:
        card:
          - background: transparent
          - border: 0
        state:
          - font-size: 1.6rem
          - font-weight: 300
      card_mod:
        style: |
          ha-card {
            box-shadow: none;
          }          
  muell1:
    card:
      type: custom:button-card
      entity: sensor.muellnaechster_date
      show_state: true
      show_name: false
      show_icon: false
      size: 50px
      styles:
        card:
          - background: transparent
          - border: 0
        state:
          - font-size: 1.6rem
          - font-weight: 300
      card_mod:
        style: |
          ha-card {
            box-shadow: none;
          }          
  datum:
    card:
      type: custom:button-card
      entity: sensor.datum
      show_state: true
      show_name: false
      show_icon: false
      styles:
        card:
          - background: transparent
          - border: 0
        state:
          - font-size: 2rem
          - font-weight: 300
            card_mod: null
      card_mod:
        style: |
          ha-card {
            box-shadow: none;
          }
  zeit:
    card:
      type: custom:button-card
      entity: sensor.uhrzeit
      show_state: true
      show_name: false
      show_icon: false
      styles:
        card:
          - background: transparent
        state:
          - font-size: 8rem
          - font-weight: 300
      tap_action:
        action: navigate
        navigation_path: "#eieruhr"
      card_mod:
        style: |
          ha-card {
            box-shadow: none;
          }
card_mod:
  style: |
    :host {
      --mush-card-primary-font-size: 2rem;
      --mush-card-primary-font-weight: 300;
      --mush-card-secondary-font-size: 1rem;
      --mush-card-secondary-font-weight: 300;
      --mush-card-primary-line-height: 1.3;
      --mush-card-secondary-line-height: 1;
    }