Skip to content

Instantly share code, notes, and snippets.

@thomasloven
Last active October 31, 2020 09:02
Show Gist options
  • Save thomasloven/21f533cb73912b95b11035f0f21500d8 to your computer and use it in GitHub Desktop.
Save thomasloven/21f533cb73912b95b11035f0f21500d8 to your computer and use it in GitHub Desktop.
alias: Aurora Borealis
sequence:
- variables:
light: {{light | default(light.default_lamp) }}
start_time: '{{ now() | as_timestamp }}'
hue_lim:
- 120
- 290
wavelength: 30
amplitude: '{{(hue_lim[1] - hue_lim[0])/2}}'
- repeat:
while:
- condition: template
value_template: '{{ true }}'
sequence:
- variables:
offset: "{{ (now() | as_timestamp) - (start_time | float) }}"
hue: >-
{{ sin(offset/wavelength*2*3.14)*amplitude + amplitude +
hue_lim[0]}}
- service: light.turn_on
data:
hs_color: '{{ [hue|float, 100] }}'
transition: 1
entity_id: '{{ light }}'
- delay: '1'
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment