I’ve got a couple of humidity sensors in my basement, and I’m trying to set up an automation that turns on a dehumidifier whenever the average humidity rises above a value for 1 minute, and turns it off whenever the average humidity drops below the value for 1 minute.
I created an input_number for the trigger humidity percent, and a sensor group to get the average basement humidity.
I’ve created the following 3 automations:
- id: 147_automation_laundry_room_dehumidifier_on
alias: Laundry Room Dehumidifier On
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.basement_humidity_mean
above: input_number.laundry_room_dehumidifier_trigger_percent
for:
minutes: 1
action:
- service: switch.turn_off
target:
entity_id: switch.laundry_room_dehumidifier
- id: 147_automation_laundry_room_dehumidifier_off
alias: Laundry Room Dehumidifier Off
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.basement_humidity_mean
below: input_number.laundry_room_dehumidifier_trigger_percent
for:
minutes: 1
action:
- service: switch.turn_off
target:
entity_id: switch.laundry_room_dehumidifier
- id: 147_automation_laundry_room_dehumidifier_trigger_changed
alias: Laundry Room Dehumidifier Trigger Changed
description: ""
trigger:
- platform: state
entity_id:
- input_number.laundry_room_dehumidifier_trigger_percent
variables:
to_state: "{{ iif(states('sensor.basement_humidity_mean') > states('input_number.laundry_room_dehumidifier_trigger_percent'), 'on', 'off') }}"
toggle_dehumidifier: "{{ to_state != states('switch.laundry_room_dehumidifier') }}"
condition: "{{ toggle_dehumidifier }}"
action:
- service: switch.toggle
target:
entity_id: switch.laundry_room_dehumidifier
Everything works fine when I change the trigger percent, and sometimes the dehumidifier also switches off when the basement humidity crosses the threshold, but I’ve only see it work once or twice.
I’m not sure if changes to the trigger level that run the 3rd automation is somehow breaking the first two automations…?
If anyone can offer advice/suggestions to improve/fix these automations I’d be truly greatful. Thanks!