Device automation + entities

I used MQTT Device Trigger guide to create a new device:

Now I want to add some entities to this device, but I can’t figure out how.

I followed the guide on MQTT discovery, and used the device id from the previous guide. The entities are added but are not lined to the device. I tried something like:

discovery_topic: 'homeassistant/binary_sensor/0x90fd9ffffedf1266/config'
discovery_payload: {'name':'door','device_class':'door','state_topic':state_topic}

I am just trying to apply some basic logic so not sure if this is the right way?

Thanks.