Can not have several devices with the same driver

I have been able to connect my first motion sensor but when I try to connect the second one is visible in the hub event list, but never appears in the logcat

2021-09-01 2:20:42.000 PM CEST
moments ago
HUB read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000 read attr - raw: 669001040608… read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encodin…
2021-09-01 2:20:37.000 PM CEST
moments ago
HUB read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000 read attr - raw: 669001040608… read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encodin…
2021-09-01 2:20:30.000 PM CEST
moments ago
HUB read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000 read attr - raw: 669001040608… read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encodin…
2021-09-01 2:20:26.000 PM CEST
moments ago
HUB catchall: 0104 0000 01 01 0000 00 8778 00 01 115F 0A 01 01FF421A0121A90B0328220421A8430521C105062401 catchall: 0104 0000 01 01 000… catchall: 0104 0000 01 01 0000 00 8778 00 01 115F 0A 01 01FF421A0121A90B0328220421A8430521C105062401000000000A21C2BD
2021-09-01 2:20:14.000 PM CEST
moments ago
HUB read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000 read attr - raw: 669001040608… read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encodin…
2021-09-01 2:20:08.000 PM CEST
moments ago
HUB read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000 read attr - raw: 669001040608… read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encodin…
2021-09-01 2:20:02.000 PM CEST
moments ago
HUB read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000 read attr - raw: 669001040608… read attr - raw: 66900104060800001801, dni: 6690, endpoint: 01, cluster: 0406, size: 8, attrId: 0000, result: success, encodin…
2021-09-01 2:20:00.000 PM CEST
moments ago
HUB raw:66900000158D00014D0EF2, dni:6690, errorCode:00, ieee:00158D00014D0EF2 raw:66900000158D00014D0EF2, d… raw:66900000158D00014D0EF2, dni:6690, errorCode:00, ieee:00158D00014D0EF2

Hi! Are you using the Motion Sensor Driver included here, or a custom Driver?
The logs related to Drivers might not be shown completely in the IDE because they’re not fully supported there.
Both devices are from the same manufacturer and are the same model?

I am trying to implement Xiaomi Motion sensor. There is not much code added on top of the given example.

I’ve added this to fingerprint

- id: "lumi/motion"
    deviceLabel: Xiaomi Motion Sensor
    manufacturer: LUMI
    model: lumi.sensor_motion
    deviceProfileName: motion-battery

so how do I get a better log?
It seems like the device is connected to hub but it’s not associated to the driver
With groovy IDE it was clear how to link device to driver.

If you didn’t receive any logs in the CLI > logcat command, this means the Driver wasn’t called and it can be because the device fingerprint didn’t match.
Are you working with is this one?
https://www.mi.com/global/mi-motion-activated-night-light-2/

I have all the logs for the first device. this means the driver is called and works

I am working with Mi Motion Sensor - Xiaomi Norway

how can I see the device fingerprint?
this is the groovy DTH that works fine

I believe this is what is missing, one fingerprint has the model lumi.sensor_motion but the other adds aq2 at the end. You could add both to see which one is correct.

1 Like
 - id: "lumi/motion"
    deviceLabel: Xiaomi Motion Sensor
    manufacturer: LUMI
    model: lumi.sensor_motion
    deviceProfileName: motion-battery  
  - id: "lumi/motionAq2"
    deviceLabel: Aqara Motion Illuminance Sensor
    manufacturer: LUMI
    model: lumi.sensor_motion.aq2
    deviceProfileName: motion-battery-illuminance

the result is the same. the device is “connected”. It writes to the hub events, not to the edge driver logcat.
so likely the matching mechanism does not allow to associate the second device to the same driver. Could you please advice how do I get a log from the association service.

ooh, ok. So a “dummy” device is created but it only says “Connected” and there are no logs in logcat, correct?

Can you check the device status in the API, please? (Have you done it before?)
https://api.smartthings.com/v1/devices/{deviceId}/status

I am not sure if a “dummy” was created, but I can see the zigbee commands form this device in the hub events log SmartThings. Add a little smartness to your things.

Unfortunately I have no knowledge how to use the API, I suppose it’s token protected.
And also I do not know the {deviceId} for the device

@nayelyz ,
I have connected 2 devices to the same edge drive “zigbee smoke sensor” and the events of the two devices are seen in the logcat of the same driver.

By the way, when you have 2 edge drivers compatible with a device, even if they have custom modifications in the code, the device is paired with one of them. Is there a routine in the Hub to choose the driver to connect to?
In this case, the new device has been connected to the same driver that already had a device connected. Is this a condition to choose that driver?
Thanks

ok, I made some tests and adding the fingerprint is only one step for the acceptance of the device.
As this Driver uses sub-drivers, you need to add one for your device, you can copy an existing one, but it’s important you change the can_handle function adding the corresponding manufacturer (“mfr”) and model. Otherwise, it won’t be recognized as compatible. Eg.

Why do you have two, one is from the public Drivers and the other is a custom one?
When you install the device, which Driver is selected?

Drivers are not used only for one device, several devices can be handled by the same Driver (they only have to be compatible with it). Each device is differenced by an ID they get when they’re installed.

I have 2 drivers because they are part of beta testing. The developer can’t think of all the things that can go through a user’s head, hahahaha … :thinking:

I have been on both sides throughout my professional life and users are unpredictable. :rofl: :rofl:

The two drivers are modified, since the official beta does not have the fingerprint of my sensor.

He chose the one that already had a sensor connected.

  • I made a different version to test how the driver change tool worked in the app.

  • I made another version thinking of giving a solution with edge drivers, what I have solved with custom DTHs, and that in the future I may have different temperature sensors that need different configurations and as it is not clear that it can be done easily, it would have to have different drivers for different sensors.
    By the way, the multipurpose sensor with the Driver default temperature reports configuration has consumed 15% battery in 3 days. This is not acceptable. There are tens of thousands of these sensors around the world!

In short, these are questions that arise during the tests, such as if the hub chooses a driver and you need another different, I can change it with the app tool, but the app tool does not perform doConfigure, as IDE does with DTHs updated.
That is why in another post it asked as convenient that driverSwitched handler also execute doConfigure or execute doConfigure with a tile, as in the classic app or a setting device menu option.

Thank you very much, I think you are doing an incredible job answering all our questions

I thought there already will be some logging when can_handle comes into a game.

however, I have a code like yours

local ZIGBEE_LUMI_MOTION_SENSOR_FINGERPRINTS = {
    { mfr = "LUMI", model = "lumi.sensor_motion" },
    { mfr = "LUMI", model = "lumi.sensor_motion.aq2" }
}

Whenever you make changes to the Driver and you don’t delete it but only:

  • Package the driver
  • Assign it to the channel again
  • Install it again (through the CLI)

It might take some time to update.

well, my driver is like that for several days. also, I’ve rebooted my hab a couple of times.
so it is likely a fingerprint issue, and it would be good to be able to debug this case.