Device discovery shows labels "1", "2"

Hello, I am currently developing an edge driver. When you search the surroundings in Add a SmartThings device, you will find the device. At this time, the label name is shown as the number 1 and 2. The edge driver discovery code sets the label name normally. EdgeDriver/xiaomi-miot/src/discovery.lua at main · lunDreame/EdgeDriver · GitHub

Below is the discovery point log. I’d like to see it in the log

2025-11-04T22:58:25.540276227+09:00 INFO Xiaomi MIoT  Xiaomi device found: 192.168.219.102 (device_id=0x0EC8699F, stamp=139230, magic=0x2131, enc=no)
2025-11-04T22:58:25.571329834+09:00 INFO Xiaomi MIoT  Xiaomi device found: 192.168.219.100 (device_id=0x28B6D6FB, stamp=27915, magic=0x2131, enc=no)
Recognize the device
2025-11-04T22:58:30.264467751+09:00 INFO Xiaomi MIoT  Device added: 248015263

The discovery device is added as follows: device_id is used as the label name of the try_create_device metadata. Should the expected label name be shown in the actual SmartThings peripheral search be 248015263 or something like this, but strange values are shown in 1 or 2. You can find out by referring to the screenshot below.

? Select a driver. 16
connecting… connected
2025-11-04T22:58:24.662987824+09:00 TRACE Xiaomi MIoT  Setup driver xiaomi-miot with lifecycle handlers:
DeviceLifecycleDispatcher: xiaomi-miot
default_handlers:
driverSwitched:
added:
init:
infoChanged:
removed:
child_dispatchers:

2025-11-04T22:58:24.666385033+09:00 TRACE Xiaomi MIoT  Setup driver xiaomi-miot with Capability handlers:
CapabilityCommandDispatcher: xiaomi-miot
default_handlers:
fanSpeedPercent:
setPercent
dictionaryangel05655.targetHumidity:
setTargetHumidity
fanSpeed:
setFanSpeed
switch:
on
off
thermostatCoolingSetpoint:
setCoolingSetpoint
switchLevel:
setLevel
dictionaryangel05655.dehumidifierMode:
setDehumidifierMode
thermostatHeatingSetpoint:
setHeatingSetpoint
thermostatMode:
setThermostatMode
colorTemperature:
setColorTemperature
dictionaryangel05655.fanMode:
setFanMode
windowShadeLevel:
setShadeLevel
windowShade:
close
pause
open
colorControl:
setColor
setSaturation
setHue
fanOscillationMode:
setFanOscillationMode
dictionaryangel05655.humidifierMode:
setHumidifierMode
refresh:
refresh
dictionaryangel05655.airPurifierMode:
setAirPurifierMode
child_dispatchers:

2025-11-04T22:58:24.668345912+09:00 INFO Xiaomi MIoT  Created dispatcher \[SecretDataDispatcher\]xiaomi-miot that had no handlers
2025-11-04T22:58:24.671580765+09:00 TRACE Xiaomi MIoT  Setup driver xiaomi-miot with Secret Data handlers:
SecretDataDispatcher: xiaomi-miot
default_handlers:
child_dispatchers:

