Automation in question. 2 motion detectors in same automation triggering a telegram message to be sent to me.
- id: 'xxxxxxxxxxxxxxxxxxxxxxxxxx'
alias: Motion
description: ''
trigger:
- type: motion
platform: device
device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
entity_id: binary_sensor.upstairs_hallway_motion_detector_ias_zone
domain: binary_sensor
- type: motion
platform: device
device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
entity_id: binary_sensor.stairwell_motion_detector_ias_zone
domain: binary_sensor
condition:
- condition: state
entity_id: input_boolean.motion_alarm
state: 'on'
action:
- service: telegram_bot.send_message
data:
message: "Motion has been detected from {{ state_attr(trigger.entity_id, 'friendly_name') }}."
Is there any way to add information to each trigger? In my message sent through telegram, I want to say something
Motion has been detected from Downstairs Hallway Motion Detector
Things I have tried:
- If you look above, I’ve already tried grabbing the state_attr, but it did not work. My entity ID has underscores in it which I think messages up the parsing.
- trigger.entity_id works but still has a non-friendly name.
Is it possible to somehow add in a variable to each trigger and call upon that variable in the message?