Created
May 27, 2021 06:54
-
-
Save elden1337/9b899089948cb2ed442195ca3f8f80f4 to your computer and use it in GitHub Desktop.
brightness helper to slowly (linear) dim the lights from 17:00 - 20:00 and then inverted exponential until 23:00. Use in automations to call light.turn_on in Home Assistant.
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
- platform: template | |
sensors: | |
lightbrightness: | |
friendly_name: 'light brightness - helper' | |
unit_of_measurement: '%' | |
value_template: > | |
{% if now().hour > 16 and now().hour < 23 %} | |
{% set timer = now().minute+((now().hour-17)*60) %} | |
{% set const = 1.01452 %} | |
{% set hourdivider = ((now().hour/20)-0.45)|round(0) %} | |
{{ 255-((45/180)*timer)+(hourdivider*(-(const**timer)+13.4)) }} | |
{% elif now().hour < 7 or now().hour == 23 %} | |
3 | |
{% else %} | |
255 | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment