I’m using an Aqara HT to trigger a shelly 1L when humidity in my bathroom goes over 75%, run for 20 minutes, and then turn off. I live in a humid climate with crappy exhaust fans, so I’d like it to run for 20 minutes after the humidity goes back below 75%. Any help would be appreciated (and yes, I know about the over the counter solutions. I tried Dewstop and Nutone, but they were either way too sensitive or would fire at 2 in the morning waking me and Mrs. Super up.) I took a stab at it, but the fan now just seems to turn off when it drops below 75%. I have included the current automation setup below:
The trigger “Fires when the numeric value of an entity’s state (or attribute’s value if using the attribute property, or the calculated value if using the value_template property) crosses (and only when crossing) a given threshold. On state change of a specified entity, attempts to parse the state as a number and fires if the value is changing from above to below or from below to above the given threshold.”
something like this.
alias: Turn on and Off Fan
description: 'Turn on if humidity crosses 78. Turn off after 20 minutes or humidity below 74 whichever comes first.'
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.lumi_lumi_weather_3090e007_humidity
above: '78'
id: above
- platform: numeric_state
entity_id: sensor.lumi_lumi_weather_3090e007_humidity
below: '74'
id: below
- platform: state
entity_id: switch.primary_bathroom_fan_switch
to: on
for:
minutes: 20
id: below
condition:
- condition: not
conditions:
- condition: time
after: '22:30:00'
before: '06:30:00'
action:
- choose:
- conditions:
- condition: trigger
id: above
sequence:
- service: switch.turn_on
target:
entity_id: switch.primary_bathroom_fan_switch
- conditions:
- condition: trigger
id: below
sequence:
- service: switch.turn_off
target:
entity_id: switch.primary_bathroom_fan_switch
default: []
@BebeMischa, that’s good to know for sun state. I’ve been these conditions and it’s been working fine so far, as in not firing at all when we’re sleeping
@AllHailJ This is awesome, my one request is how can I tweak this to have it continue running the fan for 20 minutes after the humidity crosses back below 75?
Here’s my final automation. I ended up changing the time limit conditions to only the on trigger because we were showering right before 1030, and the fan would never turn off. Works like a charm! Thank you all, especially @AllHailJ for the help!
alias: Turn on and Off Fan (Duplicate)
description: >-
Turn on if humidity crosses 75. Turn off after 20 minutes after humidity
below 74
trigger:
- platform: numeric_state
entity_id: sensor.lumi_lumi_weather_humidity
above: '75'
id: above
- platform: numeric_state
entity_id: sensor.lumi_lumi_weather_humidity
below: '74'
for:
minutes: 20
id: below
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: above
- condition: time
after: '06:00:00'
before: '22:30:00'
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.primary_bathroom_fan_switch
- conditions:
- condition: trigger
id: below
sequence:
- service: switch.turn_off
target:
entity_id: switch.primary_bathroom_fan_switch
data: {}
default: []
mode: restart