Last active
January 21, 2024 03:51
-
-
Save wfurphy/288f9b3a3942fe980ab06c3ffe0582f1 to your computer and use it in GitHub Desktop.
HA Blueprint: Color Loop Light with Toggle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ::::::::: Color Loop ::::::::::::::::::::::::::::::::::::::::::::::::::::::> | |
# :: Credit @hugalafutro for inspiration and color codes | |
# :: Color Loop any light when toggled by another entity's state | |
# :: Will Furphy • https://github.com/wfurphy | |
# ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::/ | |
blueprint: | |
name: "Color Loop Light with Toggle" | |
description: "Color Loop any light when toggled by another entity's state (On/Off)." | |
domain: automation | |
source_url: https://gist.github.com/wfurphy/288f9b3a3942fe980ab06c3ffe0582f1 | |
input: | |
light_target: | |
name: Color Loop Light(s) | |
description: Choose light entities to Color Loop | |
selector: | |
entity: | |
multiple: true | |
domain: light | |
condition_item: | |
name: On/Off Toggle | |
description: "The entity used to turn the Color Loop On/Off. For example use a [Toggle Helper (`input_boolean`)](https://www.home-assistant.io/integrations/input_boolean/) so you can toggle the effect from your dashboard. Or set a [Schedule](https://www.home-assistant.io/integrations/schedule/) to only use the effect at night." | |
selector: | |
entity: | |
variables: | |
colors: "{{ [[0.217,0.077], [0.157,0.05], [0.136,0.04], [0.137,0.065],\n [0.141,0.137], | |
[0.146,0.238], [0.151,0.343], [0.157,0.457],\n [0.164,0.591], [0.17,0.703], | |
[0.172,0.747], [0.199,0.724],\n [0.269,0.665], [0.36,0.588], [0.444,0.517], | |
[0.527,0.447],\n [0.612,0.374], [0.677,0.319], [0.701,0.299], [0.667,0.284],\n | |
\ [0.581,0.245], [0.477,0.196], [0.385,0.155], [0.301,0.116], \n [0.217,0.077]] | |
}}" | |
trigger: | |
- platform: state | |
entity_id: !input condition_item | |
to: "on" | |
action: | |
- repeat: | |
sequence: | |
- service: light.turn_on | |
data_template: | |
xy_color: '{{ colors[(now().second/2.5)|round(0)] }}' | |
transition: 1 | |
target: | |
entity_id: !input light_target | |
while: | |
- condition: state | |
entity_id: !input condition_item | |
state: "on" | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment