Filter events from particular device (known by entity_id)

I need to trigger a callback whenever a button is pressed (it is an IKEA Tradfri “action” button if that matters). It is connected through a Conbee II stick.
In the Event Listener, I see the corresponding events. I also have been able to subscribe to these.
However, this seems not to work directly by entity_id. In what is passed to the listener I see a device_id and a unique_id, but these are not what I have as setup specification in my apps.yaml file. There, I have the corresponding device_ids.

So my questions are:

  • How do I get these ids, given the device_id ?
  • Is this the right way to subscribe to button clicks, or is there a better way?

Here is how I registered the callback (‘xxxxx’ is the unique_id I looked up in the event listener):

self.listen_event(self._button, "zha_event", unique_id='xxxxx')