Hi, I am trying to extract the ‘name’ of a device id in a notification but can’t find a way to do it.
Below is the yaml code for a basic automation where if there is a ‘trigger.event.data.command_class == 113’ happening, I would like to receive a Pushover notification with the name of the device_id on wich there was a 113 event. Unfortunatlty, I can’t seem to find any way to get the ‘name_attr’ to be sent
Anybody can help with this ?
Here is my latest try where I have the following error message ‘Error: Error rendering data template: TypeError: attribute name must be string, not ‘LoggingUndefined’’
alias: Serrures Notification Pushover
description: ""
trigger:
- platform: event
event_type: zwave_js_notification
event_data: {}
condition:
- condition: template
value_template: "{{trigger.event.data.command_class == 113}}"
action:
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: notify.pushover_serrures
data:
message: |-
{% set Lock_State_Array = {
"Lock state: Lock jammed": 'Moteur bloqué',
"Keypad lock operation": 'Barrée par le claiver',
"Keypad unlock operation": states('input_text.serrure_cabanon_last_user_name') ,
"Manual lock operation": 'Barrée manuellement' ,
"Manual unlock operation": ' Débarrée manuellement',
"RF lock operation": 'Barrée par RF',
"RF unlock operation": 'Débarrée par RF',
"Auto lock locked operation": 'Barrée automatiquement',
"Battery level status: Charge battery soon": 'Changer les piles bientôt',
"Battery level status: Charge battery now": 'Changer les piles immédiatement'
} %}
{{ Lock_State_Array[ trigger.event.data.event_label ]}}
title: "{{ device_attr(trigger.event.data.device_id,attr_name) }}"
target:
- iphonebruno
data:
sound: spacealarm
mode: single