What am i doing wrong getting: extra keys not allowed @ data['source']

Hi,

I’m trying to start spotify in a script to play music on a specific device.
What sometimes happens is that i listened on another device such as my computer.
After i run the script the music starts playing on the last used device. I wanted to force HA to play the music on the device i want but when i try the script below i get the error in the subject.

Does anybody know how to fix the: Failed to call service script/play_music. extra keys not allowed @ data[‘source’]

service: media_player.play_media
target:
  entity_id: media_player.spotify_USERNAME
data:
  media_content_id: 'https://open.spotify.com/PLAYLIST-ID'
  media_content_type: playlist
  source: Badkamer

Thanks in advance.

Don’t include source. source is not a valid field for the media_player.play_media service and that’s what the error is telling you.

ok. Thats quite straightforward. Thanks for the quick reply Petro.

1 Like

@Max68 did you find a way to select a specific spotify device?
I also only want it to play in my bathroom !! What did you do at the end? thx

The documents cover this

Saw the integration page, but exactly where should I specify the source?

This is my script:

And this is the error I’m getting if no active devices are playing music on Spotify already:

I need to play music on an Alexa Echo Show or Echo Dot device also if these devices are not playing music already.

Thanks! :wink:

EDIT: Solved. I was missing the “Media Player: Play” call service. Now everything works correctly! :white_check_mark::white_check_mark: