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

For both the question the answer is yes…

Can you open a ticket in github on the project?
There I like you to add the log output after editing the init.py file in spotcast with finding the like

_LOGGER.error('Could not find device %s from hass.data, falling back to pychromecast scan', device_name)

and changing it to

_LOGGER.error('Could not find device %s from hass.data, falling back to pychromecast scan, All devices in HASS %s', device_name, known_devices)

Don’t change the indentation of the line, only the content and then restart HASS and do the procedure again and copy the logs to the issue you created in github

I am sorry but cannot do this now as i am not home for some days… When i’ll be back i’ll do it and let you know… in the meantime can someone else with the same issue do this ?

The way to go is usually to look at the logs. Search for spotcast. If you can’t find it spotcast is not installed. This is normally due to HA needing a restart after installing custom components.

I am thinking about the issue with the device name and i see in the list of “Spotify connect devices” in my case is “Chromecast Audio”, but the spotcast.start device works only with the friendly name of the device (in my case “Salotto Audio”) so, to solve the issue of the device not found, can you put in the plugin the friendly name and not the device name as with the friendly name (found in the sensor.chromecast.device) all is working good…

Seems like HA is unable to install the dependencie spotify_token in venv as this requires lxml. How to you get around this?

You must be trying to install a quite old spotcast. Since quite q while it depends in spotify_token 0.1.2 which has the dependency you pointed to

If I understand you correctly you are asking if it is possible to use friendly name as the device_name? If that is the case it is exactly what it exists today.
There seem to be a lot of errors for people trying to use the entity_id as device_name. As per the documentation this is not what is expected by spotcast. The reason for that is that chromecast and spotify has no knowledge about the internal entity_id names that HA generates.
To use entity_id you need to NOT send in device_name into the service call to spotcast.start and instead send in entity_id.

Does this answer your question?

Sorry if my english is not so good, but i will try to explain what i mean with some screenshots.

If i want to use the spotify card to play some music on my “chromecast audio” device (entity_id name “media_player.salotto_audio”, friendly_name “salotto audio”) and i choose that name i get the error device not found. If i use the spotcast.start service from the services tab in the developers ui and choose as device_name “Chromecast Audio” i get this:

Instead i get this:

If i use the friendly name and i get the device playing.

After this in the card i get:

As you see the device currently playing has the friendly name and not the device name, but without using the service before i don’t get that but i get the error…
Hope to be more clear than before and thanks for the support…

Im trying to install v.0.1.2. v.0.1.1 is no problems, but it don’t depend on lxml (or an older version of lxml <4.5.5) Any tricks how i can force install lxml 4.5.5 in venv?

You should not use entity id and device name at the same time. The dev tools UI is confusing. Just don’t select entity id in the list (or remove it from the yaml below). The text in the documentation is pretty clear on this point, it says “not used together with…”.

Then it seems like many people has reported problems with how HA maps the chromecast audio devices. I would use device_name only to remove any mapping issues, as it what Spotify and Chromecast uses.

Ok, i changed the friendly_name from “chromecast salotto” to “salotto audio” and now all is working good… Thanks again.

The token needs to be refreshed through an oauth workflow: https://developer.spotify.com/documentation/ios/guides/token-swap-and-refresh/
https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow

After an hour you can present it with a refresh token value and you will be given another new one hour token to work with.

The whole purpose of spotcast is that it is using the spotify web app token. It is required because all tokens that can be acquired by the web api are not powerful enough. That means that there are no possibilities to do a refresh of the token and furthermore there are no possibilities known by me to send a new token to the chromecast device.

Love this - BUT I get an email from Spotify saying “New login to Spotify - ## We noticed a new login to your account. Here are the details:” etc everytime I trigger a script with the add-on.
Anyway to stop this behavior?

I cant get the script to work GET this error

the service work - and plays the playlist

I have exactly same problem - “new divice login” email on each start on idling device. Anybody knows about any elegant solution of this? It’s pretty annoying.

It started happening after update to 0.105.

i got it to work. i use automation instead of script in field 3 it should be empty to work.

Hi sorry if a newby question, I’m trying to reproduce a random playlist from a list, I tried to use the expression:

uri: {{ ['spotify:playlist:XXXXXXXX', 'spotify:playlist:XXXXXXX'] | random}}

but it seems that it doesn’t work.
Is this the best approach or is there maybe another optimal option to do so?

Hey all,

I’m new here and trying to get this work. As soon as I start to test the service, it doesn’t give me anything on the chromecast. I think it’s due to my spotify login, which is connected to facebook.


Should that be a problem @fondberg?