How to trigger automation when any (!) new Z2M device is added?

Right now I am using Z2M, so far so good. What I would like is an entity or anything that can trigger an automation in HA whenever any new device is added to Z2M, so when a new MAC address is added to the device list.
How can I set up something like this?

I don’t use Z2M so I don’t know if there’s a more specific event, but I use the following to get notified about new entities being added to HA:


  trigger:
  - platform: event
    event_type: entity_registry_updated
    event_data:
      action: create

  action:
  - service: notify.persistent_notification
    data:
      title: Neue Geräte entdeckt!
      message: |
        Neu:
        * {{ trigger.event.data.entity_id }}
  mode: queued
  max: 40

1 Like

Many thanks I will try this!

Easy:

id: 'zigbee2mqtt_devices'
alias: 'Zigbee2MQTT device joined or left'
initial_state: 'on'
trigger:
  - platform: mqtt
    topic: "zigbee2mqtt/bridge/event"
condition:
  - condition: template
    value_template: >-
      {{ trigger.payload_json.type == "device_joined" or trigger.payload_json == "device_leave" }}
action:
  - service: notify.discord_webhook
    data:
      message: >-
        :bee: Zigbee device {{ trigger.payload_json.data.friendly_name }} just {{ trigger.payload_json.type }}

That results in messages like:

:bee: Zigbee device 0x0042deadbeefcafe just device_joined

2 Likes