Hi Everyone,
A very newbie question here
Could someone please advise how l could have ‘source’ automatically applied to the default spotify card?
I have two images
Image#1 shows the current view with no source selected by default
Image#2 show the source after l have manually selected it from the drop-down within the Spotify card
As I only have 1 source, l would like to remove having to manually select the source each time before being able to play music.
If you planning to advise to use the mini-media card instead, could please provide sample yaml configuration that applies the source automatically.
My prefference is the use the default Spotify card if possible
What version of HA are you using? I don’t even get the source field in my Spotify media player.
I’m also surprised you have an item in your source list at all. Are you trying to add it manually? The spotify media player doesn’t usually populate the source or source_list until you’ve started it on another spotify device or with spotcast.
The source and source list are normally not populated until the media player is on. In the case of the Spotify media player, that means media is already playing, so the source would already be selected.
Spotify usually “forgets” its source list when it’s been off for a couple of minutes, which means that source select box shouldn’t even be there (see my previous screenshot) when nothing is playing on Spotify. Which also means you can’t preselect a source. When Spotify is playing, the source should obviously already be selected.
I have a TV (LG - WebOS) that forgets the source list like Spotify when it turns off so I used it to test the following automation. However, the difference is the TV will populated the source list when it turns on. The Spotify source list is usually only populated with the media player Spotify is playing on, and again, it should already be selected.
This is why I previously asked if you were trying to set the source list manually somewhere in your config. The source you show is pretty weird also - it looks like the device ID or something instead of the media player name.
Anyway, this automation will automatically select the HDMI source when my Bedroom TV is turned on. You can set the entities and source to your Spotify media player and try it out. I don’t think it will work because the Spotify media player must already be playing for the source list to populate.
Example Automation
automation:
- id: media_player_auto_select_source
alias: 'Media Player Auto Select Source'
description: 'Auto select media player source.'
max_exceeded: silent
trigger:
- platform: state
entity_id: media_player.bedroom_tv
from:
- unknown
- idle
- 'off'
action:
- wait_template: "{{ 'HDMI 1' in state_attr('media_player.bedroom_tv','source_list') }}"
timeout: 60
continue_on_timeout: false
- service: media_player.select_source
target:
entity_id: media_player.bedroom_tv
data:
source: HDMI 1
I have the same issue and also just one source device.
Once you stop playing Spotify for a few minutes the active session seems to end and the media player says the state is ‘Idle’, the media player UI element stops showing the last played album art and returns to it’s default color. When this happens the ‘source’ also gets deselected. If I try to start playing Spotify from Home Assistant while in this state I get an ugly unhandled error:
“Failed to call service media_player/media_play. No active playback device found”
In order to get it working again I have to click into the player card settings, manually select the source again from the drop-down list (even though it’s the only entry), then return to the player, at which point it works.
When Spotify goes ‘Idle’ the player card goes into it’s ‘blank’ state. If you try to press ‘Play’ or select any playlist at this point, you get a service error:
What I would want to do is set a ‘default’ source for the Spotify integration, so that when you press play or try to play media, if it doesn’t already have a source selected, it will select the default source instead of simply erroring.
It’s been a while, but this I was still having this problem once Spotify switches to idle (which seems to happen after 10 minutes of being paused). This works for me to wake Spotify up (and not take too long unless it has to). I call this at the top of any script that will play music.
I’m replying to myself because the workaround that I posted mysteriously stopped working. Trying to select a source from a script now yields a “service not supported” error; trying to select it manually does nothing and yields no error.
Edit: I installed @thlucas’ integration and now everything works great!
@thebarnidentity
Thanks Brandon, fixed the HACS link. It looks like they updated their site, and all of their links changed. Thanks for bringing this to my attention.
I’m a little late to reply on this topic, but thought it was worth a quick follow up post because I ended up down a few rabbit holes trying to solve. My Spotify automations using Node Red stopped working correctly some time ago, possibly due to issues or changes that others have also experienced. I spent some time on it, and I was able to get the default Spotify integration setting source and starting consistently, even when idle, by using the following:
It looks similar to some of the other yaml in this thread that were stated not to work, but maybe there have been some recent updates to the integration to fix. I’ve used this several times in the last few days and it seems to work fine now.