Make more use of script variables
This commit is contained in:
@ -120,6 +120,9 @@ script:
|
|||||||
icon: mdi:lightbulb-night
|
icon: mdi:lightbulb-night
|
||||||
mode: restart
|
mode: restart
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
time: "{{ states('sensor.time') }}"
|
||||||
|
bedtime: "{{ state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: state
|
- condition: state
|
||||||
@ -131,7 +134,7 @@ script:
|
|||||||
- condition: and
|
- condition: and
|
||||||
conditions:
|
conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ states('sensor.time') < state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
|
value_template: "{{ time < bedtime }}"
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.give_me_darkness
|
entity_id: input_boolean.give_me_darkness
|
||||||
state: 'on'
|
state: 'on'
|
||||||
@ -152,7 +155,7 @@ script:
|
|||||||
- condition: and
|
- condition: and
|
||||||
conditions:
|
conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ states('sensor.time') < state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}"
|
value_template: "{{ time < bedtime }}"
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.give_me_darkness
|
entity_id: input_boolean.give_me_darkness
|
||||||
state: 'off'
|
state: 'off'
|
||||||
@ -185,10 +188,7 @@ script:
|
|||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: "{{ time >= bedtime }}"
|
||||||
{% set time = states('sensor.time') %}
|
|
||||||
{% set bedtime = state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) %}
|
|
||||||
{{ time >= bedtime }}
|
|
||||||
sequence:
|
sequence:
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
@ -231,10 +231,7 @@ script:
|
|||||||
tag: emma-climate
|
tag: emma-climate
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: "{{ time < bedtime }}"
|
||||||
{% set time = states('sensor.time') %}
|
|
||||||
{% set bedtime = state_attr('input_datetime.emma_bedtime','timestamp') | timestamp_custom('%H:%M', false) %}
|
|
||||||
{{ time < bedtime }}
|
|
||||||
sequence:
|
sequence:
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
@ -259,6 +256,13 @@ script:
|
|||||||
icon: mdi:weather-sunset-up
|
icon: mdi:weather-sunset-up
|
||||||
mode: restart
|
mode: restart
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
timestamp: "{{ ((now().hour * 60 + now().minute) * 60 ) }}"
|
||||||
|
wakeup: "{{ state_attr('input_datetime.emma_wakeup','timestamp') }}"
|
||||||
|
bedtime: "{{ state_attr('input_datetime.emma_bedtime','timestamp') }}"
|
||||||
|
- service: script.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: script.emma_bedroom_scheduling_evening
|
||||||
- choose:
|
- choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: state
|
- condition: state
|
||||||
@ -308,8 +312,7 @@ script:
|
|||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >-
|
value_template: >-
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
{{ is_state('fan.emma_air_conditioner','on') and is_state('input_boolean.hot_day','off') and timestamp < bedtime }}
|
||||||
{{ is_state('fan.emma_air_conditioner','on') and is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') }}
|
|
||||||
then:
|
then:
|
||||||
- service: script.turn_on
|
- service: script.turn_on
|
||||||
target:
|
target:
|
||||||
|
@ -299,6 +299,10 @@ script:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
- delay:
|
- delay:
|
||||||
seconds: 1
|
seconds: 1
|
||||||
|
- variables:
|
||||||
|
bedtime: "{{ state_attr('input_datetime.kallen_bedtime','timestamp') }}"
|
||||||
|
low: "{{ states('sensor.overnight_lowest_temperature') | int }}"
|
||||||
|
threshold: "{{ states('input_number.kallen_fan_threshold') | int }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.kallen_briefing_times_override
|
entity_id: input_boolean.kallen_briefing_times_override
|
||||||
@ -307,7 +311,7 @@ script:
|
|||||||
- service: input_datetime.set_datetime
|
- service: input_datetime.set_datetime
|
||||||
entity_id: input_datetime.kallen_nightly_briefing
|
entity_id: input_datetime.kallen_nightly_briefing
|
||||||
data:
|
data:
|
||||||
time: "{{ (state_attr('input_datetime.kallen_bedtime','timestamp') - 1200) | timestamp_custom('%H:%M', false) }}"
|
time: "{{ (bedtime - 1200) | timestamp_custom('%H:%M', false) }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.kallen_bedroom_climate_override
|
entity_id: input_boolean.kallen_bedroom_climate_override
|
||||||
@ -320,7 +324,7 @@ script:
|
|||||||
option: >
|
option: >
|
||||||
{% if is_state('input_boolean.kallen_overnight','on') %}
|
{% if is_state('input_boolean.kallen_overnight','on') %}
|
||||||
N/A
|
N/A
|
||||||
{% elif (states('sensor.overnight_lowest_temperature') | int) >= (states('input_number.kallen_fan_threshold') | int) %}
|
{% elif low >= threshold %}
|
||||||
Fan
|
Fan
|
||||||
{% else %}
|
{% else %}
|
||||||
White Noise
|
White Noise
|
||||||
@ -331,9 +335,9 @@ script:
|
|||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% if is_state('input_boolean.hot_day','on') %}
|
{% if is_state('input_boolean.hot_day','on') %}
|
||||||
{{ (state_attr('input_datetime.kallen_bedtime','timestamp') - 3600) | timestamp_custom('%H:%M', false) }}
|
{{ bedtime - 3600 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ state_attr('input_datetime.kallen_bedtime','timestamp') | timestamp_custom('%H:%M', false) }}
|
{{ bedtime | timestamp_custom('%H:%M', false) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
@ -344,7 +348,7 @@ script:
|
|||||||
target:
|
target:
|
||||||
entity_id: input_datetime.kallen_bedtime
|
entity_id: input_datetime.kallen_bedtime
|
||||||
data:
|
data:
|
||||||
time: "{{ (state_attr('input_datetime.kallen_bedtime','timestamp') + 3600) | timestamp_custom('%H:%M', false) }}"
|
time: "{{ bedtime + 3600 | timestamp_custom('%H:%M', false) }}"
|
||||||
- service: input_datetime.set_datetime
|
- service: input_datetime.set_datetime
|
||||||
target:
|
target:
|
||||||
entity_id: input_datetime.kallen_nightly_briefing
|
entity_id: input_datetime.kallen_nightly_briefing
|
||||||
@ -367,15 +371,22 @@ script:
|
|||||||
house_scheduling_morning:
|
house_scheduling_morning:
|
||||||
alias: 'House Scheduling Morning'
|
alias: 'House Scheduling Morning'
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
kallen_school_start: "{{ state_attr('input_datetime.kallen_school_day_start','timestamp') }}"
|
||||||
|
tina_work_start: "{{ state_attr('input_datetime.tina_workday_start','timestamp') }}"
|
||||||
|
tina_work_end: "{{ state_attr('input_datetime.tina_workday_end','timestamp') }}"
|
||||||
|
high: "{{ states('sensor.todays_high_temp') | int }}"
|
||||||
- service: input_datetime.set_datetime
|
- service: input_datetime.set_datetime
|
||||||
entity_id: input_datetime.audible_notification_on
|
entity_id: input_datetime.audible_notification_on
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% if is_state('input_boolean.kallen_school_today','on') %}
|
{% if is_state('input_boolean.kallen_school_today','on') %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 5400) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start - 5400 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
09:00
|
09:00
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
- variables:
|
||||||
|
audible_on: "{{ state_attr('input_datetime.audible_notification_on','timestamp') }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.house_briefing_times_override
|
entity_id: input_boolean.house_briefing_times_override
|
||||||
@ -389,13 +400,13 @@ script:
|
|||||||
{% if is_state('input_boolean.two_hour_delay','on') %}
|
{% if is_state('input_boolean.two_hour_delay','on') %}
|
||||||
10:20
|
10:20
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 2400) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start - 2400 | timestamp_custom('%H:%M', false) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
||||||
{% if (state_attr('input_datetime.tina_workday_start','timestamp')) > 43200 %}
|
{% if tina_work_start > 43200 %}
|
||||||
12:00
|
12:00
|
||||||
{% elif (state_attr('input_datetime.tina_workday_start','timestamp') - 1500 ) > (state_attr('input_datetime.audible_notification_on','timestamp')) %}
|
{% elif (tina_work_start - 1500) > audible_on %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start', 'timestamp') - 1500) | timestamp_custom('%H:%M', false) }}
|
{{ tina_work_start - 1500 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
10:00
|
10:00
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -415,15 +426,15 @@ script:
|
|||||||
{% elif is_state('input_boolean.kallen_school_today','off') and is_state('input_boolean.work_today','off') %}
|
{% elif is_state('input_boolean.kallen_school_today','off') and is_state('input_boolean.work_today','off') %}
|
||||||
15:00
|
15:00
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if (state_attr('input_datetime.tina_workday_end','timestamp')) > 61200 %}
|
{% if tina_work_end > 61200 %}
|
||||||
16:00
|
16:00
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_end', 'timestamp') + 3600) | timestamp_custom('%H:%M', false) }}
|
{{ tina_work_end + 3600 | timestamp_custom('%H:%M', false) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ states('sensor.todays_high_temp') | int >= states('input_number.hot_day_threshold') | int }}"
|
value_template: "{{ high >= states('input_number.hot_day_threshold') | int }}"
|
||||||
then:
|
then:
|
||||||
- service: input_boolean.turn_on
|
- service: input_boolean.turn_on
|
||||||
target:
|
target:
|
||||||
@ -434,7 +445,7 @@ script:
|
|||||||
entity_id: input_boolean.hot_day
|
entity_id: input_boolean.hot_day
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: "{{ states('sensor.todays_high_temp') | int <= states('input_number.cold_day_threshold') | int }}"
|
value_template: "{{ high <= states('input_number.cold_day_threshold') | int }}"
|
||||||
then:
|
then:
|
||||||
- service: input_boolean.turn_on
|
- service: input_boolean.turn_on
|
||||||
target:
|
target:
|
||||||
@ -450,6 +461,8 @@ script:
|
|||||||
house_scheduling_evening:
|
house_scheduling_evening:
|
||||||
alias: 'House Scheduling Evening'
|
alias: 'House Scheduling Evening'
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
kallen_bedtime: "{{ state_attr('input_datetime.kallen_bedtime','timestamp') }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.house_briefing_times_override
|
entity_id: input_boolean.house_briefing_times_override
|
||||||
@ -460,9 +473,9 @@ script:
|
|||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% if is_state('input_boolean.kallen_late_bedtime','on') %}
|
{% if is_state('input_boolean.kallen_late_bedtime','on') %}
|
||||||
{{ (state_attr('input_datetime.kallen_bedtime','timestamp') - 7200) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_bedtime - 7200 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ (state_attr('input_datetime.kallen_bedtime','timestamp') - 3600) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_bedtime - 3600 | timestamp_custom('%H:%M', false) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
- service: input_datetime.set_datetime
|
- service: input_datetime.set_datetime
|
||||||
entity_id: input_datetime.audible_notification_off
|
entity_id: input_datetime.audible_notification_off
|
||||||
@ -505,7 +518,10 @@ script:
|
|||||||
master_bedroom_scheduling_evening:
|
master_bedroom_scheduling_evening:
|
||||||
alias: 'Master Bedroom Scheduling Evening'
|
alias: 'Master Bedroom Scheduling Evening'
|
||||||
sequence:
|
sequence:
|
||||||
- if:
|
- variables:
|
||||||
|
low: "{{ states('sensor.overnight_lowest_temperature') | int }}"
|
||||||
|
high: "{{ states('sensor.todays_high_temp') | int }}"
|
||||||
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.master_bedroom_climate_override
|
entity_id: input_boolean.master_bedroom_climate_override
|
||||||
state: 'off'
|
state: 'off'
|
||||||
@ -514,7 +530,6 @@ script:
|
|||||||
entity_id: input_datetime.master_bedroom_cooling
|
entity_id: input_datetime.master_bedroom_cooling
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set low = states('sensor.overnight_lowest_temperature') | int %}
|
|
||||||
{% if is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','on') %}
|
{% if is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','on') %}
|
||||||
20:00
|
20:00
|
||||||
{% elif is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','off') %}
|
{% elif is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','off') %}
|
||||||
@ -530,8 +545,6 @@ script:
|
|||||||
entity_id: input_datetime.master_bedroom_fan
|
entity_id: input_datetime.master_bedroom_fan
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set low = states('sensor.overnight_lowest_temperature') | int %}
|
|
||||||
{% set high = states('sensor.todays_high_temp') | int %}
|
|
||||||
{% if low > 60 or is_state('input_boolean.hot_day','on') %}
|
{% if low > 60 or is_state('input_boolean.hot_day','on') %}
|
||||||
22:30
|
22:30
|
||||||
{% elif low <= 60 and low >= 50 %}
|
{% elif low <= 60 and low >= 50 %}
|
||||||
@ -575,6 +588,8 @@ script:
|
|||||||
emma_bedroom_scheduling_morning:
|
emma_bedroom_scheduling_morning:
|
||||||
alias: 'Emma Bedroom Scheduling Morning'
|
alias: 'Emma Bedroom Scheduling Morning'
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
master_bedroom_wakeup: "{{ states('input_datetime.master_bedroom_wakeup') }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.emma_wakeup_override
|
entity_id: input_boolean.emma_wakeup_override
|
||||||
@ -583,7 +598,7 @@ script:
|
|||||||
- service: input_datetime.set_datetime
|
- service: input_datetime.set_datetime
|
||||||
entity_id: input_datetime.emma_wakeup
|
entity_id: input_datetime.emma_wakeup
|
||||||
data:
|
data:
|
||||||
time: "{{ states('input_datetime.master_bedroom_wakeup') }}"
|
time: "{{ master_bedroom_wakeup }}"
|
||||||
- service: input_boolean.turn_on
|
- service: input_boolean.turn_on
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.emma_scheduling_morning_ran
|
entity_id: input_boolean.emma_scheduling_morning_ran
|
||||||
@ -591,6 +606,10 @@ script:
|
|||||||
emma_bedroom_scheduling_evening:
|
emma_bedroom_scheduling_evening:
|
||||||
alias: 'Emma Bedroom Scheduling Evening'
|
alias: 'Emma Bedroom Scheduling Evening'
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
high: "{{ states('sensor.todays_high_temp') | int }}"
|
||||||
|
low: "{{ states('sensor.overnight_lowest_temperature') | int }}"
|
||||||
|
aircon: "{{ states('input_number.emma_aircon_threshold') | int }}"
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.emma_bedtime_override
|
entity_id: input_boolean.emma_bedtime_override
|
||||||
@ -600,8 +619,6 @@ script:
|
|||||||
entity_id: input_datetime.emma_bedtime
|
entity_id: input_datetime.emma_bedtime
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set high = states('sensor.todays_high_temp') | int %}
|
|
||||||
{% set low = states('sensor.overnight_lowest_temperature') | int %}
|
|
||||||
{% if is_state('input_boolean.hot_day','on') %}
|
{% if is_state('input_boolean.hot_day','on') %}
|
||||||
22:00
|
22:00
|
||||||
{% elif high >= 80 or low >= 60 %}
|
{% elif high >= 80 or low >= 60 %}
|
||||||
@ -620,7 +637,7 @@ script:
|
|||||||
data:
|
data:
|
||||||
option: >
|
option: >
|
||||||
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') %}
|
{% if is_state('input_boolean.emma_bedroom_aircon_installed','on') %}
|
||||||
{% if (states('sensor.overnight_lowest_temperature') | int) >= (states('input_number.emma_aircon_threshold') | int) %}
|
{% if low >= aircon %}
|
||||||
AC
|
AC
|
||||||
{% else %}
|
{% else %}
|
||||||
White Noise
|
White Noise
|
||||||
@ -635,25 +652,31 @@ script:
|
|||||||
security_scheduling:
|
security_scheduling:
|
||||||
alias: Security Scheduling
|
alias: Security Scheduling
|
||||||
sequence:
|
sequence:
|
||||||
|
- variables:
|
||||||
|
ct: "{{ ((now().hour * 60 + now().minute) * 60 ) }}"
|
||||||
|
kallen_school_start: "{{ state_attr('input_datetime.kallen_school_day_start','timestamp') }}"
|
||||||
|
# kallen_school_end:
|
||||||
|
# tina_work_start:
|
||||||
|
# tina_work_end:
|
||||||
|
#! IN PROGRESS
|
||||||
- service: input_datetime.set_datetime
|
- service: input_datetime.set_datetime
|
||||||
entity_id: input_datetime.morning_alarm_disarm
|
entity_id: input_datetime.morning_alarm_disarm
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
|
||||||
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','on') %}
|
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','on') %}
|
||||||
{% if ct > state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
{% if ct > kallen_school_start %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif ct > state_attr('input_datetime.tina_workday_start','timestamp') and ct < state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
{% elif ct > state_attr('input_datetime.tina_workday_start','timestamp') and ct < kallen_school_start %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 2700) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start - 2700 | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif state_attr('input_datetime.tina_workday_start','timestamp') < (state_attr('input_datetime.kallen_school_day_start','timestamp')) %}
|
{% elif state_attr('input_datetime.tina_workday_start','timestamp') < kallen_school_start %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 2700) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start - 2700 | timestamp_custom('%H:%M', false) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start', 'timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start', 'timestamp') - 1800) | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif is_state('input_boolean.kallen_school_today','on') %}
|
{% elif is_state('input_boolean.kallen_school_today','on') %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 2700) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start - 2700 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
11:00
|
11:00
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -661,21 +684,20 @@ script:
|
|||||||
entity_id: input_datetime.morning_alarm_rearm
|
entity_id: input_datetime.morning_alarm_rearm
|
||||||
data:
|
data:
|
||||||
time: >
|
time: >
|
||||||
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
|
|
||||||
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
{% if is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','off') %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','off') %}
|
{% elif is_state('input_boolean.kallen_school_today','on') and is_state('input_boolean.work_today','off') %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') + 3600) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start + 3600 | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','on') %}
|
{% elif is_state('input_boolean.work_today','on') and is_state('input_boolean.kallen_school_today','on') %}
|
||||||
{% if ct > state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
{% if ct > kallen_school_start %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif ct > state_attr('input_datetime.tina_workday_start','timestamp') and ct < state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
{% elif ct > state_attr('input_datetime.tina_workday_start','timestamp') and ct < kallen_school_start %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') - 2700) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start - 2700 | timestamp_custom('%H:%M', false) }}
|
||||||
{% elif state_attr('input_datetime.tina_workday_start','timestamp') < state_attr('input_datetime.kallen_school_day_start','timestamp') %}
|
{% elif state_attr('input_datetime.tina_workday_start','timestamp') < kallen_school_start %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') + 1800) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start + 1800 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if (state_attr('input_datetime.tina_workday_start','timestamp') - state_attr('input_datetime.kallen_school_day_start','timestamp')) > 5400 %}
|
{% if (state_attr('input_datetime.tina_workday_start','timestamp') - kallen_school_start) > 5400 %}
|
||||||
{{ (state_attr('input_datetime.kallen_school_day_start','timestamp') + 1800) | timestamp_custom('%H:%M', false) }}
|
{{ kallen_school_start + 1800 | timestamp_custom('%H:%M', false) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
{{ (state_attr('input_datetime.tina_workday_start','timestamp') + 900) | timestamp_custom('%H:%M', false) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user