Last active
July 17, 2024 05:04
-
-
Save dskindell/e1e546f195aa3b1d761fbcbb62243419 to your computer and use it in GitHub Desktop.
Regularly test all plant devices (using https://github.com/Olen/homeassistant-plant) with temperature, moisture, illumination, dpi, humidity, or conductivity that are too low or too high
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
# Fork of https://community.home-assistant.io/t/plant-moisture-notification/369425 | |
blueprint: | |
name: Low/High plant sensor level detection & notification for all plant devices | |
description: | |
Regularly test all plant devices (using https://github.com/Olen/homeassistant-plant) | |
with temperature, moisture, illumination, dpi, humidity, or conductivity that are | |
too low or too high | |
domain: automation | |
input: | |
triggers: | |
name: Triggers | |
selector: | |
trigger: {} | |
day: | |
name: Weekday to test on | |
description: | |
"Test is run at configured time either everyday (0) or on a given | |
weekday (1: Monday ... 7: Sunday)" | |
default: 0 | |
selector: | |
number: | |
min: 0.0 | |
max: 7.0 | |
mode: slider | |
step: 1.0 | |
sensor: | |
name: Plant sensor to report problem | |
description: "Check for problem on the following plant sensor (if available)" | |
default: moisture_status | |
selector: | |
select: | |
options: | |
- moisture_status | |
- temperature_status | |
- conductivity_status | |
- illuminance_status | |
- humidity_status | |
- dli_status | |
problem: | |
name: Test plant sensor on 'Low' or 'High' problem | |
description: | |
"Report plant problems on 'sensor' if sensor is either below minimum ('Low') | |
or above the maximum ('High')" | |
default: "Low" | |
selector: | |
select: | |
options: | |
- High | |
- Low | |
exclude: | |
name: Excluded Plant Devices | |
description: Entity ID of plant device to exclude from detection. | |
default: { entity_id: [] } | |
selector: | |
target: | |
entity: | |
domain: plant | |
actions: | |
name: Actions | |
description: | |
"Notifications or similar to be run. {{plants[i].species}}/{{plants[i].name}} | |
is replaced with the list of species names/plant friendly_name of plant | |
devices with selected problem. Additionally variables available: | |
{{sensor}} => temperature_status, moisture_status, etc. {{problem}} => | |
High or Low." | |
selector: | |
action: {} | |
source_url: https://gist.github.com/dskindell/e1e546f195aa3b1d761fbcbb62243419 | |
variables: | |
day: !input "day" | |
exclude: !input "exclude" | |
sensor: !input "sensor" | |
problem: !input "problem" | |
plants: >- | |
{% set results = namespace(plants=[]) %} | |
{% for state in states.plant | |
| selectattr('attributes.' + sensor, '==', problem) %} | |
{% if not state.entity_id in exclude.entity_id %} | |
{% set results.plants = results.plants + [{ | |
'species': state_attr(state.entity_id, 'species'), | |
'name': state_attr(state.entity_id, 'friendly_name'), | |
'area_name': area_name(state.entity_id) | |
}] %} | |
{% endif %} | |
{% endfor %} | |
{{results.plants}} | |
trigger: !input "triggers" | |
condition: | |
- "{{ plants|length > 0 and (day | int == 0 or day | int == now().isoweekday()) }}" | |
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