Skip to content

Instantly share code, notes, and snippets.

@jfisbein
Created January 10, 2024 10:24
Show Gist options
  • Save jfisbein/3278b0ac8b1e713051bb0714ded2aff3 to your computer and use it in GitHub Desktop.
Save jfisbein/3278b0ac8b1e713051bb0714ded2aff3 to your computer and use it in GitHub Desktop.
blueprint:
name: Low moisture level detection & notification for all plant sensors
description: Regularly test all plant sensors with 'moisture' crossing under their
threshold.
domain: automation
input:
time:
name: Time to test on
description: Test is run at configured time
default: '10:00:00'
selector:
time: {}
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
exclude:
name: Excluded Sensors
description: Plant sensors (e.g. cactus) to exclude from detection. Only entities
are supported, devices must be expanded!
default:
entity_id: []
selector:
target:
entity:
domain: plant
actions:
name: Actions
description: Notifications or similar to be run. {{sensors}} is replaced with
the names of sensors being low on moisture.
selector:
action: {}
source_url: https://gist.github.com/jfisbein/db0659b2179482a3c7a450121d112aae
variables:
day: !input day
exclude: !input exclude
sensors: "{% set result = namespace(sensors=[]) %} {% for state in states.plant
if state.attributes.moisture_status == 'Low' %}\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(', ')}}"
trigger:
- platform: time
at: !input time
condition:
- '{{ sensors != '''' 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