Spotcast - custom component to start playback on an idle chromecast device

@martheijnen and @mitch Hi, thank you! It’s impossibe for me to share that for the time being. I have split my configuration in to multiple yaml files (like more than 40 files). I don’t have the time to search them all an put them in a file or to share my entire setup. I can share the code of what you see there, but you’ll be missing a lot of info and files. It’ll give you an idea how I created that and should help you on your way though!

    card:
      layout: vertical
      type: 'custom:layout-card'
      column_width: 96%
      cards:
        - content: |
            # Maak je keuzes en tik op het Spotify icoontje.
          style: !include /config/templates/smartphone/markdown-sub-style.yaml
          type: markdown      
        - cards:    
            - entities:
                - entity: input_select.spotify_playlist
                - entity: input_select.google_cast
              type: entities
              style: |
                ha-card {
                  --paper-card-background-color: var(--background-color) !important;
                  box-shadow: none !important;
                }            
            - deep_press: true
              entity: media_player.sony_cast
              hold_action:
                action: more-info
                haptic: heavy
              icon: 'mdi:spotify'
              label: Spotify
              name: Tik hier om te starten!
              aspect_ratio: 4/1
              size: 100%
              show_icon: true
              show_label: false
              show_last_changed: false
              show_name: false
              show_state: false
              state:
              styles:
                card:
                  - font-size: 18px
                  - background-color: var(--background-color)
                name:
                  - font-weight: bold                  
                  - font-family: Helvetica                
                label:
                  - font-size: 10px      
                  - filter: opacity(0%)
              tap_action:
                action: call-service
                haptic: medium
                service: script.turn_on
                service_data:
                  entity_id: script.spotify
              type: 'custom:button-card'                
            - !include /config/templates/mediaplayers/card_sony_cast.yaml
          mode: vertical
          keep:
            background: true
            border_radius: false
            margin: false        
            outer_padding: false
          type: 'custom:stack-in-card'
              
    deviceID:
      - this                      
    style:
      align-items: center
      background: var(--background-popcard)
      icon: 'mdi:apple'
      justify-content: center
      width: 400px
      box-shadow: none
    title: Spotify

And if you have multiple media players you want to swipe between just wrap those cards inside a swiper-card (install the plugin first through HACS). I removed that from the code above, because it would be confusing (since I also deleted other media players to showcase the code more clearly)

- cards:
    - INSERT CARDS HERE
    - INSERT CARDS HERE
    - INSERT CARDS HERE
  parameters:
    spaceBetween: 20 
    pagination:
      type: bullets
  type: 'custom:swipe-card'    

Make sure to view the post of Rob_NL I mentioned above to have the menu/script actually functional. I created my own script using his example: Chromecast Radio with station and player selection

1 Like