mirror of
https://github.com/steku/ha_cercadian_alarm.git
synced 2025-04-19 01:30:19 +00:00
trying script blueprint
This commit is contained in:
parent
7c28897c56
commit
9bb6e5d5ca
@ -71,18 +71,18 @@ blueprint:
|
|||||||
default: 5
|
default: 5
|
||||||
name: Light Timeout
|
name: Light Timeout
|
||||||
variables:
|
variables:
|
||||||
steps: !input alarm_length * !input steps_per_minute
|
steps: !input 'alarm_length' * !input 'steps_per_minute'
|
||||||
min_brightness: |-
|
min_brightness: |-
|
||||||
{% if states(!input target_light) == 'off' %}
|
{% if states(!input 'target_light') == 'off' %}
|
||||||
3
|
3
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ state_attr(!input target_light, 'brightness') }}
|
{{ state_attr(!input 'target_light', 'brightness') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
max_brightness: !input max_brightness_pct * 2.55
|
max_brightness: !input 'max_brightness_pct' * 2.55
|
||||||
kelvin_step: (!input target_kelvin - !input start_kelvin) / steps
|
kelvin_step: (!input 'target_kelvin' - !input 'start_kelvin') / steps
|
||||||
bright_step: (!input max_brightness - !input min_brightness) / steps
|
bright_step: (!input 'max_brightness' - !input 'min_brightness') / steps
|
||||||
start_time: "{{ as_timestamp(now()) }}"
|
start_time: "{{ as_timestamp(now()) }}"
|
||||||
individual_step: 60 / !input steps_per_minute
|
individual_step: 60 / !input 'steps_per_minute'
|
||||||
mode: parallel
|
mode: parallel
|
||||||
sequence:
|
sequence:
|
||||||
- repeat:
|
- repeat:
|
||||||
@ -90,12 +90,12 @@ sequence:
|
|||||||
- condition: or
|
- condition: or
|
||||||
conditions:
|
conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ is_state(!input target_light, 'off') }}"
|
value_template: "{{ is_state(!input 'target_light', 'off') }}"
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ state_attr(!input target_light, 'brightness') >= max_brightness }}"
|
value_template: "{{ state_attr(!input 'target_light', 'brightness') >= max_brightness }}"
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >-
|
value_template: >-
|
||||||
{{ state_attr(!input target_light, 'color_temp_kelvin') >=
|
{{ state_attr(!input 'target_light', 'color_temp_kelvin') >=
|
||||||
target_kelvin }}
|
target_kelvin }}
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >-
|
value_template: >-
|
||||||
@ -109,31 +109,31 @@ sequence:
|
|||||||
brightness: >-
|
brightness: >-
|
||||||
{{ min_brightness + (bright_step * steps_to_now) | round(0,
|
{{ min_brightness + (bright_step * steps_to_now) | round(0,
|
||||||
'ceil') }}
|
'ceil') }}
|
||||||
kelvin: "{{ !input start_kelvin + (kelvin_step * steps_to_now) }}"
|
kelvin: "{{ !input 'start_kelvin' + (kelvin_step * steps_to_now) }}"
|
||||||
- delay:
|
- delay:
|
||||||
seconds: "{{ individual_step }}"
|
seconds: "{{ individual_step }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ is_state(!input target_light, 'on') }}"
|
value_template: "{{ is_state(!input 'target_light', 'on') }}"
|
||||||
then:
|
then:
|
||||||
- data:
|
- data:
|
||||||
brightness: "{{ brightness }}"
|
brightness: "{{ brightness }}"
|
||||||
color_temp_kelvin: "{{ kelvin }}"
|
color_temp_kelvin: "{{ kelvin }}"
|
||||||
transition: "{{ individual_step - 1 }}"
|
transition: "{{ individual_step - 1 }}"
|
||||||
target:
|
target:
|
||||||
entity_id: "{{ !input target_light }}"
|
entity_id: "{{ !input 'target_light' }}"
|
||||||
action: light.turn_on
|
action: light.turn_on
|
||||||
- if:
|
- if:
|
||||||
- condition: and
|
- condition: and
|
||||||
conditions:
|
conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ !input light_timeout != 0 }}"
|
value_template: "{{ !input 'light_timeout' != 0 }}"
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ is_state(!input target_light, 'on') }}"
|
value_template: "{{ is_state(!input 'target_light', 'on') }}"
|
||||||
then:
|
then:
|
||||||
- delay:
|
- delay:
|
||||||
minutes: "{{ !input light_timeout }}"
|
minutes: "{{ !input 'light_timeout' }}"
|
||||||
- data: {}
|
- data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: "{{ !input target_light }}"
|
entity_id: "{{ !input 'target_light' }}"
|
||||||
action: light.turn_off
|
action: light.turn_off
|
||||||
|
Loading…
x
Reference in New Issue
Block a user