# Sonos + 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 # # Coveret hentes fra Sonos-afspilleren (virker for alle konti/kilder); # SpotifyPlus bruges kun til farvepalette-analysen (get_image_palette_colors). - id: lightshow_andreas alias: "Lysshow: Andreas" description: Lys skifter mellem albumcoverets farver (Sonos Andreas) mode: restart max_exceeded: silent triggers: - trigger: state entity_id: input_boolean.lightshow_andreas to: "on" - trigger: state entity_id: media_player.andreas attribute: entity_picture - trigger: state entity_id: media_player.andreas to: playing conditions: - condition: state entity_id: input_boolean.lightshow_andreas state: "on" - condition: state entity_id: media_player.andreas state: playing - condition: template value_template: "{{ state_attr('media_player.andreas', 'entity_picture') is not none }}" actions: - variables: media_player_entity: media_player.andreas lights: - light.andreas_lysstrip - light.andreas_stol cover_url: "{{ state_attr(media_player_entity, 'entity_picture') }}" - action: spotifyplus.get_image_palette_colors data: entity_id: media_player.spotifyplus_claus_dethlefsen image_source: "{{ 'http://localhost:8123' ~ cover_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.andreas state: playing - condition: template value_template: "{{ colors_rgb | count > 0 and cover_url == state_attr(media_player_entity, 'entity_picture') }}" 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: Lys skifter mellem albumcoverets farver (Sonos Daniel) mode: restart max_exceeded: silent triggers: - trigger: state entity_id: input_boolean.lightshow_daniel to: "on" - trigger: state entity_id: media_player.daniel attribute: entity_picture - trigger: state entity_id: media_player.daniel to: playing conditions: - condition: state entity_id: input_boolean.lightshow_daniel state: "on" - condition: state entity_id: media_player.daniel state: playing - condition: template value_template: "{{ state_attr('media_player.daniel', 'entity_picture') is not none }}" actions: - variables: media_player_entity: media_player.daniel lights: - light.daniel_lysstrip - light.bamse cover_url: "{{ state_attr(media_player_entity, 'entity_picture') }}" - action: spotifyplus.get_image_palette_colors data: entity_id: media_player.spotifyplus_claus_dethlefsen image_source: "{{ 'http://localhost:8123' ~ cover_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.daniel state: playing - condition: template value_template: "{{ colors_rgb | count > 0 and cover_url == state_attr(media_player_entity, 'entity_picture') }}" 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: Lys skifter mellem albumcoverets farver (Sonos Soveværelse) mode: restart max_exceeded: silent triggers: - trigger: state entity_id: input_boolean.lightshow_sovevaerelse to: "on" - trigger: state entity_id: media_player.sovevaerelse attribute: entity_picture - trigger: state entity_id: media_player.sovevaerelse to: playing conditions: - condition: state entity_id: input_boolean.lightshow_sovevaerelse state: "on" - condition: state entity_id: media_player.sovevaerelse state: playing - condition: template value_template: "{{ state_attr('media_player.sovevaerelse', 'entity_picture') is not none }}" actions: - variables: media_player_entity: media_player.sovevaerelse lights: - light.sov_midt - light.sov_vindue - light.sov_dor - light.anne - light.claus cover_url: "{{ state_attr(media_player_entity, 'entity_picture') }}" - action: spotifyplus.get_image_palette_colors data: entity_id: media_player.spotifyplus_claus_dethlefsen image_source: "{{ 'http://localhost:8123' ~ cover_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.sovevaerelse state: playing - condition: template value_template: "{{ colors_rgb | count > 0 and cover_url == state_attr(media_player_entity, 'entity_picture') }}" 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: Lys skifter mellem albumcoverets farver (Sonos Stue) mode: restart max_exceeded: silent triggers: - trigger: state entity_id: input_boolean.lightshow_stue to: "on" - trigger: state entity_id: media_player.stue attribute: entity_picture - trigger: state entity_id: media_player.stue to: playing conditions: - condition: state entity_id: input_boolean.lightshow_stue state: "on" - condition: state entity_id: media_player.stue state: playing - condition: template value_template: "{{ state_attr('media_player.stue', 'entity_picture') is not none }}" actions: - variables: media_player_entity: media_player.stue # Kun farve-lamper (pendle1/syd/spisebord kan ikke farve) lights: - light.pendle2 - light.raket - light.panton cover_url: "{{ state_attr(media_player_entity, 'entity_picture') }}" - action: spotifyplus.get_image_palette_colors data: entity_id: media_player.spotifyplus_claus_dethlefsen image_source: "{{ 'http://localhost:8123' ~ cover_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.stue state: playing - condition: template value_template: "{{ colors_rgb | count > 0 and cover_url == state_attr(media_player_entity, 'entity_picture') }}" 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"