Send (actionable) notification when plants need water, including optional image

Hi all,

Some plants need a lot of water, others less. Some frequent, others less frequent. For me it was hard to keep track of all this, so I’ve made a blueprint that keeps track of this for me.

Description

This blueprint will send you a notification, with an optional photo of the plant, on a set hour on the date it needs watering. It is advised to water your plants in the evening or early in the morning, so you can determine yourself when you want to be reminded.

Once you’ve watered your plant, you press the action in the notification. This will ‘snooze’ te reminder for the interval you’ve setup in the blueprint. If you skip a day, the notification will be sent the next day at the set time until you snooze it again.

Note: this blueprint doesn’t take the weather into account and is intended for plants inside the house.

Features

  • Sends the notification at the set hour when the ‘watering date’ has been reached.
  • The notification can contain an optional image of the plant.
  • Using the actionable notification you can ‘snooze’ the notification until the next time the plan needs water.
  • All texts can be fully customized.

Screenshots


Prerequisite

The blueprint requires an input_datetime (set to date) entity to keep track of the date a plant needs watering. You can create one entity for each plant, or for all your plants. This is of course up to you.


Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Reminder to water a plant
  description: 'Sends a daily notification with a water reminder for plants, until the plants have been watered. An optional image can be attached to help identify the plant.'
  domain: automation
  input:
    plant_date:
      name: Date sensor
      description: "This entity will hold the date of the next time a plant needs watering. It needs to be an input_datetime helper entity set to 'Date'."
      selector:
        entity:
          domain: input_datetime
    plant_image:
      name: Image of the plant
      description: "An image of the plant to be watered. Image needs to be in the www folder: '/www/plant.png' will need '/local/plant.png' to be filled in. Smaller images load faster in the notification."
      default: []
      selector:
        text:
    reminder_time:
      name: Reminder time
      description: "Time when the reminder should be sent. Advice: water plants in the evening."
      default: '20:00'
      selector:
        time:
    interval_days:
      name: Interval in days
      description: "The interval between the watering of the plant"
      default: 7
      selector:
        number:
          min: 0
          max: 50
          mode: slider
          unit_of_measurement: days
    notification_title:
      name: Title of the notfication
      description: "Title of the notification that will be sent."
      default: "Plant needs water!"
      selector:
        text:
    notification_message:
      name: Message of the notfication
      description: "Message of the notification that will be sent."
      default: "Give just enough water to make the soil a bit moist. Make sure the leaves don't get wet."
      selector:
        text:
    action_name:
      name: Name of the action
      description: "Name of the action in the actionable notification."
      default: "The plant just had water"
      selector:
        text:
    notify_device:
      name: Notify device
      description: "The device where the notification should be sent to."
      selector:
        text:
    need_water_action:
      name: Need water action
      default: []
      description: "If you want an extra action to happen when the plant needs water, apart from sending the notification, you can define one here. For example: a light turns blue"
      selector:
        action: {}
    had_water_action:
      name: Had water action
      default: []
      description: "If you want an extra action to happen when the plant had water you can define one here. For example: a light turns green"
      selector:
        action: {}

variables:
  datetime_entity:   !input plant_date
  interval:          !input interval_days
  identifier: |
            {{ datetime_entity.split('.')[1] }}

trigger:
  - platform: time
    at: !input reminder_time
    id: trigger_time

  - platform: event
    event_type: mobile_app_notification_action
    id: trigger_app

condition:
  - condition: template
    value_template: |
      {{ states(datetime_entity) <= now().strftime("%Y-%m-%d")}}
action:
  - choose:
    - conditions:
      - condition: trigger
        id: trigger_app
      - condition: template
        value_template: |
          {{ trigger.event.data.action == identifier  }}
      sequence:
      - service: input_datetime.set_datetime
        target:
          entity_id: |
            {{ datetime_entity }}
        data:
          date: |
            {{ as_timestamp( now() + timedelta(days=interval) ) | timestamp_custom('%Y-%m-%d') }}
      - choose: []
        default: !input 'had_water_action'
    - conditions:
      - condition: trigger
        id: trigger_time
      sequence:
      - service: !input notify_device
        data:
          data:
            actions:
            - title: !input action_name
              action: |
                  {{ identifier }}
            image: !input plant_image
          title:   !input notification_title
          message: !input notification_message
      - choose: []
        default: !input 'need_water_action'
