Does anyone have a system running Spotify & Sonos ? please share code.
Hey friends! I just wanted to share a card I’ve done called Spotify Card which can be found here: https://github.com/fondberg/spotify-card and it is similar to this project but uses the Spotify Web API.
That looks rather nifty, I’ll have to try that out.
Sonos is not supported. Read the bottom of this page.
Here is the code
https://pastebin.com/rCX5MfWh
Ill get this error when ill checks ths config.
Package spotify setup failed. Component script has duplicate key ‘alias’
Anyone that might be able to help me what to look for?!
Hello, I’m the author of spotcast which is a service to initiate Spotify playback on an idle chromecast device. I’m looking to get in contact with someone who has intimate knowledge about the media_player.py
standard component to discuss possible merge between the components.
Hi everyone, does anyone know if this can work as part of a trigger e.g. if my door sensor triggers it can play a specific spotify playlist on my bose speaker??
I dont see why not
trigger the playlist as a script
spotify_door_sensor:
alias: Spotify Door Sensor
sequence:
- service: media_player.play_media
data_template:
entity_id: media_player.favourite_speaker
media_content_id: 'spotify:user:spotify:playlist:0ztMQWTqq8pM1ej5sf4lMn'
media_content_type: 'playlist'
Then use the script in an automation
- id: 'door_sensor'
alias: "Door Sensor start Playlist"
trigger:
platform: state
entity_id: sensor.door
from: 'off'
to: 'on'
action:
- service: script.turn_on
data:
entity_id: script.spotify_door_sensor
Thanks a lot for this! It’s exactly what i’m looking for i think.
Will give it ago tonight and see what happens, thanks!
Hey,
Sorry to be a pain but how do you go about getting the long spotify media_content_ID?
Is there something i need to do to do this?
I find the easiest way is to open the playlist on the web player on a PC. In the address bar will be the string you need.
I set up Spotify. I created albums in Spotify, then I created scripts for playback. Scripts work as long as Spotify runs on your PC or phone. If Spotify does not work on your PC or phone, then scripts will not work.
Here are the settings:
in media_player.yaml
- platform: spotify
client_id: 0997a528e9e34c06846c91b955912345
client_secret: 10596adc7c184bdd958f775e07954321
in scripts.yaml
spotify:
alias: 'Spotify'
sequence:
- service: media_player.play_media
data_template:
entity_id: media_player.spotify
media_content_id: 'spotify:user:spotify:playlist:xxxxxxxxxxxxxxxxxxxx'
media_content_type: 'playlist'
I would like the scripts to work permanently for use in automation.
What else do I have to do?
THX
I added all these codes to the right files (i also created customizes.yaml).
How do i add into lovelace card?
Hello! Please help me out here.
The config is valid, everything looks good. When I try to start a playlist, I get an error in the log with this exception:
spotipy.client.SpotifyException: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/volume?volume_percent=40:
Player command failed: No active device found
What am I doing wrong?
just reboot yuor raspberry, this plugin is a crap
Hi guys,
I am a bit lost, I tried a lot to setup spotify to run via a script and play a playlist on my google home mini.
Unfortunately it does not work.
I have the following script:
spotify_test_playback:
alias: Spotify playback
sequence:
- service: media_player.media_play
data_template:
entity_id: media_player.office_speaker
media_content_id: 'spotify:user:vladchiriloiu:spotify:playlist:3rzgkeEOq570xyFZlsv9mV'
media_content_type: 'playlist'
But whenever I execute the script, it does not work and throws this error:
Logger: homeassistant.components.websocket_api.http.connection.140102125000016
Source: core.py:1212
Integration: websocket_api (documentation, issues)
First occurred: 10:44:02 AM (1 occurrences)
Last logged: 10:44:02 AM
extra keys not allowed @ data['media_content_id']
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 207, in service_handler
await script.async_turn_on(variables=service.data, context=service.context)
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 284, in async_turn_on
await self.script.async_run(kwargs.get(ATTR_VARIABLES), context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 693, in async_run
await run.async_run()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 444, in async_run
await self._async_run()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in _async_run
await self._async_step(not propagate_exceptions)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 138, in _async_step
self, f"_async_{cv.determine_script_action(self._action)}_step"
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 233, in _async_call_service_step
context=self._context,
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 101, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context
File "/usr/src/homeassistant/homeassistant/core.py", line 1212, in async_call
processed_data = handler.schema(service_data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 208, in __call__
return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 287, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 283, in _exec
v = func(v)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable
return schema(data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['media_content_id']
Can you please give me an idea on what I need to do to make it work?
don’t forget to reset your client_secret never a good idea to share it
I love this project. However, it won’t play music on my Google Mini’s. In Google Assistant app it changes from “Not playing” to “Now playing” when I execute the script to play music from a selected playlist, I get to hear the chime from the Google Mini indicating it turned on, but no music. Anyone got an idea of what I’m doing wrong?
Hmm, automation.yaml, empty file, copied the code in,
end of the stream or a document separator is expected at line 2, column 3:
trigger:
^