Hi,
I want to trigger an script x-amount of minutes (input_number.generalsettings_timers_wakeup) before my alarm (states.sensor.wakeuptimer_house_timelong.state) goes off.
This is what I’ve already have working:
input_number.yaml:
wakeuptimer_house_hour:
name: Hour
icon: mdi:timer
initial: 6
min: 0
max: 23
step: 1
mode: slider
wakeuptimer_house_minute:
name: Minutes
icon: mdi:timer
initial: 35
min: 0
max: 59
step: 5
mode: slider
#### amount of minutes to trigger automation before alarm ####
generalsettings_timers_wakeup:
name: Wake Up duration (minutes)
initial: 20
min: 0
max: 60
mode: box
Sensors.yaml:
- platform: time_date
display_options:
- 'time'
- platform: template
sensors:
wakeuptimer_house_hour:
value_template: '{{ states.input_number.wakeuptimer_house_hour.state | int }}'
wakeuptimer_house_minute:
value_template: '{{ states.input_number.wakeuptimer_house_minute.state | int }}'
wakeuptimer_house_time:
friendly_name: 'Wake Up time'
value_template: >-
{{ states.sensor.wakeuptimer_house_hour.state }}:
{%- if states.sensor.wakeuptimer_house_minute.state|length == 1 -%}
0
{%- endif -%}
{{ states.sensor.wakeuptimer_house_minute.state }}
wakeuptimer_house_timelong:
value_template: >-
{% if states.sensor.wakeuptimer_house_hour.state|length == 1 -%}
0
{%- endif -%}
{{ states.sensor.wakeuptimer_house_hour.state }}:
{%- if states.sensor.wakeuptimer_house_minute.state|length == 1 -%}
0
{%- endif -%}
{{ states.sensor.wakeuptimer_house_minute.state }}
Automation.yaml:
- alias: 'Wake Up'
hide_entity: False
trigger:
platform: template
value_template: '{{ states.sensor.time.state == states.sensor.wakeuptimer_house_timelong.state }}'
action:
service: script.wakeup
For example:
'{{ states.sensor.time.state == states.sensor.wakeuptimer_house_timelong.state }}'
06:35 == 06:35
What I am looking for is something like this (which doesn’t work):
'{{ states.sensor.time.state == states.sensor.wakeuptimer_house_timelong.state - input_number. generalsettings_timers_wakeup}}'
06:15 == 06:35 - 20
Anybody an idea?