Spotify Lovelace Card

The spotify integration in home assiatant and this card doesn’t share anything wrt to authorization. Please read the README for this card or search this forum thread for auth and redirect url configuration in spotify developer tools

Apps are not supported as they doesn’t handle redirects the same way as browsers dom there are no workarounds that I know of

Hmm… That’s too bad. Maybe it’s something the HA devs could look at at some point I suppose.

Howdy,
Having some issues getting this authenticated.

Spotify integration works fine. I can see the ‘media_player.spotify_chad’

callbacks are
image

Base http is

 http:
   base_url: http://192.168.20.40:8123/lovelace/media/

I’ve also tried

 http:
   base_url: http://192.168.20.40:8123/lovelace/media

and

 http:
   base_url: http://192.168.20.40:8123

When I click the card to authenticate I get the “INVALID_CLIENT: Invalid redirect URI”

Login - Spotify

Can anyone see if there is something wrong with my setup?

I had to set the base_url to the Nabu Casa address and the same in the redirect on Spotify and worked great. I could not get it to work for private addresses since they cannot route outside the network.

Anyone have a good lovelace design for using the new Spotify entity that is created in the new integration on HA v105? The basic media card blows and I tried to setup the custom Spotify card but no joy there.

Thanks, Tried that no luck… :sleepy:

For some reason I have to authenticate every time I open my home assistant app.

Is it just me or is this normal behaviour?

What did it for me is that you add the PAGENAME of the page where you are using the card.

on the page configuration:

You add a name to your page (capital sensitive) to the page information (configure UI on top right and then click on the little crayon next to your “page”) there you add a name as URL and this is the whitelist URL you use in Spotify
So in this case :
, 192.168.x.x:8123/Lovelace/Music
as URL in Spotify developer as whitelist url

2 Likes

Thanks, That did it. I added JUST the url (without the “/auth/external/callback”) at the end that is needed for the standard integration.

Fingers crossed it stays!

Thanks

So, I think I ran into all issues that are posted here but now finally have something working. One last problem is I can only see one (Denon HEOS) media player in the drop down menu at the bottom of the playlist. See pic.Screen Shot 2020-02-23 at 19.10.48

The second one (Denon Soundbar) never shows but is online and an entity in my HA setup. When using the media control card, I can just put it onto the lovelace gui and can select my favorites and play it succesfully so it must be working.

I have no clue where to search for what’s wrong. Hope someone has some advice!

Thanks!

Guys just a quick question.
In which folder do you copy the files?
I am getting
Custom element doesn’t exist: spotify-card.
type: ‘custom:spotify-card’

Do I need to add anything else except

  cards:
    - type: 'custom:spotify-card'
      client_id: <YOUR CLIENT ID>

I finally managed to make it work.
Is there a way to pause or stop the playing from the card?




What can we do, with the device-list? As mentioned here, it’s working just fine with spotcast.

The devicelist with spotify-lovelace-card is broken, and still hold up many many entities. I guess the best thing, could be to make a better filter of Chromecast devices in HA? Or?

Could you fix it :-)?


@03397 - I’ll recommend you to add the Spotify-component to HA. After you’ve connected it, you can use the media_player.spotify_<youraccountname>-entity.

Here is the entity, listed in a normal view:
image

Here is it present, by itself:
image

Here it’s shown with mini-media-player:
image

First, thanks for css changes! Release 1.21 with that just now

Second, the devices you have extra, can you think a way to filter those in the code snippet you pasted? I have not heard of the entity registry having too many cast devices. It was Paulus who pointed me to use the websocket api and this call specifically. For me to help here I would need to get a raw list of the devices HA returns (add a console.log(JSON.stringify(whatever-was-returned-by-hass-in-the-ws-call))

No problem :slight_smile:

@Reilly911 - Check out the latest version. I have not made any logic-changes for small devices and so, but hopefully it’s works a bit better on your screen, too.


Good point.

Actually i’ve tried a few things in the last week or so; so it’s a bit easier for me, to understand the logics behind the card.

I can see, that the problem can be isolated to media_players in state unavailable.

By using the same filter, as in the card, i’ve 38 (!) entities, but if i use .filter(e => e.state != 'unavailable'). in the pull, there’s just 12 devices back in the object.

Could it be bad, to filter the unavailable-state devices? (In my test, i just added it in front of .filter(e => e != null).

I can also see that most of the devices is Google-audio groups, like:

  {
    "entity_id": "media_player.team_maxi_5",
    "state": "unavailable",
    "attributes": {
      "restored": true,
      "supported_features": 0
    },
    "last_changed": "2020-02-27T15:22:25.022148+00:00",
    "last_updated": "2020-02-27T15:22:25.022148+00:00",
    "context": {
      "id": "d1c662aaaaaaaaaaaaaremoved....aaaa4436757",
      "parent_id": null,
      "user_id": null
    }
  },

I can see that my media_player.team_maxi_x is listed five times. I’ve four speaks in the “Team Maxi” group, so it’s not adding up, to the total of speakes in a group, or so…

I’m not 100 sure, if it’s related to something like - but it sounds like it :slight_smile:

And, with that, i guess the best thing would be, to filter out devices in unavailable state - cause… If they are unavailable, i can’t see why they should be in the list :)?

Update: PR submitted :slight_smile:

Fun-fact: Spotify can’t really handle the Group-names, so they are just reporting the first device of the group or so, so if i select “Team Maxi”, it’s reporting that music is playing on “Badeværelse”. It’s reporting the same in the API, so… It’s just another good example of a dump Google-API solution, or so… I’m really hate that Google are not listening to the Google Audio-users, and at least, fixing the stability problems with sound-groups, “move music to other devices”, and stuff like that :slight_smile:

1 Like

Hi, Great card!

Looking for some help; idle chromecast devices don’t show up.
I’ve also installed spotcast and its sensor finds all the devices.
What could be wrong?

Hi, it works fine inside the browser but not with the official Home Assistant Android App (I see always the “authenticate” button). How can I fix it?

Try configuring chromecast in the general HA setup.

The app is not supported due to its limitation with redirects