Persistent_notification Template

So I’ve been trying to add an automation that will do the following:
When I get home, If any of my plants need water, wait 15mins, create a notification in the UI & send me an alert to my phone.

I’ve got most of it figured out, but can’t seem to wrap my head around the persistent_notification template. Here’s what I’ve got…

- id: plant_notifications
  alias: Plant Notifications
  trigger:
    platform: state
    entity_id: group.presence
    from: not_home
    to: home
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: group.all_plants
      state: 'problem'
    - condition: state
      entity_id: input_boolean.company
      state: 'off'
  action:
  - delay: 00:15:00
  - service: persistent_notification.create
    data:
      title: "Plant Needs Attention"
      message: {% if is_state('plant.livingroom_moneytree', 'problem') %}
                 Money Tree Needs Water
               {% elif is_state('plant.office_pothos', 'problem') %}
                 Pothos Needs Water
               {% endif %}
  - service: notify.ios_jon_iphone
    data:
      message: "Plant Needs Attention"

I’m pretty sure this needs to be a data_template, but I’m not positive, figured I’d ask…

Thanks for the help!

Try this:

  trigger:
    platform: state
    entity_id: group.presence
    from: not_home
    to: home
  condition:
    condition: and
    conditions:
    - condition: state
      entity_id: group.all_plants
      state: 'problem'
    - condition: state
      entity_id: input_boolean.company
      state: 'off'
  action:
  - delay: 00:15:00
  - service: persistent_notification.create
    data_template:
      title: "Plant Needs Attention"
      message: >
        {% if is_state('plant.livingroom_moneytree', 'problem') %}Money Tree Needs Water
        {% elif is_state('plant.office_pothos', 'problem') %}Pothos Needs Water
        {% endif %}
  - service: notify.ios_jon_iphone
    data:
      message: "Plant Needs Attention"
1 Like

Thanks! I’ll give this a try when I get home…