267 lines
9.3 KiB
YAML
267 lines
9.3 KiB
YAML
# SpotifyPlus + Hue lysshow pr. værelse.
|
|
# Baseret på thlucas1's "SpotifyPlus Hue Lightshow"-blueprint:
|
|
# https://github.com/thlucas1/homeassistant_blueprints/blob/master/spotifyplus/spotifyplus_hue_lightshow.md
|
|
#
|
|
# SpotifyPlus konfigureret 10/9 2026 — entity: media_player.spotifyplus_claus_dethlefsen
|
|
|
|
- id: lightshow_andreas
|
|
alias: "Lysshow: Andreas"
|
|
description: Synkroniserer Hue-lys med Spotify-albumcover (SpotifyPlus)
|
|
mode: restart
|
|
max_exceeded: silent
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: input_boolean.lightshow_andreas
|
|
to: "on"
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
attribute: media_content_id
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
to: playing
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_andreas
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
actions:
|
|
- variables:
|
|
media_player_entity: media_player.spotifyplus_claus_dethlefsen
|
|
lights:
|
|
- light.andreas_lysstrip
|
|
- light.andreas_stol
|
|
spotify_image_url: "{{ state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
- action: spotifyplus.get_image_palette_colors
|
|
data:
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
image_source: "{{ spotify_image_url }}"
|
|
color_count: 10
|
|
color_quality: 1
|
|
brightness_filter_low: 100
|
|
brightness_filter_high: 600
|
|
hue_distance_filter: 10
|
|
response_variable: palette_response
|
|
- variables:
|
|
colors_rgb: "{{ palette_response['result']['items'][:6] | map(attribute='rgb') | list }}"
|
|
- repeat:
|
|
while:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_andreas
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
- condition: template
|
|
value_template: "{{ spotify_image_url == state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
sequence:
|
|
- repeat:
|
|
count: "{{ colors_rgb | count }}"
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: "{{ lights }}"
|
|
data:
|
|
rgb_color: "{{ colors_rgb[repeat.index - 1] }}"
|
|
brightness_pct: 100
|
|
transition: 2
|
|
- delay: "00:00:02"
|
|
|
|
- id: lightshow_daniel
|
|
alias: "Lysshow: Daniel"
|
|
description: Synkroniserer Hue-lys med Spotify-albumcover (SpotifyPlus)
|
|
mode: restart
|
|
max_exceeded: silent
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: input_boolean.lightshow_daniel
|
|
to: "on"
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
attribute: media_content_id
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
to: playing
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_daniel
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
actions:
|
|
- variables:
|
|
media_player_entity: media_player.spotifyplus_claus_dethlefsen
|
|
lights:
|
|
- light.daniel_lysstrip
|
|
- light.bamse
|
|
spotify_image_url: "{{ state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
- action: spotifyplus.get_image_palette_colors
|
|
data:
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
image_source: "{{ spotify_image_url }}"
|
|
color_count: 10
|
|
color_quality: 1
|
|
brightness_filter_low: 100
|
|
brightness_filter_high: 600
|
|
hue_distance_filter: 10
|
|
response_variable: palette_response
|
|
- variables:
|
|
colors_rgb: "{{ palette_response['result']['items'][:6] | map(attribute='rgb') | list }}"
|
|
- repeat:
|
|
while:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_daniel
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
- condition: template
|
|
value_template: "{{ spotify_image_url == state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
sequence:
|
|
- repeat:
|
|
count: "{{ colors_rgb | count }}"
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: "{{ lights }}"
|
|
data:
|
|
rgb_color: "{{ colors_rgb[repeat.index - 1] }}"
|
|
brightness_pct: 100
|
|
transition: 2
|
|
- delay: "00:00:02"
|
|
|
|
- id: lightshow_sovevaerelse
|
|
alias: "Lysshow: Soveværelse"
|
|
description: Synkroniserer Hue-lys med Spotify-albumcover (SpotifyPlus)
|
|
mode: restart
|
|
max_exceeded: silent
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: input_boolean.lightshow_sovevaerelse
|
|
to: "on"
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
attribute: media_content_id
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
to: playing
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_sovevaerelse
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
actions:
|
|
- variables:
|
|
media_player_entity: media_player.spotifyplus_claus_dethlefsen
|
|
lights:
|
|
- light.sov_midt
|
|
- light.sov_vindue
|
|
- light.sov_dor
|
|
- light.anne
|
|
- light.claus
|
|
spotify_image_url: "{{ state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
- action: spotifyplus.get_image_palette_colors
|
|
data:
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
image_source: "{{ spotify_image_url }}"
|
|
color_count: 10
|
|
color_quality: 1
|
|
brightness_filter_low: 100
|
|
brightness_filter_high: 600
|
|
hue_distance_filter: 10
|
|
response_variable: palette_response
|
|
- variables:
|
|
colors_rgb: "{{ palette_response['result']['items'][:6] | map(attribute='rgb') | list }}"
|
|
- repeat:
|
|
while:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_sovevaerelse
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
- condition: template
|
|
value_template: "{{ spotify_image_url == state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
sequence:
|
|
- repeat:
|
|
count: "{{ colors_rgb | count }}"
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: "{{ lights }}"
|
|
data:
|
|
rgb_color: "{{ colors_rgb[repeat.index - 1] }}"
|
|
brightness_pct: 100
|
|
transition: 2
|
|
- delay: "00:00:02"
|
|
|
|
- id: lightshow_stue
|
|
alias: "Lysshow: Stue"
|
|
description: Synkroniserer Hue-lys med Spotify-albumcover (SpotifyPlus)
|
|
mode: restart
|
|
max_exceeded: silent
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: input_boolean.lightshow_stue
|
|
to: "on"
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
attribute: media_content_id
|
|
- trigger: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
to: playing
|
|
conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_stue
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
actions:
|
|
- variables:
|
|
media_player_entity: media_player.spotifyplus_claus_dethlefsen
|
|
# Kun farve-lamper (pendle1/syd/spisebord kan ikke farve)
|
|
lights:
|
|
- light.pendle2
|
|
- light.raket
|
|
- light.panton
|
|
spotify_image_url: "{{ state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
- action: spotifyplus.get_image_palette_colors
|
|
data:
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
image_source: "{{ spotify_image_url }}"
|
|
color_count: 10
|
|
color_quality: 1
|
|
brightness_filter_low: 100
|
|
brightness_filter_high: 600
|
|
hue_distance_filter: 10
|
|
response_variable: palette_response
|
|
- variables:
|
|
colors_rgb: "{{ palette_response['result']['items'][:6] | map(attribute='rgb') | list }}"
|
|
- repeat:
|
|
while:
|
|
- condition: state
|
|
entity_id: input_boolean.lightshow_stue
|
|
state: "on"
|
|
- condition: state
|
|
entity_id: media_player.spotifyplus_claus_dethlefsen
|
|
state: playing
|
|
- condition: template
|
|
value_template: "{{ spotify_image_url == state_attr(media_player_entity, 'sp_nowplaying_image_url') }}"
|
|
sequence:
|
|
- repeat:
|
|
count: "{{ colors_rgb | count }}"
|
|
sequence:
|
|
- action: light.turn_on
|
|
target:
|
|
entity_id: "{{ lights }}"
|
|
data:
|
|
rgb_color: "{{ colors_rgb[repeat.index - 1] }}"
|
|
brightness_pct: 100
|
|
transition: 2
|
|
- delay: "00:00:02"
|