Get device's friend_name and entity_id from device_id

when new device add in my hass, I want to know.
I used automation to get device_id when new device access.

alias: event_test
description: ''
trigger:
  - platform: event
    event_type: device_registry_updated
    context: {}
condition: []
action:
  - service: mqtt.publish
    data:
      topic: /event/test
      payload_template: '{{ trigger.event.data|to_json(ensure_ascii=False) }}'
mode: parallel
max: 20

I want to konw this device’s friend_name and entities that belong to this device from device_id automatically?
I don’t know if this demand can be realized ,hahaha!
please help me ,thanks!

1 Like