How to set unique id for an entity?

When I click on the gear for my mqtt sensor, I get this popup:
image

There are a number of topics related to this but I didn’t find an actual answer of how to do it.

This is the definition of my sensor in mqtt.yaml:

sensor:
  - name: "DWA Temperature"
    state_topic: "davea/feeds/temperature"
    suggested_display_precision: 1
    device_class: temperature
    unit_of_measurement: "°F"
    value_template: "{{ value_json.temperature | int }}" 
    json_attributes_topic: "davea/pyportal/feed"
    json_attributes_template: >
      { "humidity": {{ value_json.humidity }}",
        "relative_humidity": {{ value_json.relative_humidity }}"}

Please let me know if this should be posted in a different category

You need to add unique_id to your definition:

sensor:
  - name: "DWA Temperature"
    unique_id: 2dfb8359-0b94-48cd-9909-422ce8418fe0
    state_topic: "davea/feeds/temperature"
    suggested_display_precision: 1
    device_class: temperature
    unit_of_measurement: "°F"
    value_template: "{{ value_json.temperature | int }}" 
    json_attributes_topic: "davea/pyportal/feed"
    json_attributes_template: >
      { "humidity": {{ value_json.humidity }}",
        "relative_humidity": {{ value_json.relative_humidity }}"}

This is made super easy by the Studio Code Server add-on where you can type that key name and right click and get it to create a new UUID for you:

image