I’ve done some searching and my assumption is that what I’m after isn’t really possible currently, but figured I’d ask as I’ve certainly been wrong before.
Currently I have an automation to let me know if any plants need to be watered. As it is, I explicitly list every plant (which also happens to be every entity in the plant domain). Is there an (easy) way to do this, but simply trigger via ANY entity in the plant domain (and still allow me to use the friendly name of the triggering entity later on in the actions, so I know which plant needs watered) ? There’s also the added complication that I’m actually wanting to trigger on an ATTRIBUTE changing for a specified period of time. I know wildcards have been a long-standing FR and all the workarounds I’ve come across still require you to manually specify the entities (for instance, via a group or tags). I don’t frequently add/remove plants from HA, but it’s in that sweet spot where it’s frequent enough to be annoying but infrequent enough that I usually forget to modify this automation. Here’s a truncated version of my current automation:
alias: Indoor Plant Water Notifications
description: ""
triggers:
- entity_id:
- plant.aloe_vera
- plant.bromeliad_kitchen
- plant.christmas_cactus
attribute: moisture_status
to: Low
for:
hours: 4
minutes: 0
seconds: 0
trigger: state
conditions: []
actions:
- data:
message: >-
The {{ trigger.from_state.attributes.friendly_name }} needs to be
watered.
title: "{{ trigger.from_state.attributes.friendly_name }}"
notification_id: "{{ trigger.from_state.attributes.friendly_name }}"
action: persistent_notification.create
mode: single
Thanks for the help! This got me basically to what I was after (I think).
I’ve setup a template sensor to give me the count of plants that need watering that I trigger the automation on when it changes for 4 hours (as well as a condition of it not being zero, so it doesn’t trigger when I actually water them):
For now I’m going to run this automation in parallel with my existing one. The only issue I see, is that if a plant is hovering right around the low moisture threshold (so frequently going above and below) it would keep the automation from firing even if other plants have firmly gone below. I know this happens frequently (and is why I arrived at the 4 hour number), but I’ve never really paid attention to how LONG they do this, so it might not really matter.
I’m aware of this, but that’s not what I want (and why I setup a template sensor instead of a trigger template). If subsequent plants go low (so the count goes up), I want it to trigger again (after the 4 hours debouncing time) so that the list of plants needing watering in my notifications gets updated.
I do suspect that I may be entering the realm where I’m going to spend more time/effort automating my automation compared to just trying to remember to add plants to my existing automation (which actually works exactly as I want).
Here’s my current automation (using the template sensor mentioned above as the trigger), just to clarify. I’d still prefer to use a single state trigger (somehow) automatically populated by all entities in the plant domain, but I think this is as close to that as I’m going to get.