Hi,
Is the below code correct? I am able to view what I am playing in HA (and stop start music), but now I would like to make some automations and play a playlist.
ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.stream_test_spotify. Invalid data for call_service at pos 2: extra keys not allowed @ data['media_content_type']
From what I can gather in the docs, you need to omit media_content_type: playlist
as that is not a valid argument for the spotify.play_playlist service
At the first sight, your media_content_id: contains something that shouldn’t be there or does not exist (hence the 404 not found error)… I’m guessing you need to leave the ?si... part off
thanks for getting back to me, still not working but now I am not getting any errors.
I made the change you suggested and found another silly mistake … I had to use media_player.play_media NOT media_player.media_play.
I hadn’t set up this integration yet, but now did so I could experiment with it Cool, but not yet sure how to make i usefull, as it seems prone to throwing up errors if you ask it to do something “illogical”, such as asking to play without some playlist loaded first
as for your example, try without the ’ around the media_content_id? That did the trick for me…
I tried playing a playlist on my cellphone, possibly needs the spotify app “open” first as well, not sure yet about that.
you misunderstand - just remove the single quotes from around the spotify string, eg media_content_id: spotify:user:spotify:playlist:37i9dQZF1DWSkkUxEhrBdF
NOT media_content_id: 'spotify:user:spotify:playlist:37i9dQZF1DWSkkUxEhrBdF'
I think the quotes are only needed when you put an actual http url, for example.
Well, in my limited trials, even with a working servie call it seemed spotty ( ) if it would work or wouldn’t, depending on if the app was already active etc - but limited testing, and only with the app on an android device.
Not much time to play with it right now, but as I said for me it also wasn’t very reliable during my brief test… You could try to turn on the speaker first, maybe send something else from spotify to it (like from a cell phone) to make sure the spotify on it is “awake” (as that seems to be a factor on my phone).
Or try another device, if you have other “spotify connect” enabled device, such as an app on your cellphone maybe? Does it work if you play/pause when something is already playing?
Are you sure the device is spotify connect enabled? You can send spotify to anything with a google cast builtin for example, but it isn’t fully spotify connect, afaik (eg i can cast spotify to a chromecast, but not spotify connect it (like via hass) - even though the spotify app doesn’t show the distinction. But maybe that’s just me?
Upter upgrading to 0.106 (docker) sand changing the configuration, I get strange error:
Error loading /config/configuration.yaml: in “/config/configuration.yaml”, line 68, column 10: Unable to read file /config/./integrations/spofity.yaml.
I am currently running a headless Hassio on a RPI3b+. I have been unable to change the audio from my HDMI cable to the 3.5mm jack. I am unable to ssh into the RPI, but have full File Editor control from Hass Frontend.
Can anyone help me with what I should be putting into the config file or yaml to get this to work?
Yes I think showing how to use a service with a simple script is the easiest way to test/demonstrate the function (of course you can also use the developer tools). Once you can confirm a simple script triggers the action, you can use it in more complex automation.
If you do try out the tutorial and run in to some issues, feel free to leave a post here as I am happy to help and always looking to improve my content