Can i add something unique to the mqtt message which is send out

i noticed that esphome is sending out a complete mqtt string so that it can be used for MQTT AD.

it uses ESP??? for it’s unique id
eg ESPsensormeterkast_temperatuur

is it possible from esphome to add something to that mqtt message

eg change the defualt ESP to somthing like ESPtest

Show the yaml of one of your ESPhome devices( remembering to hide anything sensitive). None of my esphome devices use ESP as part of the unique id.
Are you not able to adjust throught settings/devices&services/entities not change the unique ID through the cogwheel?

i am only using esphome, not jhom assistant so i need to change things in the code
the only way i can change the unique id is to change the name of the sensor
the mqtt name will then be for example ESPselectgong_status
The ESP part is added by esphome by default

  • discovery_unique_id_generator (Optional, string): The unique_id generator to use. Can be one of legacy or mac. Defaults to legacy, which generates unique_id in format ESP<component_type><default_object_id>. mac generator uses format <mac_address>-<component_type>-<fnv1_hash(friendly_name)>.

when i set this to mac i get this
the last part is not using the friendly name so also unusable because it is not recognizable

unique_id: 8856a66d1d50-button-ab637aab

i was looking for an mqtt optio so i could add or change the prefix to make it unique

esphome:
  name: esp32-dingdonggong
  friendly_name: ESP32-DingDongGong

esp32:
  board: esp32-c3-devkitm-1
  framework:
    type: esp-idf

# Enable logging
logger:
  level: VERBOSE
  baud_rate: 0 ## Must be 0 to prevent reading issues and buffer overflows

# Enable Home Assistant API
api:
  reboot_timeout: 0s

ota:
  - platform: esphome
    password: "xxxxxxxxxxxxxxxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  min_auth_mode: WPA2

  manual_ip:
    static_ip: 192.168.1.xxx
    gateway: 192.168.1.1
    subnet: 255.255.255.0

mqtt:
  broker: 192.168.1.50
  username: ""
  password: ""
#  publish_nan_as_none: True

web_server:
  local: true

output:
  - platform: gpio
    pin: GPIO0
    id: relais
    inverted: False

sensor:
- platform: wifi_signal
  name: "-WiFi Signal Sensor"
  update_interval: 60s
  discovery: false

- platform: internal_temperature
  name: "-ESP32 CPU Temperatuur"
  discovery: false

button:
  - platform: restart
    id: restart_button
    name: -Restart
    entity_category: diagnostic
    discovery: false

  - platform: template
    name: DingDong
    id: ding_dong
    on_press:
        if:
          condition:
              lambda: 'return id(gong_status).current_option() == "Gong Aan" ; '
          then:
            - output.turn_on: relais
            - delay: 300ms
            - output.turn_off: relais

select:
  - platform: template
    name: Gong Status
    id: gong_status
    options:
     - "Gong Uit"
     - "Gong Aan"
    initial_option: "Gong Uit"
    optimistic: true
    set_action:
      - logger.log:
          format: "Chosen option: %s"
          args: ["x.c_str()"]

If you are not using Home assistant then you can disable api.