fix an issue with an input template
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
blueprint:
|
||||
name: Fan Cadence with Light Check
|
||||
description: >
|
||||
Runs a fan on a cadence every X minutes.
|
||||
Turns it off after Y seconds unless any of the specified lights are on.
|
||||
Turns on a fan every X minutes for Y seconds, but keeps it on if any selected lights are on.
|
||||
domain: automation
|
||||
input:
|
||||
fan_entity:
|
||||
@ -12,8 +11,8 @@ blueprint:
|
||||
domain: fan
|
||||
|
||||
interval_minutes:
|
||||
name: Fan Activation Interval (minutes)
|
||||
description: How often to turn the fan on
|
||||
name: Interval (minutes)
|
||||
description: How often to start the fan cycle
|
||||
default: 15
|
||||
selector:
|
||||
number:
|
||||
@ -22,8 +21,8 @@ blueprint:
|
||||
unit_of_measurement: minutes
|
||||
|
||||
duration_seconds:
|
||||
name: How Long to Keep Fan On (seconds)
|
||||
description: How long the fan stays on before trying to turn it off
|
||||
name: Fan On Duration (seconds)
|
||||
description: How long the fan stays on each cycle
|
||||
default: 60
|
||||
selector:
|
||||
number:
|
||||
@ -33,33 +32,42 @@ blueprint:
|
||||
|
||||
override_lights:
|
||||
name: Override Lights
|
||||
description: Fan will not be turned off if any of these lights are on
|
||||
description: Fan will not turn off if any of these lights are on
|
||||
selector:
|
||||
entity:
|
||||
domain: light
|
||||
multiple: true
|
||||
|
||||
trigger:
|
||||
- platform: time_pattern
|
||||
minutes: "/{{ iif(interval_minutes | int > 0, interval_minutes, 15) }}"
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
- platform: time
|
||||
at: "00:00:00" # ensures automation starts at midnight if HA is already running
|
||||
|
||||
variables:
|
||||
fan: !input fan_entity
|
||||
lights: !input override_lights
|
||||
interval: !input interval_minutes
|
||||
duration: !input duration_seconds
|
||||
|
||||
condition: []
|
||||
|
||||
action:
|
||||
- repeat:
|
||||
while: []
|
||||
sequence:
|
||||
- service: fan.turn_on
|
||||
target:
|
||||
entity_id: "{{ fan }}"
|
||||
- delay:
|
||||
seconds: !input duration_seconds
|
||||
seconds: "{{ duration }}"
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ lights | map('states') | select('eq', 'on') | list | length == 0 }}
|
||||
- service: fan.turn_off
|
||||
target:
|
||||
entity_id: "{{ fan }}"
|
||||
- delay:
|
||||
minutes: "{{ interval }}"
|
||||
|
||||
mode: parallel
|
||||
mode: restart
|
||||
|
Reference in New Issue
Block a user