For me, the Need Water Action and the Had Water Action were necessary to save the automation. Without them, I encountered an error because no default state was set. I fixed this issue and also made it possible to simply select the device to be notified, instead of having to type it in.
Also removed the input_boolean.plant_water_reminders condition, because it wasnt mentiond in the Prerequisite or the Description, and i dont need to turn it of.
I also think it isnt nessesary because you can just turn the automation off entirely.
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
multiple: false
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.0
max: 50.0
mode: slider
unit_of_measurement: days
step: 1.0
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: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
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:
source_url: https://community.home-assistant.io/t/send-actionable-notification-when-plants-need-water-including-optional-image/366568
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:
- alias: "Send notification"
domain: mobile_app
type: notify
device_id: !input notify_device
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
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
multiple: false
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.0
max: 100.0
mode: slider
unit_of_measurement: days
step: 1.0
interval_days_off_season:
name: Interval in days (Off season)
description: "The interval between the watering of the plant in the off season."
default: 14
selector:
number:
min: 0
max: 100
mode: slider
unit_of_measurement: day
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
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: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications.
selector:
device:
integration: mobile_app
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:
source_url: https://community.home-assistant.io/t/send-actionable-notification-when-plants-need-water-including-optional-image/366568
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 <= now().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'')}}'
- choose: []
default: !input had_water_action
- conditions:
- condition: trigger
id: trigger_time
sequence:
- alias: "Send notification"
domain: mobile_app
type: notify
device_id: !input notify_device
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
Hi Pold, thank you for all the improvements! I’ll update the blueprint to include the default actions and to remove the input_boolean condition (this was a local edit I made, forgot to remove it ).
I’ll reference your off-season implementation as well. I think it is better to not update the blueprint itself because it might be a breaking change?
Mhh the Offset automation could be defaulted to the normal interval, then it would not break anything.
Or you give it the month 0 and 13 as default, then it wouldnt be triggert
I absolutely love the idea of this blueprint automation, but I am having a heck of a time getting it to actually work. The had water action doesn’t seem to be working for me. Instead of receiving the notification once per scheduled period, I am getting it every single day. Its like the action isn’t doing the snooze and defaults to the “remind me in one day” path.
I am receiving the notifications on an Galaxy S21 Ultra android device on the same network as the HA server.
Each day I receive the notification I press what I believe to be the “action” button circled in the image above. This causes the notification to go away, and nothing else. I have also tried swiping the notification to the left and right. If I press on the notification (but not the button) it brings up the HA mobile app and clears the notification.
I am using the modified blueprint from Ansios. Originally each houseplant shared a single date helper, but after a few days of getting daily unexpected notifications I created unique helpers for each automation. This didn’t change the behavior any.
I am a novice at using the trace tool to follow an automation, so I tried the next best thing and used the extra action fields to turn on a light (hurray for that degree in Computer Engineering lol). The light is always red (need_water_action), never green (had_water_action).
alias: Bamboo Palm
description: Add an actionable notification to water the plant.
use_blueprint:
path: Getslow/plant-water-schedule-notif-updated.yaml
input:
reminder_time: "14:00:00"
plant_date: input_datetime.bambo_houseplant_helper
interval_days: 3
plant_begin_month_off_season: 11
notification_title: Bamboo Palm houseplant needs water. (Kitchen)
notification_message: >-
Only water the soil when it looks dry down ~1/3 from the top. Water the
top surface, aim to keep the soil uniformly moist (NOT wet).
action_name: Houseplant has been watered.
notify_device: bf2f93d4570adc450808d6903518414d
need_water_action:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 255
- 0
- 0
target:
entity_id: light.display_case
had_water_action:
- action: light.turn_on
metadata: {}
data:
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.display_case
plant_image: >-
https://www.5280flowers.com/media/catalog/product/cache/ad450b5e51a305c062edf67959c39085/b/a/bamboo_palm-5280gflowers-.png
Is there anything glaringly obvious that I missed in either the blueprint setup or with the actual notification action?