[MQTT discovery] Wrong entity_id names (unnamed_device)

Hello! I am implementing the MQTT Hass discovery into our hotel automation software (Giano, the Hotel Supervisor) but we have problems with entity_id names.

This is discovery payload sent (with retain) to the topic ‘homeassistant/device/gzcdev-000000000000/config’:

{
   "device":{
      "identifiers":[
         "gzcdev-000000000000"
      ],
      "connections":[
         [
            "ip",
            "192.168.1.128"
         ],
         [
            "mac",
            "00:1c:42:1c:96:88"
         ]
      ],
      "name":"GZC-Dev gzcdev-000000000000",
      "manufacturer":"GFP Lab S.r.l.",
      "model":"GZC-Dev",
      "model_id":"gzcdev",
      "configuration_url":"http:\/\/192.168.1.128",
      "hw_version":"1.0",
      "sw_version":"6.0",
      "serial_number":"000000000000",
      "suggested_area":"building"
   },
   "origin":{
      "name":"Giano Zone Controller",
      "sw":"6.0 r7548 (2025\/11\/03 16:56.42)",
      "support_url":"https:\/\/support.gfplab.com"
   },
   "components":{
      "binary_power":{
         "platform":"binary_sensor",
         "name":"Main power",
         "unique_id":"gzcdev-000000000000_binary_power",
         "default_entity_id":"gzcdev-000000000000_binary_power",
         "device_class":"power",
         "payload_on":true,
         "payload_off":false,
         "value_template":"{{ value_json.power }}"
      },
      "binary_vbus":{
         "platform":"binary_sensor",
         "name":"Bus voltage",
         "unique_id":"gzcdev-000000000000_binary_vbus",
         "default_entity_id":"gzcdev-000000000000_binary_vbus",
         "device_class":"power",
         "payload_on":true,
         "payload_off":false,
         "value_template":"{{ value_json.vbus }}"
      },
      "binary_battery":{
         "platform":"binary_sensor",
         "name":"Battery",
         "unique_id":"gzcdev-000000000000_binary_battery",
         "default_entity_id":"gzcdev-000000000000_binary_battery",
         "device_class":"battery",
         "payload_on":true,
         "payload_off":false,
         "value_template":"{{ value_json.battery }}"
      },
      "binary_configured":{
         "platform":"binary_sensor",
         "name":"Configured",
         "unique_id":"gzcdev-000000000000_binary_configured",
         "default_entity_id":"gzcdev-000000000000_binary_configured",
         "device_class":"running",
         "payload_on":true,
         "payload_off":false,
         "value_template":"{{ value_json.configured }}"
      },
      "binary_connected":{
         "platform":"binary_sensor",
         "name":"Connected",
         "unique_id":"gzcdev-000000000000_binary_connected",
         "default_entity_id":"gzcdev-000000000000_binary_connected",
         "device_class":"connectivity",
         "payload_on":true,
         "payload_off":false,
         "value_template":"{{ value_json.connected }}"
      },
      "sensor_used_ram":{
         "platform":"sensor",
         "name":"Used RAM",
         "unique_id":"gzcdev-000000000000_sensor_used_ram",
         "default_entity_id":"gzcdev-000000000000_sensor_used_ram",
         "icon":"mdi:memory",
         "payload_on":true,
         "payload_off":false,
         "value_template":"{{ value_json.used_ram }}",
         "unit_of_measurement":"%"
      },
      "button_reboot":{
         "platform":"button",
         "name":"Reboot",
         "unique_id":"gzcdev-000000000000_button_reboot",
         "default_entity_id":"gzcdev-000000000000_button_reboot",
         "device_class":"restart",
         "icon":"mdi:restart",
         "command_template":"{\"jsonrpc\":\"2.0\",\"method\":\"reboot\",\"id\" : {{ (range(100000) | random) }}}"
      },
      "button_factory":{
         "platform":"button",
         "name":"Factory Defaults",
         "unique_id":"gzcdev-000000000000_button_factory",
         "default_entity_id":"gzcdev-000000000000_button_factory",
         "icon":"mdi:restore-alert",
         "command_template":"{\"jsonrpc\":\"2.0\",\"method\":\"factory_defaults\",\"id\" : {{ (range(100000) | random) }}}"
      },
      "button_config_reset":{
         "platform":"button",
         "name":"Reset config",
         "unique_id":"gzcdev-000000000000_button_config_reset",
         "default_entity_id":"gzcdev-000000000000_button_config_reset",
         "device_class":"update",
         "icon":"mdi:file-restore",
         "command_template":"{\"jsonrpc\":\"2.0\",\"method\":\"config_reset\",\"id\" : {{ (range(100000) | random) }}}"
      }
   },
   "availability_topic":"gfplab\/gzcdev-000000000000\/online",
   "payload_available":"ready",
   "payload_not_available":"lost",
   "state_topic":"gfplab\/gzcdev-000000000000\/state",
   "command_topic":"gfplab\/gzcdev-000000000000\/rpc",
   "qos":2
}

And this is the first entity:

As you could see, it displays - as entity_id - the value “binary_sensor.unnamed_device_33”. The same thing if i use the new “default_entity_id” or node.

Suggestions? We need predictable entity_id to be used inside our custom cards, and not such kind of names.

default_entity_id needs a domain
from MQTT - Home Assistant>

If the default_entity_id option is set, then this will be used to generate the entity_id. If, for example, we have configured a sensor, and we have set default_entity_id to sensor.test, then Home Assistant will try to assign sensor.test as entity_id, but if this entity_id already exits it will append it with a suffix to make it unique, for example, sensor.test_2.

So e.g.

replace

"default_entity_id":"gzcdev-000000000000_sensor_used_ram"

with
“default_entity_id”:“sensor.gzcdev-000000000000_sensor_used_ram”

I am dealing with a similar issue. In my case it will be “unamed” too, but it looks like that the sensor is already existing somehwere in the mqqt database (where it takes the infos to create the new one, like from a template).
If I recreated the sensor with a new name, it will create the entity_id correct.

  unique_id: 680_2735_test1
  default_entity_id: sensor.680_2735_test1

existing and not working, even without “sensor.”

  unique_id: 680_2735_test1_new
  default_entity_id: 680_2735_test1_new

→ will create a correct dynamic entity_id sensor.680_2735_test1_new

My config seems to be correct because 60 of 72 sensors are created with a correct entity_id from default_entity_id.
I am expecting that default_entity_id has some kind of temp storage, where all and old entities where stored and maybe not cleaned up correctly.