#Get Play-State of addon-spotify-connect

1 messages · Page 1 of 1 (latest)

magic drum
#

Is there a way to parse the current state of the addon-spotify-connect add-on ?

I only want my amp to turn on (via ZigBee Plug) when there is music playing

magic drum
#

@jaunty moth

sly cairn
#

Here's something similar that I use with my SpotifyPlus integration and Philips Hue lighting. It changes the Philips Hue lighting color to vibrant color of currently playing Spotify track cover art when the SpotifyPlus media player is playing something. You could easily modify the actions to turn your amp on (instead of modifying light colors); you could also add conditions that only apply if the selected Spotify source is the "Spotify Connect" device name.

Example Script:

alias: SpotifyPlus Hue Lights to Currently Playing Spotify Cover Art Vibrant Color
description: >-
  Changes Philips Hue lighting color to vibrant color of currently playing
  Spotify track cover art.
triggers:
  - trigger: state
    alias: Trigger when SpotifyPlus media player Track ID changes
    entity_id:
      - media_player.spotifyplus_todd_l
    attribute: media_content_id
conditions:
  - condition: state
    alias: If SpotifyPlus media player is playing something
    entity_id: media_player.spotifyplus_todd_l
    state: playing
actions:
  - action: spotifyplus.get_image_vibrant_colors
    alias: Get vibrant colors from currently playing Spotify cover art image
    data:
      entity_id: media_player.spotifyplus_todd_l
      color_count: 64
      color_quality: 5
    response_variable: vibe_colors
  - action: light.turn_on
    alias: Change Hue light color to vibrant color value
    data:
      entity_id: light.office
      brightness_pct: 100
      rgb_color: "{{ vibe_colors.result.vibrant.rgb }}"
mode: single

Hope it helps!

GitHub

Home Assistant integration for Spotify Player control, services, and soundtouchplus integration support. - thlucas1/homeassistantcomponent_spotifyplus

#

Another approach is to use the SpotifyPlus integration Turn On and Turn Off configuration options that can execute a script when the player is powered on / off respectively. Then it's a simple matter of creating a script to turn on the amp, and another to turn off the amp.

GitHub

Home Assistant integration for Spotify Player control, services, and soundtouchplus integration support. - thlucas1/homeassistantcomponent_spotifyplus

magic drum
#

i will give this a try thank you !

magic drum
#

so i tried this, but the spotify plus component has no "playing device" enitity.

#

that would turn on my amp even if i listening to music on the go

#

but apperently its in the diagnostic data

#

nvm

#

got it working

#

THANK YOU !