How to get list of notify groups in script?

Hi, i’ve defined following groups inside configuration.yaml:

notify:
  - name: group_parents
    platform: group
    services:
        - action: device_manuel
        - action: room_living
  - name: group_children
    platform: group
    services:
        - action: room_jonas
        - action: room_lena
  - name: group_all
    platform: group
    services:
        - action: group_parents
        - action: group_children
  - name: room_living
    platform: group
    services:
        - action: alexa_media_firetv_wohnzimmer
  - name: room_bedroom
    platform: group
    services:
        - action: alexa_media_firetv_schlafzimmer
  - name: room_jonas
    platform: group
    services:
        - action: alexa_media_alexa_jonas
  - name: room_lena
    platform: group
    services:
        - action: alexa_media_alexa_lena
  - name: room_workroom
    platform: group
    area: Arbeitszimmer
    services:
        - action: alexa_media_alexa_arbeitszimmer
  - name: device_manuel
    platform: group
    services:
        - action: mobile_app_pixel_8_pro

Now, which command helps me, get the list of all notify groups as array? I’ve tried it with differente variables but doesn’t get it.

What do you mean?

E.g. I can get with area_entities('12345') a array of devices, which resists inside the area of 12345. Now I want get a array of all defined notify definitions for working with inside a script, i’m currently writing. I want e.g. a list like

['groups_parents', 'groups_children', ...]

Setting up a notify group creates a new service/action, not a device or entity. AFAIK, there isn’t currently a way to get them through templates. Notifications are being overhauled to make that possible, but it’s still only in the early stages.

I am still quite new to Homeassistant and am currently porting functionalities from my old smart home system. Do you have a link with documentation or an example of what you mean?

There’s nothing to link… the functionality does not exist yet for the vast majority of notification integrations.

For now we have to use things like Templated Repeats or multiple, independent Choose actions.

If you can share an example of what you want to do, we can likely give you some guidance on how to get there with the current available tools.

I would like to finally build a blueprint which I would like to use for the notification of windows.

This should work as follows:

  • The blueprint is called once a minute
  • All sensors that are open are queried
  • The open sensors are checked to see if they have been open for a certain time
  • If it is the case that this time has been reached, a notification should be sent

My idea is then: Based on the room in which the sensor is located, a notification group with the same name should be determined, to which a notification is then sent.

For further explanation of the following variables:

  • notificationTriggerResolution corresponds exactly to the time how often the blueprint is called in seconds (60 seconds = 1 Minute call intervall)
  • notificationTriggerPeriod corresponds to the interval at which the notification is played
{%- set notificationDevices = expand('binary_sensor.hmip_swdo_0000e0c9a45fc2') | sort(attribute='last_changed') | selectattr('state', 'eq', 'on') | list -%}

{%- for notificationDevice in notificationDevices -%}

  {%- set notificationTriggerPeriod = 60 * 2 -%}
  {%- set notificationTriggerResolution = 60 -%}

  {%- set deviceTriggerTimestamp = (as_timestamp(now()) - as_timestamp(notificationDevice.last_changed)) | round(0) % notificationTriggerPeriod -%}

  {%- if deviceTriggerTimestamp < notificationTriggerResolution -%}
    Sensor device area: {{ area_name(notificationDevice.entity_id) }}
    ... notification code here...
  {%- endif -%}
{%- endfor -%}

Note: The example is currently still limited to one sensor that I am testing with

I hope I was able to explain well what I want to do :see_no_evil: