YAML Help required

Hi All !

I have some door sensors and I have created a continuous notification to my mobile if the alert is triggered.
Alarmo is the integration I’m using but the notification is only one time inside Alarmo therefore I have created an automation, which in fact works well it’s continuously notifying me, but only with a Standard hardcoded message.
What I would like to have is to show the Sensor Friendly Name in the notification I’m getting to see which door has been opened.
I have tried many ways to include device id, entity id, sensor and get the name but I’m pretty new with YAML and just can’t get to the right syntax.
Can you please help how am I supposed to extend the code:

alias: Alarm Notification
description: ""
trigger:
  - platform: device
    device_id: ed2aa6c305f9e1cbac8c7af8c3827801
    domain: alarm_control_panel
    entity_id: 08a06ac6ceac07c4311119a7fff4432d
    type: triggered
condition: []
action:
  - repeat:
      sequence:
        - service: notify.mobile_app_viktor_oneplus
          data:
            message: "Alarm:" <Sensor Friendly name should go here>
      until:
        - condition: device
          device_id: ed2aa6c305f9e1cbac8c7af8c3827801
          domain: alarm_control_panel
          entity_id: 08a06ac6ceac07c4311119a7fff4432d
          type: is_disarmed
mode: single

Well… you’re limited by the fact that you’re using device ids, which don’t support templating.

I’ve created this automation via the UI . But I’m happy to change to entity if you help me with the final solution :slight_smile:

Copy-paste the following template into the Template Editor and report the results.

{{ device_entities('ed2aa6c305f9e1cbac8c7af8c3827801') }}

It will list all the entities associated with the alarm system. Let us know which entities in the list represent your doors.

Not regarding to your actual problem, but your use case practically “screams” for the alert integration in HA. :slight_smile:

That’s the result:

[
  "alarm_control_panel.alarmo"
]

it’s not listing anything.

But this is my sensor entity:  binary_sensor.lumi_lumi_sensor_magnet_aq2_opening

I will take a look thx.

Are you saying there’s only one door?

If there’s only one door then you can hard-code the door’s name in the message or do this:

      sequence:
        - service: notify.mobile_app_viktor_oneplus
          data:
            message: >
              Alarm: {{ state_attr('binary_sensor.lumi_lumi_sensor_magnet_aq2_opening', 'friendly_name') }}

If there’s more than one door then we need a list of the binary_sensors that represent each door.

1 Like

Yeah, that’s working thank you :slight_smile: At the moment there is only one sensor since I was just testing the whole Skyconnect Zigbee Hub with one Sensor to see if the whole thing works with the HA and since it’s working nice I’ll buy the rest of the sensors next week.

May I ask you to please give me an example what would be the right syntax to list more sensors ?

      sequence:
        - service: notify.mobile_app_viktor_oneplus
          data:
            message: >
              Alarm: {{ expand('binary_sensor.lumi_lumi_sensor_magnet_aq2_opening', 
              'binary_sensor.second', 'binary_sensor.third', 'binary_sensor.etc')
              | selectattr('state', 'eq', 'on') | map(attribute='name')
              | list | join(', ') }}
1 Like

Thank you very much for you help. I’ll test next week as soon as I’ll have the rest of the sensors in hand.

1 Like