How to bring multiple automations to notify error condition on devices into one

I have a series of very simple trigger-based automations to notify me of connectivity issues of our new Tado X devices (one may be on edge of range). Currently have three separate ones for the three devices I want to actively monitor, with each similar to the following (IDs removed):

alias: "Tado X Disconnected: Bedroom"
triggers:
  - type: not_connected
    device_id: ###############################
    entity_id: ###############################
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 5
      seconds: 0
conditions: []
actions:
  - action: notify.email
    metadata: {}
    data:
      message: >-
        The Tado Radiator Thermostat X device in the Bedroom disconnected 
        at around {{ now().strftime('%H:%M:%S') }}
      title: "Tado Radiator Thermostat X error: disconnected"
mode: single

I would ideally like to turn the three automations into one that would look for the event from the three devices and be able to adjust the text in the notification (email) to say which device caused the trigger rather than having three automations with the device and message hard-coded.

Is this possible?
How would you do this?

I am only just starting to work with more complex automations and have searched for examples and the documentation but haven’t found how to do this.

If you can make the trigger a state trigger instead then you get more powers from it.
Device triggers/condition/actions should be avoided.

But given the code you have here it seems to be a binary sensor, so just create a state trigger on the binary sensor.
With that you can then use the {{ trigger }} variable.
Automation Templates - Home Assistant

  - action: notify.email
    metadata: {}
    data:
      message: >-
        The {{ trigger.from_state.attributes.friendly_name }} device in the {{ area_name(trigger.entity_id) }} disconnected 
        at around {{ now().strftime('%H:%M:%S') }}
      title: "Tado Radiator Thermostat X error: disconnected"

the above is a guess, might work, might not.
Make a copy of your current automation to test it on.

To build on what Hellis has said, learn more about what you have available on the state object. That will unlock many options for you.

In particular, look at what’s available on the state trigger:

Here is one of mine. It still needs a small bit of refinement.

There are other similar automations in that file where the conditions are somewhat different.

And here’s how I monitor my Internet connection:

1 Like