</>blueprint:
name: Detect Watering and Fast Soil Moisture Drop
description: >
Detects when watering occurs (based on a sudden moisture increase),
then monitors soil moisture drop over 6 hours. Alerts if drop exceeds threshold.
domain: automation
input:
moisture_sensor:
name: Soil Moisture Sensor
selector:
entity:
domain: sensor
min_increase:
name: Minimum Moisture Increase to Detect Watering
default: 5
selector:
number:
min: 1
max: 20
unit_of_measurement: ‘%’
drop_threshold:
name: Moisture Drop Threshold (over 6 hours)
default: 15
selector:
number:
min: 5
max: 50
unit_of_measurement: ‘%’
notify_device:
name: Device to Notify
selector:
device:
integration: mobile_app
trigger:
- platform: state
entity_id: !input moisture_sensor
variables:
min_increase: !input min_increase
drop_threshold: !input drop_threshold
moisture_sensor: !input moisture_sensor
condition:
action:
- variables:
current: “{{ trigger.to_state.state | float }}”
previous: “{{ trigger.from_state.state | float }}” - choose:
- conditions:
- condition: template
value_template: >
{{ (current - previous) >= min_increase }}
sequence: - variables:
start_value: “{{ current }}” - delay: “06:00:00”
- variables:
end_value: “{{ states[moisture_sensor] | float }}”
drop: “{{ start_value - end_value }}” - condition: template
value_template: >
{{ drop >= drop_threshold }} - service: notify.mobile_app_{{ device_attr(notify_device, ‘name’) | lower | replace(’ ', ‘_’) }}
data:
message: >
Fast soil moisture drop detected! Dropped {{ drop }}% in 6 hours after watering.
title: Moisture Drop Warning
mode: single </>
- condition: template
- conditions: