I have a wait template in a blueprint with 2 inputs
input:
entity_trigger:
name: Trigger Sensor *
description: The Light switch.
selector:
entity
trigger_wait_time:
name: Trigger Wait Time
description: The time the trigger (Light) must be ON before the fan will be turned ON.
default: 3
selector:
number:
min: 0
max: 10
step: 0.2
unit_of_measurement: minutes
I cant make another trigger for this so I am trying to use this wait_template. The idea is to make sure the “entity_trigger” is in the ON state for X (say 60) amount of time.
sequence:
- alias: "wait for the fan to be on for given time period"
wait_template: "{{ ( states[entity_trigger].state == 'on') and (now()-states[entity_trigger].last_changed).total_seconds() > trigger_wait_time*60 | int }}"
It works but if I have the time set to 1 minute or 60 seconds it never is accurate. It could be out by 8 to 40 seconds, it is just random even if I try this.
sequence:
- alias: "wait for the fan to be on for given time period"
wait_template: "{{ ( states[entity_trigger].state == 'on') and (now()-states[entity_trigger].last_changed).total_seconds() > 60 }}"
Am I doing something wrong or maybe should I try another way?
Thanks for your help.
