Forked from migsun/high-humidity-level-detection-notification-for-all-humidity-sensors.yaml
Last active
April 8, 2025 19:46
-
-
Save tasomaniac/19982b79d831f6f299fa43322173e8a1 to your computer and use it in GitHub Desktop.
high-humidity-level-detection-notification-for-all-humidity-sensors -- Thx to sbyx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: high humidity level detection & notification for all huminity sensors | |
description: Regularly test all sensors with 'humidity' device-class for crossing | |
a certain humidity level threshold and if so execute an action. | |
domain: automation | |
input: | |
threshold: | |
name: Humidity warning level threshold | |
description: Humidity sensors threshold. | |
default: 65 | |
selector: | |
number: | |
min: 5.0 | |
max: 100.0 | |
unit_of_measurement: '%' | |
mode: slider | |
step: 5.0 | |
exclude: | |
name: Excluded Sensors | |
description: Humidity sensors to exclude from detection. | |
default: | |
entity_id: [] | |
selector: | |
target: | |
entity: | |
device_class: humidity | |
actions: | |
name: Actions | |
description: Notifications or similar to be run. {{sensors}} is replaced with | |
the names of sensors with high humidity. | |
selector: | |
action: {} | |
source_url: https://gist.github.com/tasomaniac/19982b79d831f6f299fa43322173e8a1 | |
variables: | |
threshold: !input threshold | |
exclude: !input exclude | |
sensors: "{% set result = namespace(sensors=[]) %} {% for state in states.sensor | |
| selectattr('attributes.device_class', '==', 'humidity') %}\n {% if 0 <= state.state | |
| int(-1) > threshold | int and not state.entity_id in exclude.entity_id %}\n | |
\ {% set result.sensors = result.sensors + [state.name ~ ' (' ~ state.state | |
~ ' %)'] %}\n {% endif %}\n{% endfor %} {% for state in states.binary_sensor | |
| selectattr('attributes.device_class', '==', 'humidity') | selectattr('state', | |
'==', 'on') %}\n {% if not state.entity_id in exclude.entity_id %}\n {% set | |
result.sensors = result.sensors + [state.name] %}\n {% endif %}\n{% endfor %} | |
{{result.sensors|join('\n') }}" | |
trigger: | |
platform: time_pattern | |
hours: '/1' | |
condition: | |
- '{{ sensors != '''' }}' | |
action: | |
- choose: [] | |
default: !input actions | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment