I did a search but came up empty sadly. Basically- I have a group of water sensors. I simply want to be able to update the group itself (or rather use a template for it at some point) so the group is always updated with water sensors (or anything I decide to make a group of later- ie. window sensors, etc.)
I have an automation that watches that group state to turn to on. What I would like to do is get the specific sensor that is changing so I can put it in the notification.
Here is my automation:
alias: Sensors -- Water -- Send to ntfy
description: Notify via ntfy high priority that a water sensor detects water.
trigger:
- platform: state
entity_id:
- binary_sensor.water_sensors
to: "on"
for:
hours: 0
minutes: 0
seconds: 10
condition: []
action:
- data:
variables:
emoji: droplet
priority: high
title: Water detected!
message: >-
Detected moisture at {{ trigger.to_state.attributes.friendly_name }}
target:
entity_id: script.ntfy_notification
alias: ntfy- high
action: script.turn_on
mode: single
The template simply outputs “Water sensors” as the friendly name (which makes sense I suppose.) Is there some way to get this info directly or do I need to do a template where I loop over every member of the water sensor group and then check for state “on” using jinja filters? Didn’t know if there was a simple solution that Home Assistant provides like the trigger.to_state kind of method.