Thanks for the hints. However, most commercial appliances cycle (i.e. fans blow, pause, repeat). While the fans pause, the air in the basement can take up water again. If your fans blow the whole time you will not be able to benefit from this effect.
In the meantime, I have finished the automation. Once the timer from the pause has finished it fires and event. That event again triggers the automation.
alias: Basement fan control with dewpoint
description: ''
trigger:
- platform: state
entity_id:
- sensor.dew_delta_ok
from: 'False'
to: 'True'
id: dewdeltaok
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.dewtimer_runfan
id: runfanfinished
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.dewtimer_pausefan
id: pausefanfinished
- platform: time_pattern
hours: '12'
minutes: '00'
seconds: '00'
id: noon
- platform: homeassistant
event: start
id: hastart
- platform: event
event_type: dew_event
event_data:
foo: bar
id: waitfinished
- platform: state
entity_id:
- binary_sensor.dew_timeframe
to: 'off'
id: timeframeend
- platform: state
entity_id:
- binary_sensor.dew_timeframe
to: 'on'
id: timeframebegin
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- timeframebegin
- dewdeltaok
- hastart
- waitfinished
- condition: state
entity_id: sensor.dew_delta_ok
state: 'True'
- condition: state
entity_id: sensor.dew_humidity_ok
state: 'True'
- condition: state
entity_id: sensor.dew_temp_ok
state: 'True'
- condition: state
entity_id: binary_sensor.dew_timeframe
state: 'on'
- condition: numeric_state
entity_id: counter.dew_index
below: '5'
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.shellys_keller_luefter1
- service: timer.start
data:
duration: '{{states(''input_number.dew_duration_fan'')|int*60}}'
target:
entity_id: timer.dewtimer_runfan
- service: counter.increment
data: {}
target:
entity_id: counter.dew_index
- conditions:
- condition: trigger
id: runfanfinished
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.shellys_keller_luefter1
- service: timer.start
data:
duration: '{{states(''input_number.dew_fan_wait'')|int*60}}'
target:
entity_id: timer.dewtimer_pausefan
- conditions:
- condition: trigger
id: pausefanfinished
sequence:
- service: notify.persistent_notification
data:
message: Fan finished run {{ states('counter.dew_index') }}
- event: dew_event
event_data:
foo: bar
- conditions:
- condition: trigger
id: noon
sequence:
- service: counter.reset
data: {}
target:
entity_id: counter.dew_index
- conditions:
- condition: trigger
id: timeframeend
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.shellys_keller_luefter1
- service: timer.cancel
data: {}
target:
entity_id:
- timer.dewtimer_pausefan
- timer.dewtimer_runfan
default:
- service: notify.persistent_notification
data:
title: Fan control basement
message: ' delta_ok {{states(''sensor.dew_delta_ok'')}} {{''\n''-}} hum_ok {{states(''sensor.dew_humidity_ok'')}} {{''\n''-}}temp_ok {{states(''sensor.dew_temp_ok'')}} {{''\n''-}}time_ok {{states(''binary_sensor.dew_timeframe'')}} {{''\n''-}}index {{states(''counter.dew_index'')}}'
mode: queued
The automation itself needs a bunch of helper variables and sensors.
29.05.2022: edited as binary sensors are on/off and not true/false.