Welcome then!
Without really knowing, could it be that you used aliases in configuration.yaml without actually putting any in there?
Component not broke. Works ok for me, but not perfect. For instance, if the media player is off and an automation trigger, Spotify will play on something else. The players of my ex is still in my list, she could be more thrilled. Besides that, I’m happy.
Only you can decide if it is worth your time, but there’s really not much to it. Make sure logger is configured similar to post 22, Spotify needs to log “info”. I guess you need to remove aliases in your configuration.
Start HA.
I use SSH and write “journalctl -fu [email protected] | grep New” and get stuff like “Jan 13 13:12:43 hassbian hass[450]: 2019-01-13 13:12:43 INFO (Thread-18) [homeassistant.components.media_player.spotify] New Devices: {‘Pappa Speaker’: ‘8e2a9dxx3ca46275xxx2fadb0’, ‘Pappa’: ‘25f9ccccc61502da477ccccc5ead5bac1931’}”.
Use these for aliases in your configuration as stated in the documentation.
Ah, and one more thing… I agree with a lot of the people above, the component isn’t perfect. But to me it is, I guess it could be since I only use it with automations.
The Spotify thingy in the frontend constantly “forgets” the media players. I use a couple of chromecasts with external speakers and the wonderful Audio Pro C5:s who uses LinkPlay. “If door to patio is open, randomly play playlist(s). When movement in kitchen, do the same. When door closes, movement stops or TV is on stop”.
To me, that always works, except if I physically have removed the players and Spotify play somewhere else on something else…
Havent added any aliases at all, since I cant find them…
journalcrt yields only “-bash: journalctl: command not found”. As I said, completely new to this, been tinkering with it for two days, so might be my setup is incomplete or something?
What you are using it for, is what I would like to use it for as well. Not critical to be able to control it from the frontend.
This is also the argument I meet back when I raised the issue (making it a non-issue) - however I don’t see this behavior on my iPhone or MacBook spotify apps. Once in a while maybe, but not as much - maybe they do something to discover the devices more aggressively or something like that.
I am far from proficient with all of this, but I had an idea that I thought may be worth sharing. When I try to cast to google devices via Spotify on my desktop, I cannot see any of the google devices. I can only see the desktop I am on and a Firestick. The issue is referenced here (https://community.spotify.com/t5/Desktop-Windows/Spotify-Connect-amp-Google-Home/td-p/4642461) and I can confirm that I see all of my devices on my phone, but not from my desktop.
Maybe the limitation is with the Spotify API or the way that Home Assistant is using it, because it functions very similarly to the way that using Spotify on my desktop does. If I start playing music on a google home (via voice command or casting from my phone), I can see the google home on my desktop Spotify client in the devices menu but the moment I switch it to my desktop via the devices menu on my desktop the google home disappears. This is the exact same way that sources show up on my HA front-end and it behaves the same if I switch devices from the HA front-end.
Again, I have no idea how to begin remedying this, but I figured I would throw it out there in case someone who has the knowledge wants to take it and run with it at some point. Maybe there is a way to utilize the iOS or Android API to see google devices with more reliability.
The problem is indeed with Spotify API. There’s a few issues on Spotify open. I have been researching a bit. Google Assistant can actually start the cast too. Hence, I was thinking of a workaround to make a request to Google Assistant to start the cast, then take over the control in Home-Assistant. In that sense, I wonder whether the Google Assistant SDK Add-on could make it work. Does anyone has it installed to check whether it’s possible to make REST/HTTP calls or use it in scripts?
I think I could indeed dig up ids using Spotify Rest API as per the link shared by phairplay.
But how do you use spotify in automation? I tried to use spotify.play_playlist service as described on https://www.home-assistant.io/integrations/spotify/, but it reports no activ device found (I can play on one and Rest API reported it back!)
Sure. This is really ugly, but I haven’t looked at it for a couple of years and it works. I had some strange issues with lists starting with the same song and volume so there’s quite a lot of room for improvement. Again, it does what I want it to do…
There is not much to look at. The current integration in 0.105 shows all sources provided by the Spotify API. There is no filtering on our end for that.
Yeah, we’ve settled that this is a Spotify API problem…
But @peglegreg is right… mobile apps have a different way of fetching the available sources on the local network, since they all show as available most of the time. Isn’t there any way for the HA integration to make a scan the same way the mobile apps do instead of fetching the sources from the API?
Yes, but not only…
For instance, my Samsung TV, my PS4… they show up in my android app but not on the desktop app, which also gets the source list from the API.
There’s only one source available at all times and that’s my Yamaha receiver. I wonder why…?
Why are the Chromecast devices listed in the Spotify Lovelace Card, while they are not available in the official Spotify API, and thus not in the sources of the media_player in HA? Anyone knows?
My wife’s Spotify account also doesn’t list any device. I can stream to Chromecast devices now through Spotcast, but I have other devices I want to start playback on (HEOS in my case). None of these are in the source_list of the media_player entity of the Spotify integration of my wife, until I start the playback myself manually through the Spotify app on her phone. Then the source_list is populated as it should be.
Also checked the api of Spotify and got this returned: