message: >
{% set name = states[entityid.split('.')[0]][entityid.split('.')[1]].name %}
{{as_timestamp(now()) | timestamp_custom('%X') }}:
{{-name }} triggered the alarm, check whats up!
{{contextid}} ##<--- renders the id number in the message
but it changes on every trigger… so that isnt very useful at all in finding a way that to connect to the area ;-(
It’s a fairly new attribute (area), I don’t think it would have been introduced without a plan for it’s development. By all means make the feature request but I think it’s happening anyway.
No facts, just my supposition based on it being there in the first place.
but both user_id and parent_id render ‘None’. So, im left with a ‘Id’ that changes every time, and might just as well be the id for the event itself, which is useless for my quest for the area for now…
taking them out again.
why I made the original template for the message so difficult is beyond me…
this does the same and better:
data_template:
title: >
{% set room = entityid.split('.')[1].split('_motion_sensor')[0].replace('_',' ')|capitalize %}
Alarm triggered in the {{room}}
message: >
{% set name = entityid.split('.')[1].replace('_',' ')|capitalize %}
{{as_timestamp(now()) | timestamp_custom('%X') }}: {{name}} triggered the alarm, check whats up!