Last active
October 29, 2025 19:14
-
-
Save sbyx/96c43b13b90ae1c35b872313ba1d2d2d to your computer and use it in GitHub Desktop.
Revisions
-
sbyx revised this gist
Nov 8, 2021 . 1 changed file with 17 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -102,22 +102,22 @@ variables: seconds: '{{float(sunrise_duration) * 60}}' min_mired: !input 'min_mired' start_mired: '{{state_attr(light_entity, ''max_mireds'')}}' end_mired: '{{[state_attr(light_entity, ''min_mireds'')|int(0), min_mired|int(0)]|max}}' tick_time: '{{float(seconds) / float(range_brightness)}}' check_entity: !input 'check_entity' trigger: - platform: time_pattern minutes: '*' condition: [] action: - wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}' - wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) <= float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}' - choose: [] default: !input 'pre_sunrise_actions' - condition: template value_template: '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}' - condition: template value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds) and states(check_entity) @@ -138,17 +138,18 @@ action: entity_id: !input 'light_entity' - repeat: while: - '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}' - '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}' sequence: - delay: '{{tick_time}}' - choose: - conditions: - '{{0 < state_attr(light_entity, ''brightness'') | int(0) < end_brightness | int}}' - '{{sensor == ''none'' or as_timestamp(states(sensor), None) != None}}' - '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}' sequence: - choose: - conditions: @@ -158,19 +159,21 @@ action: data: brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int(0)}}' color_temp: '{{(float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int(0)}}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int(0)}}' entity_id: !input 'light_entity' - choose: [] default: !input 'post_sunrise_actions' mode: single max_exceeded: silent -
sbyx revised this gist
Jan 13, 2021 . 1 changed file with 93 additions and 119 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,46 +1,41 @@ blueprint: name: Wake-up light alarm with sunrise effect description: 'A wake-up light alarm with a brightness and color temperature sunrise effect. Note: Requires date_time_iso sensor in configuration, not manually executable!' domain: automation input: light_entity: name: Wake-up light entity description: The light to control. Turning it off during the sunrise will keep it off. Color temperature range is auto-detected. selector: entity: domain: light timestamp_sensor: name: Alarm timestamp sensor description: 'Sensor with timestamp of next alarm with device_class: timestamp (set to ''none'' for manual alarm time)' default: none selector: entity: device_class: timestamp manual_time: name: Manual alarm time description: Time to trigger alarm every day if timestamp sensor is not set. Settings at or shortly after midnight will not work as expected! default: '7:00:00' selector: time: {} check_entity: name: Additional entity to check before sunrise is triggered description: If set, checks if entity is 'on' or 'home' before triggering. Use e.g. a (workday) sensor, device_tracker or person entity. default: none selector: entity: {} sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before the timestamp. default: 25 selector: @@ -52,9 +47,9 @@ blueprint: mode: slider start_brightness: name: Minimum brightness description: The brightness to start with. Some lights ignore very low values and may turn on with full brightness instead! default: 1 selector: number: min: 1.0 @@ -63,19 +58,18 @@ blueprint: mode: slider end_brightness: name: Maximum brightness description: The brightness will be transitioned from the minimum to the configured value. default: 254 selector: number: min: 5.0 max: 255.0 step: 1.0 mode: slider min_mired: name: Minimum color temperature description: 'The minimum color temperature to use. (0: lowest supported)' default: 0 selector: number: @@ -86,117 +80,97 @@ blueprint: unit_of_measurement: mired pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. default: [] selector: action: {} post_sunrise_actions: name: Post-sunrise actions description: Optional actions to run after sunrise ends (around the alarm time). default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d variables: light_entity: !input 'light_entity' sensor: !input 'timestamp_sensor' sunrise_duration: !input 'sunrise_duration' start_brightness: !input 'start_brightness' end_brightness: !input 'end_brightness' range_brightness: '{{float(end_brightness)-float(start_brightness)}}' manual_time: !input 'manual_time' seconds: '{{float(sunrise_duration) * 60}}' min_mired: !input 'min_mired' start_mired: '{{state_attr(light_entity, ''max_mireds'')}}' end_mired: '{{[state_attr(light_entity, ''min_mireds'')|int, min_mired|int]|max}}' tick_time: '{{float(seconds) / float(range_brightness)}}' check_entity: !input 'check_entity' trigger: - platform: time_pattern minutes: '*' condition: [] action: - wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) <= float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}' - choose: [] default: !input 'pre_sunrise_actions' - condition: template value_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - condition: template value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}' - choose: - conditions: - '{{state_attr(light_entity, ''min_mireds'') != None}}' sequence: - service: light.turn_on data: brightness: '{{start_brightness}}' color_temp: '{{start_mired}}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: '{{start_brightness}}' entity_id: !input 'light_entity' - repeat: while: - '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}' sequence: - delay: '{{tick_time}}' - choose: - conditions: - '{{0 < state_attr(light_entity, ''brightness'') | int < end_brightness | int}}' - '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) <= float(seconds)}}' sequence: - choose: - conditions: - '{{state_attr(light_entity, ''min_mireds'') != None}}' sequence: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' color_temp: '{{(float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' entity_id: !input 'light_entity' - choose: [] default: !input 'post_sunrise_actions' mode: single max_exceeded: silent -
sbyx revised this gist
Jan 12, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -197,6 +197,6 @@ action: - as_timestamp(now())) / float(seconds))) | int}}" entity_id: !input "light_entity" - choose: [] default: !input "post_sunrise_actions" mode: single max_exceeded: silent -
sbyx revised this gist
Jan 12, 2021 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -91,6 +91,13 @@ blueprint: default: [] selector: action: {} post_sunrise_actions: name: Post-sunrise actions description: Optional actions to run after sunrise ends (around the alarm time). default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d variables: light_entity: !input "light_entity" @@ -189,5 +196,7 @@ action: if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}" entity_id: !input "light_entity" - choose: [] default: !input "pre_sunrise_actions" mode: single max_exceeded: silent -
sbyx revised this gist
Jan 10, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -32,8 +32,8 @@ blueprint: time: {} check_entity: name: Additional entity to check before sunrise is triggered description: "If set, checks if entity is 'on' or 'home' before triggering. Use e.g. a (workday) sensor, device_tracker or person entity." default: none selector: entity: -
sbyx revised this gist
Jan 10, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -113,8 +113,8 @@ condition: [] action: - wait_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}' - choose: [] default: !input "pre_sunrise_actions" - condition: template -
sbyx revised this gist
Jan 10, 2021 . 1 changed file with 15 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,6 +30,13 @@ blueprint: default: "7:00:00" selector: time: {} check_entity: name: Additional entity to check before sunrise is triggered description: "If set, checks if entity is 'on' or 'home' before triggering to use e.g. with (workday) sensor, device_tracker or person." default: none selector: entity: sunrise_duration: name: Sunrise duration description: @@ -80,8 +87,7 @@ blueprint: pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. default: [] selector: action: {} @@ -99,23 +105,24 @@ variables: start_mired: "{{state_attr(light_entity, 'max_mireds')}}" end_mired: "{{[state_attr(light_entity, 'min_mireds') | int, min_mired | int] | max}}" tick_time: "{{float(seconds) / float(range_brightness)}}" check_entity: !input "check_entity" trigger: - platform: time_pattern minutes: "*" condition: [] action: - wait_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}' - choose: [] default: !input "pre_sunrise_actions" - condition: template value_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - condition: template value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds) and states(check_entity) in [''unknown'', ''on'', ''home'']}}' - choose: - conditions: - condition: template -
sbyx revised this gist
Jan 8, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -97,7 +97,7 @@ variables: seconds: "{{float(sunrise_duration) * 60}}" min_mired: !input "min_mired" start_mired: "{{state_attr(light_entity, 'max_mireds')}}" end_mired: "{{[state_attr(light_entity, 'min_mireds') | int, min_mired | int] | max}}" tick_time: "{{float(seconds) / float(range_brightness)}}" trigger: - platform: time_pattern -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -98,7 +98,7 @@ variables: min_mired: !input "min_mired" start_mired: "{{state_attr(light_entity, 'max_mireds')}}" end_mired: "{{[state_attr(light_entity, 'min_mireds'), min_mired | int] | max}}" tick_time: "{{float(seconds) / float(range_brightness)}}" trigger: - platform: time_pattern minutes: "*" -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -46,7 +46,7 @@ blueprint: start_brightness: name: Minimum brightness description: The brightness to start with. Some lights ignore very low values and may turn on with full brightness instead! default: 2 selector: number: -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -45,8 +45,8 @@ blueprint: mode: slider start_brightness: name: Minimum brightness description: The brightness to start with. Some lights ignore very low brightness values and may turn on with full brightness instead! default: 2 selector: number: -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 113 additions and 95 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,39 @@ blueprint: name: Wake-up light alarm with sunrise effect description: "A wake-up light alarm with a brightness and color temperature sunrise effect. Note: Requires date_time_iso sensor in configuration, not manually executable!" domain: automation input: light_entity: name: Wake-up light entity description: The light to control. Turning it off during the sunrise will keep it off. Color temperature range is auto-detected. selector: entity: domain: light timestamp_sensor: name: Alarm timestamp sensor description: "Sensor with timestamp of next alarm with device_class: timestamp (set to 'none' for manual alarm time)" default: none selector: entity: device_class: timestamp manual_time: name: Manual alarm time description: Time to trigger alarm every day if timestamp sensor is not set. Settings at or shortly after midnight will not work as expected! default: "7:00:00" selector: time: {} sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before the timestamp. default: 25 selector: @@ -40,7 +45,8 @@ blueprint: mode: slider start_brightness: name: Minimum brightness description: The brightness to start with. Note that some lights ignore very low brightness values and may turn on with full brightness instead. default: 2 selector: number: @@ -50,7 +56,9 @@ blueprint: mode: slider end_brightness: name: Maximum brightness description: The brightness will be transitioned from the minimum to the configured value. default: 255 selector: number: @@ -60,109 +68,119 @@ blueprint: mode: slider min_mired: name: Minimum color temperature description: "The minimum color temperature to use. (0: lowest supported)" default: 0 selector: number: min: 0.0 max: 500.0 step: 5.0 mode: slider unit_of_measurement: mired pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. Wait-Actions may be used to define additional alarm conditions. default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d variables: light_entity: !input "light_entity" sensor: !input "timestamp_sensor" sunrise_duration: !input "sunrise_duration" start_brightness: !input "start_brightness" end_brightness: !input "end_brightness" range_brightness: "{{float(end_brightness)-float(start_brightness)}}" manual_time: !input "manual_time" seconds: "{{float(sunrise_duration) * 60}}" min_mired: !input "min_mired" start_mired: "{{state_attr(light_entity, 'max_mireds')}}" end_mired: "{{[state_attr(light_entity, 'min_mireds'), min_mired | int] | max}}" tick_time: "{{(float(seconds) / 255) * (255 / float(end_brightness))}}" trigger: - platform: time_pattern minutes: "*" condition: [] action: - wait_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - wait_template: "{{0 < as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(states('sensor.date_time_iso')) < float(seconds)}}" - choose: [] default: !input "pre_sunrise_actions" - condition: template value_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - condition: template value_template: "{{0 < as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now()) < float(seconds)}}" - choose: - conditions: - condition: template value_template: "{{state_attr(light_entity, 'min_mireds') != None}}" sequence: - service: light.turn_on data: brightness: "{{start_brightness}}" color_temp: "{{start_mired}}" entity_id: !input "light_entity" default: - service: light.turn_on data: brightness: "{{start_brightness}}" entity_id: !input "light_entity" - repeat: while: - condition: template value_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - condition: template value_template: "{{0 < as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now()) < float(seconds)}}" sequence: - delay: "{{tick_time}}" - choose: - conditions: - condition: state entity_id: !input "light_entity" state: "on" - condition: template value_template: "{{sensor == 'none' or as_timestamp(states(sensor)) != None}}" - condition: template value_template: "{{0 < as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now()) < float(seconds)}}" sequence: - choose: - conditions: - condition: template value_template: "{{state_attr(light_entity, 'min_mireds') != None}}" sequence: - service: light.turn_on data: brightness: "{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}" color_temp: "{{(float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}" entity_id: !input "light_entity" default: - service: light.turn_on data: brightness: "{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != 'none' else states('sensor.date') ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}" entity_id: !input "light_entity" mode: single max_exceeded: silent -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -88,7 +88,7 @@ variables: seconds: '{{float(sunrise_duration) * 60}}' min_mired: !input 'min_mired' start_mired: '{{state_attr(light_entity, ''max_mireds'')}}' end_mired: '{{[state_attr(light_entity, ''min_mireds''), min_mired | int] | max}}' tick_time: '{{(float(seconds) / 255) * (255 / float(end_brightness))}}' trigger: - platform: time_pattern -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,7 @@ blueprint: mode: slider end_brightness: name: Maximum brightness description: The brightness will be transitioned from the minimum to the configured value. default: 255 selector: number: -
sbyx revised this gist
Jan 6, 2021 . 1 changed file with 29 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -38,6 +38,16 @@ blueprint: step: 5.0 unit_of_measurement: min mode: slider start_brightness: name: Minimum brightness description: The brightness to start with. default: 2 selector: number: min: 1.0 max: 255.0 step: 1.0 mode: slider end_brightness: name: Maximum brightness description: The brightness will be transitioned from 1 to the configured value. @@ -48,6 +58,17 @@ blueprint: max: 255.0 step: 5.0 mode: slider min_mired: name: Minimum color temperature description: 'The minimum color temperature to use. (0: lowest supported)' default: 0 selector: number: min: 0 max: 500 step: 5 mode: slider unit_of_measurement: mired pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. Wait-Actions may @@ -60,11 +81,14 @@ variables: light_entity: !input 'light_entity' sensor: !input 'timestamp_sensor' sunrise_duration: !input 'sunrise_duration' start_brightness: !input 'start_brightness' end_brightness: !input 'end_brightness' range_brightness: '{{float(end_brightness)-float(start_brightness)}}' manual_time: !input 'manual_time' seconds: '{{float(sunrise_duration) * 60}}' min_mired: !input 'min_mired' start_mired: '{{state_attr(light_entity, ''max_mireds'')}}' end_mired: '{{[state_attr(light_entity, ''min_mireds''), min_mired] | max}}' tick_time: '{{(float(seconds) / 255) * (255 / float(end_brightness))}}' trigger: - platform: time_pattern @@ -90,13 +114,13 @@ action: sequence: - service: light.turn_on data: brightness: '{{start_brightness}}' color_temp: '{{start_mired}}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: '{{start_brightness}}' entity_id: !input 'light_entity' - repeat: while: @@ -126,7 +150,7 @@ action: sequence: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' color_temp: '{{(float(end_mired) + (float(start_mired) - float(end_mired)) @@ -136,7 +160,7 @@ action: default: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(range_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' entity_id: !input 'light_entity' -
sbyx revised this gist
Jan 1, 2021 . 1 changed file with 86 additions and 99 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,34 @@ blueprint: name: Wake-up light alarm with sunrise effect description: 'A wake-up light alarm with a brightness and color temperature sunrise effect. Note: Requires date_time_iso sensor in configuration, not manually executable!' domain: automation input: light_entity: name: Wake-up light entity description: The light to control. Turning it off during the sunrise will keep it off. Color temperature range is auto-detected. selector: entity: domain: light timestamp_sensor: name: Alarm timestamp sensor description: 'Sensor with timestamp of next alarm with device_class: timestamp (set to ''none'' for manual alarm time)' default: none selector: entity: device_class: timestamp manual_time: name: Manual alarm time description: Time to trigger alarm every day if timestamp sensor is not set. Settings at or shortly after midnight will not work as expected! default: '7:00:00' selector: time: {} sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before the timestamp. default: 25 selector: @@ -55,103 +50,95 @@ blueprint: mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. Wait-Actions may be used to define additional alarm conditions. default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d/ variables: light_entity: !input 'light_entity' sensor: !input 'timestamp_sensor' sunrise_duration: !input 'sunrise_duration' end_brightness: !input 'end_brightness' manual_time: !input 'manual_time' seconds: '{{float(sunrise_duration) * 60}}' start_mired: '{{state_attr(light_entity, ''max_mireds'')}}' end_mired: '{{state_attr(light_entity, ''min_mireds'')}}' tick_time: '{{(float(seconds) / 255) * (255 / float(end_brightness))}}' trigger: - platform: time_pattern minutes: '*' condition: [] action: - wait_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - wait_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < float(seconds)}}' - choose: [] default: !input 'pre_sunrise_actions' - condition: template value_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - condition: template value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds)}}' - choose: - conditions: - condition: template value_template: '{{state_attr(light_entity, ''min_mireds'') != None}}' sequence: - service: light.turn_on data: brightness: 1 color_temp: '{{start_mired}}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: 1 entity_id: !input 'light_entity' - repeat: while: - condition: template value_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - condition: template value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds)}}' sequence: - delay: '{{tick_time}}' - choose: - conditions: - condition: state entity_id: !input 'light_entity' state: 'on' - condition: template value_template: '{{sensor == ''none'' or as_timestamp(states(sensor)) != None}}' - condition: template value_template: '{{0 < as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds)}}' sequence: - choose: - conditions: - condition: template value_template: '{{state_attr(light_entity, ''min_mireds'') != None}}' sequence: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(end_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' color_temp: '{{(float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: '{{(float(end_brightness) - (float(end_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else states(''sensor.date'') ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int}}' entity_id: !input 'light_entity' mode: single max_exceeded: silent -
sbyx revised this gist
Dec 31, 2020 . 1 changed file with 99 additions and 87 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,39 @@ blueprint: name: Wake-up light alarm with sunrise effect description: "A wake-up light alarm with a brightness and color temperature sunrise effect. Note: Requires date_time_iso sensor in configuration, not manually executable!" domain: automation input: light_entity: name: Wake-up light entity description: The light to control. Turning it off during the sunrise will keep it off. Color temperature range is auto-detected. selector: entity: domain: light timestamp_sensor: name: Alarm timestamp sensor description: "Sensor with timestamp of next alarm with device_class: timestamp (set to 'none' for manual alarm time)" default: none selector: entity: device_class: timestamp manual_time: name: Manual alarm time description: Time to trigger alarm every day if timestamp sensor is not set. Settings at or shortly after midnight will not work as expected! default: "7:00:00" selector: time: {} sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before the timestamp. default: 25 selector: @@ -50,96 +55,103 @@ blueprint: mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. Wait-Actions may be used to define additional alarm conditions. default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d variables: light_entity: !input "light_entity" sensor: !input "timestamp_sensor" sunrise_duration: !input "sunrise_duration" end_brightness: !input "end_brightness" manual_time: !input "manual_time" seconds: "{{ float(sunrise_duration) * 60 }}" start_mired: "{{ state_attr(light_entity, 'max_mireds') }}" end_mired: "{{ state_attr(light_entity, 'min_mireds') }}" tick_time: "{{ (float(seconds) / 255) * (255 / float(end_brightness)) }}" trigger: - platform: time_pattern minutes: "*" condition: [] action: - wait_template: "{{ sensor == 'none' or as_timestamp(states(sensor)) != None }}" - wait_template: "{{ 0 < as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(states('sensor.date_time_iso')) < float(seconds) }}" - choose: [] default: !input "pre_sunrise_actions" - condition: template value_template: "{{ sensor == 'none' or as_timestamp(states(sensor)) != None }}" - condition: template value_template: "{{ 0 < as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(now()) < float(seconds) }}" - choose: - conditions: - condition: template value_template: "{{ state_attr(light_entity, 'min_mireds') != None }}" sequence: - service: light.turn_on data: brightness: 1 color_temp: "{{ start_mired }}" entity_id: !input "light_entity" default: - service: light.turn_on data: brightness: 1 entity_id: !input "light_entity" - repeat: while: - condition: template value_template: "{{ sensor == 'none' or as_timestamp(states(sensor)) != None }}" - condition: template value_template: "{{ 0 < as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(now()) < float(seconds) }}" sequence: - delay: "{{ tick_time }}" - choose: - conditions: - condition: state entity_id: !input "light_entity" state: "on" - condition: template value_template: "{{ sensor == 'none' or as_timestamp(states(sensor)) != None }}" - condition: template value_template: "{{ 0 < as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(now()) < float(seconds) }}" sequence: - choose: - conditions: - condition: template value_template: "{{ state_attr(light_entity, 'min_mireds') != None }}" sequence: - service: light.turn_on data: brightness: "{{ (float(end_brightness) - (float(end_brightness) * (as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int }}" color_temp: "{{ (float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int }}" entity_id: !input "light_entity" default: - service: light.turn_on data: brightness: "{{ (float(end_brightness) - (float(end_brightness) * (as_timestamp(states(sensor) if sensor != 'none' else now().date() ~ ' ' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int }}" entity_id: !input "light_entity" mode: single max_exceeded: silent -
sbyx revised this gist
Dec 28, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ blueprint: name: Manual alarm time description: Time to trigger alarm every day if timestamp sensor is not set. Settings at or shortly after midnight will not work as expected! default: '7:00:00' selector: time: {} sunrise_duration: -
sbyx revised this gist
Dec 19, 2020 . 1 changed file with 42 additions and 59 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,7 @@ blueprint: name: Wake-up light alarm with sunrise effect description: 'A wake-up light alarm with a brightness and color temperature sunrise effect. Note: Requires date_time_iso sensor in configuration, not manually executable!' domain: automation input: light_entity: @@ -22,8 +21,9 @@ blueprint: device_class: timestamp manual_time: name: Manual alarm time description: Time to trigger alarm every day if timestamp sensor is not set. Settings at or shortly after midnight will not work as expected! default: 7:00:00 selector: time: {} sunrise_duration: @@ -38,63 +38,58 @@ blueprint: step: 5.0 unit_of_measurement: min mode: slider end_brightness: name: Maximum brightness description: The brightness will be transitioned from 1 to the configured value. default: 255 selector: number: min: 5.0 max: 255.0 step: 5.0 mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. Wait-Actions may be used to define additional alarm conditions. default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d variables: light_entity: !input 'light_entity' sensor: !input 'timestamp_sensor' sunrise_duration: !input 'sunrise_duration' end_brightness: !input 'end_brightness' manual_time: !input 'manual_time' seconds: '{{ float(sunrise_duration) * 60 }}' start_mired: '{{ state_attr(light_entity, ''max_mireds'') }}' end_mired: '{{ state_attr(light_entity, ''min_mireds'') }}' tick_time: '{{ (float(seconds) / 255) * (255 / float(end_brightness)) }}' trigger: - platform: time_pattern minutes: '*' condition: [] action: - wait_template: '{{ sensor == ''none'' or as_timestamp(states(sensor)) != None }}' - wait_template: '{{ 0 < as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < float(seconds) }}' - choose: [] default: !input 'pre_sunrise_actions' - condition: template value_template: '{{ sensor == ''none'' or as_timestamp(states(sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds) }}' - choose: - conditions: - condition: template value_template: '{{ state_attr(light_entity, ''min_mireds'') != None }}' sequence: - service: light.turn_on data: brightness: 1 color_temp: '{{ start_mired }}' entity_id: !input 'light_entity' default: @@ -105,13 +100,10 @@ action: - repeat: while: - condition: template value_template: '{{ sensor == ''none'' or as_timestamp(states(sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds) }}' sequence: - delay: '{{ tick_time }}' - choose: @@ -120,43 +112,34 @@ action: entity_id: !input 'light_entity' state: 'on' - condition: template value_template: '{{ sensor == ''none'' or as_timestamp(states(sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(now()) < float(seconds) }}' sequence: - choose: - conditions: - condition: template value_template: '{{ state_attr(light_entity, ''min_mireds'') != None }}' sequence: - service: light.turn_on data: brightness: '{{ (float(end_brightness) - (float(end_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int }}' color_temp: '{{ (float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int }}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness: '{{ (float(end_brightness) - (float(end_brightness) * (as_timestamp(states(sensor) if sensor != ''none'' else now().date() ~ '' '' ~ manual_time) - as_timestamp(now())) / float(seconds))) | int }}' entity_id: !input 'light_entity' mode: single max_exceeded: silent -
sbyx revised this gist
Dec 18, 2020 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,8 +22,7 @@ blueprint: device_class: timestamp manual_time: name: Manual alarm time description: Manual alarm time. (ignored if alarm timestamp sensor is set) default: 0:00:00 selector: time: {} -
sbyx revised this gist
Dec 18, 2020 . 1 changed file with 45 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,17 +14,19 @@ blueprint: domain: light timestamp_sensor: name: Alarm timestamp sensor description: 'Sensor with timestamp of next alarm with device_class: timestamp (set to ''none'' for manual alarm time)' default: none selector: entity: device_class: timestamp manual_time: name: Manual alarm time description: Manual alarm time. (ignored if alarm timestamp sensor is set, requires 'date' sensor in config) default: 0:00:00 selector: time: {} sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before @@ -50,7 +52,8 @@ blueprint: mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: Optional actions to run before sunrise starts. (use 'wait' for additional conditions) default: [] selector: action: {} @@ -69,11 +72,22 @@ trigger: minutes: '*' condition: [] action: - wait_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - wait_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' - choose: [] default: !input 'pre_sunrise_actions' - condition: template value_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' - choose: - conditions: - condition: template @@ -92,10 +106,13 @@ action: - repeat: while: - condition: template value_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - delay: '{{ tick_time }}' - choose: @@ -104,9 +121,12 @@ action: entity_id: !input 'light_entity' state: 'on' - condition: template value_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - choose: @@ -118,19 +138,25 @@ action: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' color_temp: '{{ (float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' mode: single -
sbyx revised this gist
Dec 17, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ blueprint: device_class: timestamp manual_time: name: Manual alarm time description: 'Manual alarm time. (ignored if alarm timestamp sensor is set, requires ''date'' sensor in config)' default: '0:00:00' selector: time: -
sbyx revised this gist
Dec 17, 2020 . 1 changed file with 27 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,11 +14,17 @@ blueprint: domain: light timestamp_sensor: name: Alarm timestamp sensor description: 'Sensor with timestamp of next alarm with device_class: timestamp (set to ''none'' for manual alarm time)' default: none selector: entity: device_class: timestamp manual_time: name: Manual alarm time description: 'Manual alarm time. (ignored if alarm timestamp sensor is set)' default: '0:00:00' selector: time: sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before @@ -44,7 +50,7 @@ blueprint: mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: 'Optional actions to run before sunrise starts. (use ''wait'' for additional conditions)' default: [] selector: action: {} @@ -54,6 +60,7 @@ variables: timestamp_sensor: !input 'timestamp_sensor' sunrise_duration: !input 'sunrise_duration' max_brightness: !input 'max_brightness' manual_time: !input 'manual_time' start_mired: '{{ state_attr(light_entity, ''max_mireds'') }}' end_mired: '{{ state_attr(light_entity, ''min_mireds'') }}' tick_time: '{{ float(sunrise_duration) * 0.6 * (100 / float(max_brightness)) }}' @@ -62,8 +69,8 @@ trigger: minutes: '*' condition: [] action: - wait_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - wait_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' - choose: [] default: !input 'pre_sunrise_actions' @@ -85,9 +92,9 @@ action: - repeat: while: - condition: template value_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - delay: '{{ tick_time }}' @@ -97,32 +104,33 @@ action: entity_id: !input 'light_entity' state: 'on' - condition: template value_template: '{{ timestamp_sensor == ''none'' or as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - choose: - conditions: - condition: template value_template: '{{ state_attr(light_entity, ''min_mireds'') != None }}' sequence: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' color_temp: '{{ (float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor) if timestamp_sensor != ''none'' else now().year ~ ''-'' ~ now().month ~ ''-'' ~ now().day ~ '' '' ~ manual_time) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' mode: single -
sbyx revised this gist
Dec 16, 2020 . 1 changed file with 43 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -44,8 +44,8 @@ blueprint: mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: Actions to run before sunrise starts. (optional) default: [] selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d @@ -67,11 +67,21 @@ action: < 60 * float(sunrise_duration) }}' - choose: [] default: !input 'pre_sunrise_actions' - choose: - conditions: - condition: template value_template: '{{ state_attr(light_entity, ''min_mireds'') != None }}' sequence: - service: light.turn_on data: brightness_pct: 1 color_temp: '{{ start_mired }}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness_pct: 1 entity_id: !input 'light_entity' - repeat: while: - condition: template @@ -86,19 +96,34 @@ action: - condition: state entity_id: !input 'light_entity' state: 'on' - condition: template value_template: '{{ as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor)) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - choose: - conditions: - condition: template value_template: '{{ state_attr(light_entity, ''min_mireds'') != None }}' sequence: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor)) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' color_temp: '{{ (float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(timestamp_sensor)) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' default: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor)) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' mode: single max_exceeded: silent -
sbyx revised this gist
Dec 16, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -101,4 +101,4 @@ action: transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' mode: single max_exceeded: silent -
sbyx revised this gist
Dec 16, 2020 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,8 +21,8 @@ blueprint: device_class: timestamp sunrise_duration: name: Sunrise duration description: The sunrise will start the configured number of minutes before the timestamp. default: 25 selector: number: @@ -33,8 +33,7 @@ blueprint: mode: slider max_brightness: name: Maximum brightness description: The brightness will be transitioned from 1% to the configured percentage. default: 100 selector: number: @@ -87,6 +86,9 @@ action: - condition: state entity_id: !input 'light_entity' state: 'on' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor)) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - service: light.turn_on data: @@ -99,4 +101,4 @@ action: transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' mode: single max_exceeded: silent -
sbyx revised this gist
Dec 16, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -81,7 +81,7 @@ action: value_template: '{{ 0 < as_timestamp(states(timestamp_sensor)) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - delay: '{{ tick_time }}' - choose: - conditions: - condition: state -
sbyx revised this gist
Dec 15, 2020 . 1 changed file with 68 additions and 64 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,98 +1,102 @@ blueprint: name: Wake-up light alarm with sunrise effect description: A wake-up light alarm with a brightness and color temperature sunrise effect using an existing timestamp sensor as source. Requires date_time_iso sensor in configuration! domain: automation input: light_entity: name: Wake-up light entity description: The light to control. Turning it off during the sunrise will keep it off. Color temperature range is auto-detected. selector: entity: domain: light timestamp_sensor: name: Alarm timestamp sensor description: 'Sensor with timestamp of next alarm (e.g. _next_alarm from companion app). Requires device_class: timestamp!' selector: entity: device_class: timestamp sunrise_duration: name: Sunrise duration description: 'The sunrise will start the configured number of minutes before the timestamp.' default: 25 selector: number: min: 5.0 max: 60.0 step: 5.0 unit_of_measurement: min mode: slider max_brightness: name: Maximum brightness description: 'The brightness will be transitioned from 1% to the configured percentage.' default: 100 selector: number: min: 5.0 max: 100.0 step: 1.0 unit_of_measurement: '%' mode: slider pre_sunrise_actions: name: Pre-sunrise actions description: Actions to run before sunrise starts (set e.g. a Delay with value 00:00:00 if you don't want to do anything) selector: action: {} source_url: https://gist.github.com/sbyx/96c43b13b90ae1c35b872313ba1d2d2d variables: light_entity: !input 'light_entity' timestamp_sensor: !input 'timestamp_sensor' sunrise_duration: !input 'sunrise_duration' max_brightness: !input 'max_brightness' start_mired: '{{ state_attr(light_entity, ''max_mireds'') }}' end_mired: '{{ state_attr(light_entity, ''min_mireds'') }}' tick_time: '{{ float(sunrise_duration) * 0.6 * (100 / float(max_brightness)) }}' trigger: - platform: time_pattern minutes: '*' condition: [] action: - wait_template: '{{ as_timestamp(states(timestamp_sensor)) != None }}' - wait_template: '{{ 0 < as_timestamp(states(timestamp_sensor)) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' - choose: [] default: !input 'pre_sunrise_actions' - service: light.turn_on data: brightness_pct: 1 color_temp: '{{ start_mired }}' entity_id: !input 'light_entity' - repeat: while: - condition: template value_template: '{{ as_timestamp(states(timestamp_sensor)) != None }}' - condition: template value_template: '{{ 0 < as_timestamp(states(timestamp_sensor)) - as_timestamp(states(''sensor.date_time_iso'')) < 60 * float(sunrise_duration) }}' sequence: - delay: '{{ tick_time | int }}' - choose: - conditions: - condition: state entity_id: !input 'light_entity' state: 'on' sequence: - service: light.turn_on data: brightness_pct: '{{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor)) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' color_temp: '{{ (float(end_mired) + (float(start_mired) - float(end_mired)) * ((as_timestamp(states(timestamp_sensor)) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}' transition: '{{ tick_time | int }}' entity_id: !input 'light_entity' mode: single max_exceeded: silent -
sbyx revised this gist
Dec 15, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ blueprint: min: 5 max: 100 step: 1 unit_of_measurement: '%' pre_sunrise_actions: name: Pre-sunrise actions description: "Actions to run before sunrise starts (set e.g. a Delay with value 00:00:00 if you don't want to do anything)" -
sbyx revised this gist
Dec 15, 2020 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -24,6 +24,15 @@ blueprint: max: 60 step: 5 unit_of_measurement: min max_brightness: name: Maximum brightness description: 'The brightness will be transitioned from 1% to the configured percentage. (suggestion: 100)' selector: number: min: 5 max: 100 step: 1 unit_of_measurement: % pre_sunrise_actions: name: Pre-sunrise actions description: "Actions to run before sunrise starts (set e.g. a Delay with value 00:00:00 if you don't want to do anything)" @@ -34,6 +43,7 @@ variables: light_entity: !input light_entity timestamp_sensor: !input timestamp_sensor sunrise_duration: !input sunrise_duration max_brightness: !input max_brightness start_mired: "{{ state_attr(light_entity, 'max_mireds') }}" end_mired: "{{ state_attr(light_entity, 'min_mireds') }}" @@ -74,7 +84,7 @@ action: - service: light.turn_on data: brightness_pct: >- {{ (float(max_brightness) - (float(max_brightness) * (as_timestamp(states(timestamp_sensor)) - as_timestamp(now())) / (float(sunrise_duration) * 60))) | int }}
NewerOlder