2025-11-04T22:58:24.673430895+09:00 TRACE Xiaomi MIoT  Waiting on startupState message
2025-11-04T22:58:24.675512561+09:00 INFO Xiaomi MIoT  received driver startupState: {“device_ids”:[ ],“hub_zigbee_id”:“mAwz//7dpAQ=”,“hub_node_id”:null,“hub_ipv4”:“192.168.219.103”,“augmented_store”:[ ]}
2025-11-04T22:58:24.678592224+09:00 INFO Xiaomi MIoT  Starting driver\[xiaomi-miot\] with 0 device IDs
2025-11-04T22:58:24.680829123+09:00 TRACE Xiaomi MIoT  Waiting on init messages
2025-11-04T22:58:24.683737433+09:00 TRACE Xiaomi MIoT  Startup process completed
2025-11-04T22:58:24.685674364+09:00 TRACE Xiaomi MIoT  Received event with handler discovery
2025-11-04T22:58:24.687335648+09:00 INFO Xiaomi MIoT  Start searching for Xiaomi MIoT devices
2025-11-04T22:58:25.540276227+09:00 INFO Xiaomi MIoT  Xiaomi device found: 192.168.219.102 (device_id=0x0EC8699F, stamp=139230, magic=0x2131, enc=no)
2025-11-04T22:58:25.571329834+09:00 INFO Xiaomi MIoT  Xiaomi device found: 192.168.219.100 (device_id=0x28B6D6FB, stamp=27915, magic=0x2131, enc=no)
2025-11-04T22:58:27.363228574+09:00 TRACE Xiaomi MIoT  Received event with handler device_lifecycle
2025-11-04T22:58:29.556851332+09:00 INFO Xiaomi MIoT  <Device: 0e32e081-04e3-4a24-9b8f-d599adad5218 (248015263)> received lifecycle event: added
2025-11-04T22:58:30.263835700+09:00 TRACE Xiaomi MIoT  Found DeviceLifecycleDispatcher handler in xiaomi-miot
2025-11-04T22:58:30.264467751+09:00 INFO Xiaomi MIoT  Device added: 248015263
2025-11-04T22:58:30.269467974+09:00 INFO Xiaomi MIoT  IP address set from discovery cache: 192.168.219.102
2025-11-04T22:58:30.270218063+09:00 DEBUG Xiaomi MIoT  248015263 device thread event handled
2025-11-04T22:58:30.274250779+09:00 DEBUG Xiaomi MIoT  <Device: 0e32e081-04e3-4a24-9b8f-d599adad5218 (248015263)> added callback did not fail
2025-11-04T22:58:30.676317628+09:00 TRACE Xiaomi MIoT  Received event with handler device_lifecycle
2025-11-04T22:58:30.676772372+09:00 INFO Xiaomi MIoT  <Device: 0e32e081-04e3-4a24-9b8f-d599adad5218 (248015263)> received lifecycle event: init
2025-11-04T22:58:31.279997488+09:00 TRACE Xiaomi MIoT  Found DeviceLifecycleDispatcher handler in xiaomi-miot
2025-11-04T22:58:31.280678521+09:00 INFO Xiaomi MIoT  Device Initialization: 248015263
2025-11-04T22:58:31.285673371+09:00 WARN Xiaomi MIoT  Device not fully configured - IP or Token is missing
2025-11-04T22:58:31.286295967+09:00 DEBUG Xiaomi MIoT  248015263 device thread event handled
2025-11-04T22:58:31.648040690+09:00 INFO Xiaomi MIoT  Device discovery complete
2025-11-04T22:58:31.648877246+09:00 DEBUG Xiaomi MIoT  Cleaned up 1 discovery cache entries
2025-11-04T22:58:31.653979722+09:00 DEBUG Xiaomi MIoT  discovery device thread event handled
2025-11-04T22:58:31.654863053+09:00 TRACE Xiaomi MIoT  Received event with handler device_lifecycle
2025-11-04T22:58:31.657742166+09:00 INFO Xiaomi MIoT  <Device: 0e32e081-04e3-4a24-9b8f-d599adad5218 (248015263)> received lifecycle event: doConfigure
2025-11-04T22:58:31.661294356+09:00 TRACE Xiaomi MIoT  <Device: 0e32e081-04e3-4a24-9b8f-d599adad5218 (248015263)> received unhandled lifecycle event: doConfigure
2025-11-04T22:58:31.664103579+09:00 DEBUG Xiaomi MIoT  248015263 device thread event handled
2025-11-04T22:58:31.664762287+09:00 DEBUG Xiaomi MIoT  <Device: 0e32e081-04e3-4a24-9b8f-d599adad5218 (248015263)> doConfigure callback did not fail, transitioning device to “PROVISIONED”
2025-11-04T22:58:31.772263101+09:00 DEBUG Xiaomi MIoT  248015263 device thread event handled
2025-11-04T22:58:31.775144838+09:00 TRACE Xiaomi MIoT  Received event with handler device_lifecycle
2025-11-04T22:58:31.853511152+09:00 INFO Xiaomi MIoT  <Device: 05df54a1-1b4b-4977-984d-901d8afbce6f (683071227)> received lifecycle event: added
2025-11-04T22:58:31.856489144+09:00 TRACE Xiaomi MIoT  Found DeviceLifecycleDispatcher handler in xiaomi-miot
2025-11-04T22:58:31.858325821+09:00 INFO Xiaomi MIoT  Device added: 683071227
2025-11-04T22:58:31.859988730+09:00 INFO Xiaomi MIoT  IP address set from discovery cache: 192.168.219.100
2025-11-04T22:58:31.861672672+09:00 DEBUG Xiaomi MIoT  683071227 device thread event handled
2025-11-04T22:58:31.865108240+09:00 DEBUG Xiaomi MIoT  <Device: 05df54a1-1b4b-4977-984d-901d8afbce6f (683071227)> added callback did not fail
2025-11-04T22:58:31.868359920+09:00 TRACE Xiaomi MIoT  Received event with handler device_lifecycle
2025-11-04T22:58:31.870066979+09:00 INFO Xiaomi MIoT  <Device: 05df54a1-1b4b-4977-984d-901d8afbce6f (683071227)> received lifecycle event: init
2025-11-04T22:58:31.874165045+09:00 TRACE Xiaomi MIoT  Found DeviceLifecycleDispatcher handler in xiaomi-miot
2025-11-04T22:58:31.876119218+09:00 INFO Xiaomi MIoT  Device Initialization: 683071227
2025-11-04T22:58:31.879418172+09:00 WARN Xiaomi MIoT  Device not fully configured - IP or Token is missing
2025-11-04T22:58:31.881785979+09:00 DEBUG Xiaomi MIoT  683071227 device thread event handled
2025-11-04T22:58:31.883986642+09:00 TRACE Xiaomi MIoT  Received event with handler device_lifecycle
2025-11-04T22:58:31.887075301+09:00 INFO Xiaomi MIoT  <Device: 05df54a1-1b4b-4977-984d-901d8afbce6f (683071227)> received lifecycle event: doConfigure
2025-11-04T22:58:31.889852577+09:00 TRACE Xiaomi MIoT  <Device: 05df54a1-1b4b-4977-984d-901d8afbce6f (683071227)> received unhandled lifecycle event: doConfigure
2025-11-04T22:58:31.893556335+09:00 DEBUG Xiaomi MIoT  683071227 device thread event handled
2025-11-04T22:58:31.895446450+09:00 DEBUG Xiaomi MIoT  <Device: 05df54a1-1b4b-4977-984d-901d8afbce6f (683071227)> doConfigure callback did not fail, transitioning device to “PROVISIONED”
2025-11-04T22:58:31.912546445+09:00 DEBUG Xiaomi MIoT  683071227 device thread event handled

Hi, @lunDreame
If you’re referring to the value shown inside the symbols () or the logs like the one below?

2025-11-04T22:58:31.861672672+09:00 DEBUG Xiaomi MIoT  683071227 device thread event handled

Have you confirmed this is the Network ID assigned to the device as the result of this line?
I’m guessing it uses this value since two devices can have the same label, but the NetworkID must be unique.

If you look at the attached photo screenshot, the device label name looks like 1 and 2. But that’s the wrong result. The label name you want to see in the log is set to 248015263, 683071227. I don’t know the cause.

so, the label should be something like this, right?
I think the numbers 1 and 2 belong to the value appended by default, but then, the label you want to assign is being ignored for some reason.
How long ago was this last installation? If it’s been only a few hours, please submit the hub logs as follows:

  1. In the Advanced Users app, enter the “Hubs” section
  2. Enter the corresponding Hub and click on “Dump Hub logs”
  3. Confirm the process by clicking on “Dump Hub logs” again in the pop-up.
  4. You’ll get a green box at the top confirming the Hub logs were requested.

And also, open support access to your account, please:

  1. Confirm the email account registered in the forum is the same one you use for SmartThings. If not, please share it with me over DM
  2. Enable support access to your account:
  1. Go to the SmartThings Web (my.smartthings.com)
  2. Log in to your Samsung Account
  3. Select Menu (⋮) and choose Settings
  4. Toggle on Account Data Access
  5. Select the time period and confirm - In this step, please select “Until turned off”, once the team finishes, we’ll let you know so you can disable it again.

See more information about this access here: https://support.smartthings.com/hc/en-us/articles/36170233944852-Enabling-Account-Data-Access-for-Support

I would add a log.info(tostring(info.device_id)) in line 135 for debugging purposes…

1 Like

It looks like " 1" and " 2" which is something the mobile app has taken on itself to do in order to make device labels unique within the location. I’ve actually seen labels like that before but generally they are appended to the original device labels. I’m rather assuming that the device_id you use is unique so the worst you should see is e.g. “683071227 1”.

I’d be strongly tempted to consider that the developers may have been having an off day and are interpreting “683071227” as the 683071227th instance of a device with an empty label. So I’d try and make the device_id look less like a number and see where that takes you. With luck one of “dev683071227”, “683071227id” or “dev683071227id” might work.

1 Like

Hi, @lunDreame
Have you been able to test something else?
I installed a device with a label that only contained numbers and it was discovered correctly.
Also, I tested using the sample below and it works fine, so I think that it depends on how info.device_id is being populated on your side:

 local device_id = tostring(683071227)

  local metadata3 = {
    type = "LAN",
    device_network_id = device_id,
    label = device_id,
    profile = "profileName",
    manufacturer = "SmartThings",
    model = "v1",
    vendor_provided_label = nil
  }

1 Like