Mapping device id returned by device selector to an entity or attribute

I have a simple blueprint where I would like to allow the user to select a device of a specific type.

To do so, I’ve created the following input with a selector:

    hasp_name:
      name: HASP Device
      description: "Select the HASP device"
      selector:
        device:
          manufacturer: "HASwitchPlate"
          model: "HASP v1.0.0"

That part works as expected, I am using MQTT discovery on the device which looks something like this:

Topic: homeassistant/binary_sensor/plate01/config
Payload:

{"device_class":"connectivity","name":"plate01 connected","state_topic":"hasp/plate01/status","availability_topic":"hasp/plate01/status","unique_id":"plate01-24a1602ea5a","payload_on":"ON","payload_off":"OFF","payload_available":"ON","payload_not_available":"OFF","device":{"identifiers":["plate01-24a1602ea5a"],"name":"plate01","manufacturer":"HASwitchPlate","model":"HASP v1.0.0","sw_version":"0.41"}}

When my device is selected, hasp_name is populated with the device id, something like 3fde16be76f2758625733f72e25d569f. What I’d like to do is to somehow get a hold of the string plate01 from that device id. Is there any means, through templates or through the blueprint workflow, for me to obtain that information when a user selects a device through the device selector?

4 Likes