Hi!
Cannot make it work.
My sensor is not int
type, unfortunately, so I need to convert it prior to mathematical comparison, thus I need to use a value template instead of the numeric state. I used for
1 minute, as the value sometimes may change, thus I need to make sure it keeps stable within the pre-selected range in automation for some time.
Trigger doesn’t launch if I use duration.
alias: Outside Lighting Setup
description: ""
trigger:
- platform: template
value_template: |-
{{ states('sensor.tasmota_bh1750_illuminance')|int < 10 }}
for: "00:01:00"
id: night
- platform: template
value_template: >-
{{states('sensor.tasmota_bh1750_illuminance')|int < 750 and
states('sensor.tasmota_bh1750_illuminance')|int > 20 }}
for: "00:01:00"
id: twilight
- platform: template
value_template: |-
{{ states('sensor.tasmota_bh1750_illuminance')|int > 800 }}
for: "00:01:00"
id: daylight
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: daylight
sequence:
- service: input_select.select_option
data:
option: daylight
target:
entity_id: input_select.outside_lighting_lux
- conditions:
- condition: trigger
id: twilight
sequence:
- service: input_select.select_option
data:
option: twilight
target:
entity_id: input_select.outside_lighting_lux
- conditions:
- condition: trigger
id: night
sequence:
- service: input_select.select_option
data:
option: night
target:
entity_id: input_select.outside_lighting_lux
default: []
mode: single