Need for access to HA device registry from AppDaemon

HA has a registry that associates entities to device_ids. Roughly speaking, a physical device gets a device_id (assigned by HA, not “unique” in the sense that the same physical device will get a new id when reconnected). Then entities are logical abstractions sitting above a device, e.g., if a sensor provides light, humidity, and temp readings, that might be three sensor entities associated to the same device_id.

I’ve never had a need to access the device IDs until the new Nest integration (based on Google’s SDM API). There events (like camera_motion or camera_person, etc.) are fired with a device_id. I would like to listen to those events in AppDaemon, but for that I need a way of looking up the device_id of an entity.

I don’t know the HA philosophy on these levels of abstraction, so I understand a possible argument that it is “inappropriate” for AppDaemon to access the device registry. In that case, it’s the Nest integration that is problematic.

Were you able to solve this issue? I encounter the same problem with Conbee-integrated devices.

(Update: my solution for the moment is to use the “ieee” address, which at least remains constant. But it seems cumbersome to deal with an entity name on the HA side and the ieee address when listening for ZHA vents on the AppDaemon side of things. A way to “map” these on the AppDaemon side would be good)

I was able to solve it because HA moved to stable device_id’s (a device gets issued the same ID every time, presumably based on some sort of meta information). I still don’t know if HA provides the functionality to lookup such IDs.