Passing device friendly name from in notification

Hey all,
I currently have 3 aqara flood sensors. At the moment, I’ve only set 2 of them up (one at either end of my basement). I created a group for these sensors (which I’ll add any new flood sensors to in the future) and setup an automation to alert me if one of them detects water for longer than 15 seconds (See below for the yaml on existing).

I would like to pass the friendly name of the device which triggered to the notification. For example, if I place the third sensor beneath my kitchen sink and it detects water, the device friendly name would tell me precisely where to look for a leak. However I can’t wrap my head around the format/syntax for this to work.

Ideally, a notification would read along the lines of “water detected at: Basement Flood North”

yaml of existing notification:

alias: Flood Detected Notification
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.flood_sensor
    to: "on"
    for:
      hours: 0
      minutes: 0
      seconds: 15
condition: []
action:
  - service: notify.mobile_app_kb2005
    data:
      message: Flood Detected
mode: single
  - service: notify.mobile_app_kb2005
    data:
      message: "water detected at: {{ trigger.to_state.name }}"

should do it.

OK , I think that worked.

New problem, it seems I can’t get the app on my phone to give notifications. Wife and I have same model of phone so it appears identical in HA, she is getting all of the notifications and I am getting none of them.

1 Like

Did you ever find out how to fix this? I’m having the exact same problem. Changing the name of our phones in HA is also no use as for some reason the notification setting uses the model instead of the device name.

you mean the problem I had with notifications?
yes, the problem is my wife and I have the same model phone. I deleted the app from my phone, leaving only hers. I renamed the entity for her phone, then I connected my phone again and gave mine a unique name as well, now i can easily target either phone for notifications.

1 Like