diff --git a/PlantMonitor_bp.yaml b/PlantMonitor_bp.yaml new file mode 100644 index 0000000..bb95b01 --- /dev/null +++ b/PlantMonitor_bp.yaml @@ -0,0 +1,60 @@ +blueprint: + name: 💧 DWC Plant Tracker + description: > + Track plants in Deep Water Culture (DWC) or soil setups. + Notifies you to change or add water every 7 days. + domain: automation + input: + plant_name: + name: Plant Name + description: Friendly name of your plant (e.g. "Lettuce 1"). + default: "My Plant" + last_watered_helper: + name: Last Watered Helper + description: > + Select the Date/Time helper for when this plant was last watered. + selector: + entity: + domain: input_datetime + notification_target: + name: Notification Target + description: > + Choose how to receive reminders (e.g. mobile app, persistent_notification, etc.) + selector: + target: + +# Trigger every day at midnight to check age +trigger: + - platform: time + at: "00:00:00" + +variables: + plant_name: !input plant_name + last_watered_entity: !input last_watered_helper + +# Conditions check if plant hasn't been watered in 7+ days +condition: + - condition: template + value_template: > + {% set last = states(last_watered_entity) %} + {% if last not in ['unknown', 'unavailable', None] %} + {{ ((as_timestamp(now()) - as_timestamp(last)) / 86400) | int >= 7 }} + {% else %} + false + {% endif %} + +action: + - variables: + days_since: > + {% set last = states(last_watered_entity) %} + {% if last not in ['unknown','unavailable',None] %} + {{ ((as_timestamp(now()) - as_timestamp(last)) / 86400) | int }} + {% else %} 0 {% endif %} + + - service: notify + target: !input notification_target + data: + title: "💧 DWC Water Change Reminder" + message: "{{ plant_name }} needs a water change! It’s been {{ days_since }} days since last watering." + +mode: single