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?
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 %}
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.
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?