Notification about new network device with ip address

Hey there, i was looking for an automation to send notifications about newly discovered network devices, but all i found was some older posts saying that it is not possible anymore (or at least with sending the ip address) cause entity_registry_updated event is no longer fired for new device_trackers. All the automations i found did not work for me as expected (did not send ip address or not even host name)
So i tinkered around and this works now for me. Maybe it is helpful. If a post like this exists already, please delete my post. Thank you :slight_smile:

alias: New Network Device | Notification
description: ""
triggers:
  - event_type: device_tracker_new_device
    trigger: event
actions:
  - data_template:
      title: New Device Detected
      message: >
        {% set entity = states[trigger.event.data.entity_id] %} {% if entity and
        'ip' in entity.attributes %} Hostname: {{trigger.event.data.host_name}} 
        IP-Adress: {{ entity.attributes.ip }} MAC Address:
        {{trigger.event.data.mac}} HA Entity ID:
        {{trigger.event.data.entity_id}} {% endif %}
    action: persistent_notification.create
  - action: notify.mobile_app_iphone14
    metadata: {}
    data:
      message: >
        {% set entity = states[trigger.event.data.entity_id] %} {% if entity and
        'ip' in entity.attributes %} Hostname: {{trigger.event.data.host_name}} 
        IP-Adress: {{ entity.attributes.ip }} MAC Address:
        {{trigger.event.data.mac}} HA Entity ID:
        {{trigger.event.data.entity_id}} {% endif %}

1 Like