I’m fiddling with an automation to control roller shutters. The idea is to close them when sun is shining on the windows and it’s hot outside.
There are two possible scenarios for a successful trigger:
- sun begins to shine and it’s allready hot → automation triggered by light intensity
- it gets hotter while the sun has been shining for some time → triggered by temperature
So far it has been pretty straightforward task. But then I wanted to include another condition: due to possibility of clouds etc. the automation should trigger only if the duration of illumination is long enough.
Here is the code:
description:
- platform: numeric_state
entity_id: sensor.light
below: 0.4
for:
minutes: 10
- platform: numeric_state
entity_id: sensor.out_temperature
above: 24.5
condition:
- condition: and
conditions:
- condition: numeric_state
entity_id: sensor.light
below: 0.4
- condition: numeric_state
entity_id: sensor.out_temperature
above: 24.5
action:
### a lot of scripts etc. No problems there.
Now if the automation gets triggered by light intensity, it incorporates 10 min interval during which the light intensity has to be strong enough (LDR value lower than 0.4). But I would like to somehow incorporate that interval when the automation is triggered by temperature. Something like:
- condition: numeric_state
entity_id: sensor.light
below: 0.4
for:
minutes: 10
But that doesn’t compile. Is there any workaround?