1 Like

Can we use a sensor to determine when the plant needs to be watered?

How do you mean?
This blueprint is bases on a input_datetime sensor to keep track of when the plant needs water. This sensor can also be used on your frontend to display the next time a plant needs wafer.

For example, I use the plant sensors to report that the plant needs watering. Time is not the most exact trigger, it would be cool if sensor value could trigger this.

Ah, you mean for example a moisture sensor that will trigger the notification whenever the soil becomes too dry?
I don’t have such sensors, so I can’t implement it here. But sure, I think it is possible!

Is it possible to add a same action button for the frontend?

Thanks

Yes, you can have a button call the following service:

Here you will need to replace {{ datetime_entity }} for the relevant date time entity and interval for the number of days to snooze the reminder.

Amazing! What a legend! Cheers appreciate that


show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: input_datetime.set_datetime
  target:
    entity_id: |
      {{ input_datetime.tomato_plant }}
    data:
      date: >
        {{ as_timestamp( now() + timedelta(days=1) ) |
        timestamp_custom('%Y-%m-%d') }}
hold_action:
  action: none
icon: mdi:sprout

Button tried to create but failing to call service

Can you try this?

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: input_datetime.set_datetime
  target:
    entity_id:  input_datetime.tomato_plant 
    data:
      date: >
        {{ as_timestamp( now() + timedelta(days=1) ) |  timestamp_custom('%Y-%m-%d') }}
hold_action:
  action: none
icon: mdi:sprout

Hey, still having issues

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: input_datetime.set_datetime
  target:
    entity_id: input_datetime.tomato_plant
  data:
    date: >
      {{ as_timestamp( now() + timedelta(days=1) ) | 
      timestamp_custom('%Y-%m-%d') }}
entity: input_datetime.tomato_plant
name: Tomato Plant
icon: mdi:sprout
show_state: true
hold_action:
  action: none

Error I get is “Failed to call service input_datetime/set_datetime. Could not parse date for dictionary value @ data[‘date’]”

Nice work. Would be nice to have the option for any audible notification thru the media_player intergration. I am too stupid to do it by my own. :slight_smile:

Nice blueprint! Really liking it!

I have plants that should have different watering schedules in the off-season.
So I altered the blueprint to add this functionality. Have not tested it fully because have to wait a bit on the event to trigger.

blueprint:
  name: Reminder to water a plant
  description: 'Sends a daily notification with a water reminder for plants, until the plants have been watered. An optional image can be attached to help identify the plant.'
  domain: automation
  input:
    plant_date:
      name: Date sensor
      description: "This entity will hold the date of the next time a plant needs watering. It needs to be an input_datetime helper entity set to 'Date'."
      selector:
        entity:
          domain: input_datetime
    plant_begin_month_off_season:
      name: Month number begin off season
      description: "The month number when the off season begins (ie. Winter)"
      default: 10
      selector:
        number:
          min: 1
          max: 12
          mode: slider
          unit_of_measurement: month
    plant_end_month_off_season:
      name: Month number begin off season
      description: "The month number when the off season begins (ie. Spring)"
      default: 4
      selector:
        number:
          min: 1
          max: 12
          mode: slider
          unit_of_measurement: month
    plant_image:
      name: Image of the plant
      description: "An image of the plant to be watered. Image needs to be in the www folder: '/www/plant.png' will need '/local/plant.png' to be filled in. Smaller images load faster in the notification."
      default: []
      selector:
        text:
    reminder_time:
      name: Reminder time
      description: "Time when the reminder should be sent. Advice: water plants in the evening."
      default: '20:00'
      selector:
        time:
    interval_days:
      name: Interval in days
      description: "The interval between the watering of the plant"
      default: 7
      selector:
        number:
          min: 0
          max: 50
          mode: slider
          unit_of_measurement: days
    interval_days_off_season:
      name: Interval in days (Off season)
      description: "The interval between the watering of the plant in the off season"
      default: 30
      selector:
        number:
          min: 0
          max: 100
          mode: slider
          unit_of_measurement: days
    notification_title:
      name: Title of the notfication
      description: "Title of the notification that will be sent."
      default: "Plant needs water!"
      selector:
        text:
    notification_message:
      name: Message of the notfication
      description: "Message of the notification that will be sent."
      default: "Give just enough water to make the soil a bit moist. Make sure the leaves don't get wet."
      selector:
        text:
    action_name:
      name: Name of the action
      description: "Name of the action in the actionable notification."
      default: "The plant just had water"
      selector:
        text:
    notify_device:
      name: Notify device
      description: "The device where the notification should be sent to."
      selector:
        device:

