Hi together,
I am running Home Assistant 2022.3.8 on RaspberryPI (Version core-2022.3.8;|Installation Type: Home Assistant OS) and encountered the following issue:
I created multiple scrape sensors like this:
sensor:
- platform: scrape
resource: https://www.xyz.com
select: ".XYZ"
index: 2
value_template: '{{ ((value.strip())| replace ("\n", " ")) }}'
scan_interval: 600
name: scrape_name_1
- platform: scrape
resource: https://www.xyz.com
select: ".XYZ"
index: 3
value_template: '{{ ((value.strip())| replace ("\n", " ")) }}'
scan_interval: 600
name: scrape_name_2
and an automation like this:
- id: '1234567'
alias: Notify_test
description: ''
trigger:
- platform: state
entity_id: sensor.scrape_name_1
- platform: state
entity_id: sensor.scrape_name_2
condition: []
action:
- service: notify.telegramNotify
data:
message: >-
{{ trigger.to_state.attributes.friendly_name }} changed from "{{
trigger.from_state.state }}" to "{{ trigger.to_state.state }}"
mode: queued
The problem lies with the first part of the message, where I want to get the name of the trigger. If I remove this, all works fine. If I leave it in, no message gets send. When I use
{{ trigger.id }}
I get the index of the trigger (0 or 1), but eg.
{{ trigger.entity_id }}
already does not work.
I already tried a bunch of options, but nothing seems to work. Does the scrape-sensor as a trigger not provide its friendly_name?
Thank you for any advice!
Best,
Johannes