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

This has been thought out really nice. Are you willing to share the gui-yaml code of the popup?

Thanks a lot!

@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

Thanks, I managed to get the script working but now want the simple entity card i have in my ā€˜homekit styleā€™ layout. Itā€™s not that easy to get that done :ā€™)

thanks, hope to can get something of your code working

Ah ok, yeah I donā€™t use the Homekit Syle card (you mean the one from DBuit right?)

Yes! correct. With my own additions onto it ofc

Yes, Iā€™m not sure how that one works. I like his work, but donā€™t want to be dependable on someone elses work to create my interface. Thatā€™s why I decided to not use his and create my own interface. I do use his popup sliders though. They work pretty good, though I want to create my own version later on.

1 Like

Wish I had the same experience in yaml as you have. Did you share your config somewhere to just dig in and learn :slight_smile: ?

I started using Home Assistant since last december (so just over 7 months ago). I switched from Homey (smart home platform) after using that for around 1,5 years. I started using YAML mode like 3-4 months ago. I am by no means a programmer (I studied marketing and am working at communications/marketing). I just try a lot and figure out as I go.

I donā€™t have my config published right now. I might do that down the road, but Iā€™d need to clean a lot up (have a lot of personal info and comments everywhere to help me code). Right now I donā€™t have the time to publish that unfortunately. There are a lot of other people who have their complete UIā€™s programmable, like Dwaine and Jimmy.

1 Like

Hey, Iā€™ve started using spotcast and think its excellent! Iā€™ve been able to set up some easy one click buttons in HA that are great for my family to use to get music into the room theyā€™re in!

However, Iā€™m noticing a small problem in that it randomly stops playing back after approx ~30minutes. One click of the button gets it going again, but as a result we end up hearing a lot of the same tracks even with the ā€œrandomā€ songs set to true.

Just wondering if I have done something incorrectly?

I have this configured on a template switch.

      spotcast_everywhere:
        friendly_name: "Everywhere Music"
        value_template: "{{ is_state('media_player.everywhere', 'playing')}}"
        turn_on:
          - service: spotcast.start
            data:
              device_name: Everywhere
              random_song: true
              uri: 'spotify:playlist:xxx'
        turn_off:
          - service: media_player.turn_off
            entity_id: media_player.everywhere

Thanks in advance for any assistance.

Itā€™s an hour (it might feel like 30 minutes because you started the service earlier, then stopped and played again). This has to do with the tokens. As far as I am aware there is no way around this at the moment.

1 Like

Hi!

Iā€™m trying to upgrade from 0.111.4 to the latest version but when I run the ā€˜Check Home Assistant Configurationā€™ tool from Supervisor to check my config against the latest version, I get the following incompatibility:

Failed config
General Errors:
- Component error: spotcast - No module named ā€˜spotipyā€™

The Spotcast component is working flawlessly in 0.111.4 so Iā€™m not really sure why I get that response when checking against the new version??

Any assistance will be greatly appreciated!

Weird. Uninstall spotcast and upgrade HA and then install latest

What happens after the latest release?

No more cast devices between the players list

I saw that 0.112 had a different way to store cast devices

Now it is solved with spotcast 3.3.4

Ok, but i still have 0.111ā€¦ is this a problem?

Donā€™t know. Try 3.3.4

Yes, it works!! Great, thanksā€¦

Hi
Is it correct that the spotcast integration no longer exists in HACS? I cannot find it there.
So only manual installation possible?
Thanks to clarify;-)

Spotcast should exist as far as I know.

try the ā€œ+ā€ sign