I am trying to do some centralized notifications filtered by different levels (i.e. debug, normal, alarm). for the debug notifications i’d like to pull the alias of the automation that triggered the event to make it more reusable. is there a this
object for an automation or something else i can use to grab the alias and pass it on to my notification script?
Pretty sure it is the friendly_name
attribute of the automation entity.
Yes, I can see that in the states
section of developer tools, but what I am trying to figure out is how do I get the automation entity within the automation itself. I am trying to dynamically get the friendly name of the currently running automation.
I assume from your first post that you are referring to a automation_triggered
event. The info is in the event, eg
event_type: automation_triggered
data:
name: Motion top of stairs off
entity_id: automation.motion_top_of_stairs_off
source: state of binary_sensor.motion_top_of_stairs_occupancy
origin: LOCAL
time_fired: "2023-01-11T20:42:14.331986+00:00"
context:
id: 01GPH93BDV1F41K3DC027MKDVB
parent_id: 01GPH93BDS2QCA32SFANNY2R4M
user_id: null
i finally found that page as well, thank you!!! problem is i cannot get it to work. the call in the automation looks like this:
service: notify.haapp_sebs_devices
data:
message: 'Automation name: {{ this.name }}'
but that always returns a blank message.
In theory it should work (because name
is a property of the automation’s state
object) but, you’re right, I tested it and it failed to work.
Use this (tested and confirmed to work):
this.attributes.friendly_name
That did it! thank you!!!