variables:
  datetime_entity:              !input plant_date
  interval_days:                !input interval_days
  plant_begin_month_off_season: !input plant_begin_month_off_season
  plant_end_month_off_season:   !input plant_end_month_off_season
  interval: >
            {% if plant_begin_month_off_season >= state_attr('input_datetime.sanseveria_begin_date_off_season', 'month') <= plant_end_month_off_season %}
            {{ interval_days_off_season }}
            {% else %}
            {{ interval_days }}
            {% endif %}
  identifier: |
            {{ datetime_entity.split('.')[1] }}

trigger:
  - platform: time
    at: !input reminder_time
    id: trigger_time

  - platform: event
    event_type: mobile_app_notification_action
    id: trigger_app

condition:
  - condition: template
    value_template: |
      {{ states(datetime_entity) <= now().strftime("%Y-%m-%d")}}
action:
  - choose:
    - conditions:
      - condition: trigger
        id: trigger_app
      - condition: template
        value_template: |
          {{ trigger.event.data.action == identifier  }}
      sequence:
      - service: input_datetime.set_datetime
        target:
          entity_id: |
            {{ datetime_entity }}
        data:
          date: |
            {{ as_timestamp( now() + timedelta(days=interval) ) | timestamp_custom('%Y-%m-%d') }}
    - conditions:
      - condition: trigger
        id: trigger_time
      sequence:
      - domain: mobile_app
        type: notify
        device_id: !input notify_device
        title:   !input notification_title
        message: !input notification_message
        data:
          actions:
          - title: !input action_name
            action: |
                {{ identifier }}
          image: !input plant_image

Added the following to the blueprint:

    plant_begin_month_off_season:
      name: Month number begin off season
      description: "The month number when the off season begins (ie. Winter)"
      default: 10
      selector:
        number:
          min: 1
          max: 12
          mode: slider
          unit_of_measurement: month
    plant_end_month_off_season:
      name: Month number begin off season
      description: "The month number when the off season begins (ie. Spring)"
      default: 4
      selector:
        number:
          min: 1
          max: 12
          mode: slider
          unit_of_measurement: month

variables:
  datetime_entity:              !input plant_date
  interval_days:                !input interval_days
  plant_begin_month_off_season: !input plant_begin_month_off_season
  plant_end_month_off_season:   !input plant_end_month_off_season
  interval: >
            {% if plant_begin_month_off_season >= state_attr('input_datetime.sanseveria_begin_date_off_season', 'month') <= plant_end_month_off_season %}
            {{ interval_days_off_season }}
            {% else %}
            {{ interval_days }}
            {% endif %}

@Getslow Let me know what you think :slight_smile:

Sounds like a good addition!
Unfortunately I don’t have time to test the blueprint. If you want you can post a new blueprint with your addition and I will refer to yours in my post above.

That sounds really great!
I will take some additional time to test it and will get back to you.

Thanks for this blueprint. I really needed this setup. One feature I would like to see is notification to a second device, such as sending a message to my phone but also change a light color to blue to indicate watering needed. Is that possible?

I get the notification every Day, even though I did set it between 1 & 7 Days depending on the plant. Id this because I usually swipe the notification away?

Hi,

You’ll need tap the ‘Plant just had water’ action within the notification in order to stop the messages from showing up.

2 Likes

Good suggestion. I’ll update the blueprint so you can set custom actions when the plant needs water or when the plant had water.

If you’re like me and you postpone the watering of your plants, you can make a conditional card in your dashboard to show the number of days the plants have been waiting for water:

The template sensor:

template:
  - sensor:
      - name: Plants waiting for water
        state: >
            {{ ( now().date() - ( states( 'input_datetime.plant_water' ) | as_datetime | as_local ).date() ).days }}

The chip:

type: conditional
conditions:
  - condition: numeric_state
    entity: sensor.plants_waiting_for_water
    above: -1
chip:
  type: template
  entity: sensor.plants_waiting_for_water
  icon: mdi:sprout
  icon_color: green
  content: '{{ states(''sensor.plants_waiting_for_water'') }} days'