Entity name in Android notification

Hi!
i’ve got problem with getting proper notification from HA. It’s notification about getting garbage :slight_smile:

alias: Nowa automatyzacja TEST
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.next_bio_collection
      - sensor.next_metal_collection
      - sensor.next_mixed_collection
    to: 2 dni
    for:
      hours: 11
      minutes: 13
      seconds: 0
condition: []
action:
  - service: notify.mobile_app_hd1903
    data:
      title: HA Odpady
      message: Odbiór odpadów za 2 dni "{{ state_attr(trigger.entity_id, 'friendly_name') }}"
mode: single

then I get error:
Error: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘entity_id’

i’d like to show in notofication which sensor was the trigger:
- sensor.next_bio_collection
- sensor.next_metal_collection
- sensor.next_mixed_collection

I have a notification to tell me which bin to leave out :

service: notify.mobile_app_sm_g991b
data:
  message: >-
    Take out the  {% if 'Recycling' in states('sensor.next_collection')
    %}recycling {% else %} rubbish {% endif %} bin.
  title: Home Assistant
  data:
    actions:
      - action: bins
        title: Done
    group: Home

Whilst this doesn’t answer your question of why the entity_id is unknown :slight_smile: it may help your end goal :slight_smile:

1 Like

Interesting alternative. Thanks.

Although it doesn’t match the error message, that will surely not work. Try:

      message: >
        Odbiór odpadów za 2 dni "{{ state_attr(trigger.entity_id, 'friendly_name') }}"
1 Like

It works. Good walk around.

alias: Najbliższy odbiór odpadów
description: ""
trigger:
  - platform: state
    entity_id: sensor.next_collection
    to: Jutro
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - service: notify.mobile_app_hd1903
    data:
      message: ODBIERAJĄ {{ states('sensor.next_collection') }}
      title: HA Odpady
mode: single

Thanks a lot for help. You solve my problem.
Although I can check it only with trigger.