Hi!
I have a binary_sensor which detects if the humidity level of a bathroom is significantly higher (10% higher) than the rest of the house:
- platform: template
sensors:
ensuite_higher_humidity:
friendly_name: 'Ensuite humidity level trigger'
entity_id:
- sensor.upstairs_humidity_avg
- sensor.sensor_2_humidity_sensor
value_template: >
{% set upstairs_avg = states('sensor.upstairs_humidity_avg')| float(0) %}
{% set ensuite_RH = states('sensor.sensor_2_humidity_sensor')| float(0) %}
{{ (ensuite_RH > (upstairs_avg * 1.10)) }}
I use this sensor and another sensor to detect whether the humidity is rapidly rising to feed into a sensor-light blueprint which triggers the dehumidifier to run for a period of time. So if either of these states changes from “off” to “on”- indicating a humid environment- the action is to trigger a resetable timer for 20 mins.
The problem that I have is that the blueprint which I’m using (Blackshome/sensor_light.yaml) depends on a state-change to reset the 20 min timer, and the template above does not provide a resetable state-change, therefore if the bathroom is excessively humid, the ensuite_higher_humidity sensor will only trigger once and the dehumidifier will power off after 20 mins even if it’s job is not complete.
I’d like to continue to use the Blackshome/sensor_light blueprint as it provides additional features such as time and day exclusions, etc.
I tried to create an automation based on this to reassert the binary_sensor, but it seems that I cannot do so as I can’t change the state of the same sensor that I’m testing (I think!).
# Monitors the humidity in the ensuite and reissues the command to keep the humidity trigger high
- alias: 'Humidity monitor for ensuite_higher_humidity'
mode: restart
trigger:
- platform: state
entity_id: binary_sensor.ensuite_higher_humidity
to: 'on'
for: '00:05:00'
action:
- repeat:
while: "{{ is_state('binary_sensor.ensuite_higher_humidity', 'on') }}"
sequence:
- platform: state
entity_id:
- binary_sensor.ensuite_higher_humidity
from: 'on'
to: 'off'
for:
hours: 0
minutes: 0
seconds: 1
- delay: '00:05:00'
What are my options for reasserting that binary_sensor at periods of ~5 mins?