Automation to notify if any plants require watering?

So I’m currently playing around with plant sensor and I’m already realizing that it’s going to be tedious to define automations for every single plant reminding me to water them.

I know I could probably write a Python script that iterates through all my plants and figures out which ones need watering, but for now I figured I could do with an easier solution.

Can I simply use the group.all_plants and define an automation that will notify if any plants are problematic?

Did you find an elegant solution ?

Well, OP never posted any relevant information about his plant sensors. I would assume this is why no one assisted him. If you can post information about your plant sensor, people may be able to help. I personally ordered a few plant sensors and they arrive in about 3 weeks. I’ll be tackling this issue first hand. However, I know that they don’t have a ‘hey water me’ attribute. Meaning the automation may differ depending on the plant sensor.

I have a few plants and 1 group called all_plants.
The idea would be an automation that check all the entity of the group and notify if there is a problem with the detial of the problem

Ok, for you I would expect and automation like this:

- alias: Notify of plant problem
  trigger:
  - platform: state
    entity_id: group.plants
    to: problem
  action:
  - service: notify.notify
    data_template:
      message: >
        {%- set problems = expand('group.plants') | selectattr('state','eq','problem') | list %}
        {%- if problems | count > 1 %}
          There are {{ problems | count }} problems:
        {%- else %}
          There is 1 problem:
        {%- endif %}
        {%- for problem in problems %}
          {{ problem.name }} - {{ problem.attributes.problem }}
        {%- endfor %}
1 Like

Thousand of thanks, it works perfectly as I wanted :slight_smile:

Thanks! this helped me out a lot! Works perfectly
Is there a way to have friendly names for the plants and the problems the plant has?

the template does that already…

But my plant is listed as: plant_case and the problem is in English. Don’t mind but want to perfect the message, also for google assistant later on.

that’s the friendly_name. Are you sure you renamed the plant? You can also try

problem.attributes.friendly_name

and the problem will be in English because the attribute problem is in english. You’ll have to translate it if you want another langauge.

So this is my MiFlora plant:

- platform: miflora
  mac: 'C4:7C:8D:67:8B:15'
  monitored_conditions:
    - moisture
    - light
    - temperature
    - conductivity
    - battery
  name: 'Case'

I’ve named him Case.
Then I made a plant entitie:

plant_case:
  sensors:
    moisture: sensor.case_moisture
    battery: sensor.case_battery
    temperature: sensor.case_temperature
    conductivity: sensor.case_conductivity
    brightness: sensor.case_light_intensity
  min_moisture: 15
  max_moisture: 60
  min_battery: 10
  min_conductivity: 350
  max_conductivity: 2000

But here I can’t give it a friendly name.
My group looks like this:

plants:
  entities:
    - plant.plant_case
    - plant.plant_marty
  name: Alle planten

And this is my automation to notify which plant is having problem:

- alias: Notify of plant problem
  trigger:
  - platform: state
    entity_id: group.plants
    to: problem
  action:
  - service: telegram_bot.send_message
    data_template:
      message: >
        {%- set problems = expand('group.plants') | selectattr('state','eq','problem') | list %}
        {%- if problems | count > 1 %}
          Er zijn {{ problems | count }} problemen:
        {%- else %}
          Er is 1 probleem:
        {%- endif %}
        {%- for problem in problems %}
          {{ problem.name }} - {{ problem.attributes.problem }}
        {%- endfor %}

I can see there is a friendly_name for each plant. but it’s shown as plant_case.
If I try to add friendly name myself to the plant my configuration checker says that friendly name is not an valid option for plant.

Name your plant via the UI in Configuration -> Customizations or in customizations.yaml

1 Like

That did the trick! thank you!

Hi. I am having problems with the messages that are generated. It doesn’t show the plant name or error just says “There is 1 problem:”. What is wrong in here as I can’t seem to figure it out?

Here is the plant attributes:

problem: none sensors: moisture: sensor.blue_fern_moisture battery: sensor.blue_fern_battery temperature: sensor.blue_fern_temperature conductivity: sensor.blue_fern_conductivity brightness: sensor.blue_fern_light_intensity unit_of_measurement_dict: moisture: '%' battery: '%' temperature: °C conductivity: µS/cm brightness: lx moisture: 45 battery: 100 temperature: 22.8 conductivity: 1869 brightness: 2794 max_brightness: 2794 friendly_name: Blue Fern

Did you find a solution for your problem?