trying script blueprint

This commit is contained in:
Stephen Kuntz 2024-09-24 09:04:10 -04:00
parent df4e8fb24e
commit c1c7994a6b

@ -91,19 +91,18 @@ variables:
bright_step: "{{ (max_brightness - min_brightness) / steps }}" bright_step: "{{ (max_brightness - min_brightness) / steps }}"
start_time: "{{ as_timestamp(now()) }}" start_time: "{{ as_timestamp(now()) }}"
individual_step: "{{ 60 / steps_per_minute }}" individual_step: "{{ 60 / steps_per_minute }}"
mode: parallel
sequence: sequence:
- repeat: - repeat:
until: until:
- condition: or - condition: or
conditions: conditions:
- condition: template - condition: template
value_template: "{{ is_state(!input 'target_light', 'off') }}" value_template: "{{ is_state(target_light, 'off') }}"
- condition: template - condition: template
value_template: "{{ state_attr(!input 'target_light', 'brightness') >= max_brightness }}" value_template: "{{ state_attr(target_light, 'brightness') >= max_brightness }}"
- condition: template - condition: template
value_template: >- value_template: >-
{{ state_attr(!input 'target_light', 'color_temp_kelvin') >= {{ state_attr(target_light, 'color_temp_kelvin') >=
target_kelvin }} target_kelvin }}
- condition: template - condition: template
value_template: >- value_template: >-
@ -117,31 +116,32 @@ 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: "{{ 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(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: "{{ 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: "{{ light_timeout != 0 }}"
- condition: template - condition: template
value_template: "{{ is_state(!input 'target_light', 'on') }}" value_template: "{{ is_state(target_light, 'on') }}"
then: then:
- delay: - delay:
minutes: "{{ !input 'light_timeout' }}" minutes: "{{ light_timeout }}"
- data: {} - data: {}
target: target:
entity_id: "{{ !input 'target_light' }}" entity_id: "{{ target_light }}"
action: light.turn_off action: light.turn_off
mode: parallel