[Request] "Smarter" device Fingerprint matching using model name

As I understand it from this February 2018 thread, Z-Wave and ZigBee device drivers are matched to devices being paired mainly based on the inClusters listed in the fingerprint lines of all available device drivers:

Since my own "development" of device drivers is limited to ZigBee devices, I can only state that this method of matching seems to result in false positives for completely different devices which have the exact same inClusters and outClusters strings.

My request:

Can the model: string supplied by devices at pairing be used in matching fingerprints to corresponding devices? This seems like a much better tie breaker than additionally comparing outClusters and/or manufacturer (if used at all).

If I am actually mistaken and the model string is being used, then how can I get that working correctly? I have worked on device drivers with fingerprint lines containing data copied directly from the additional pairing info text given by my Hubitat hub, and yet the wrong device driver is selected for some devices that share the exact same inClusters and outClusters strings found in multiple device drivers.

Another (less important) request here: Is there any way for a fingerprint's deviceJoinName string to be used? It would be really nice for this to be used as the initial suggested name of the device as it's paired.

Tagging @mike.maxwell since you're probably the one who decides whether this happens or not. :slightly_smiling_face:

1 Like

for zigbee, this is a complete fingerprint

fingerprint profileId: "0104", endpointId: "01", inClusters: "0000,0001,0003,0020,0402,0500,0B05", outClusters: "0019", model: "3315-G", manufacturer: "CentraLite", deviceJoinName: "Centralite 3-Series Water Sensor"

To match a driver where two devices provide the same values for inClusters, adding the following will break the tie
manufacturer (available during pairing, and also in device data)
model (available during pairing, and also in device data)

Great, thanks! I'm glad to hear the model string is used when pairing.

But it's not working for me for a particular set of devices, despite having complete fingerprint lines in the two "competing" device drivers, which are

fingerprint profileId: "0104", endpointId: "01", inClusters: "0000,0003,0019,FFFF,0012", outClusters: "0000,0004,0003,0005,0019,FFFF,0012", manufacturer: "LUMI", model: "lumi.sensor_86sw2Un", deviceJoinName: "Aqara 2-button Wireless Light Switch (2016)"

versus

fingerprint profileId: "0104", endpointId: "01", inClusters: "0000,0003,0019,FFFF,0012", outClusters: "0000,0004,0003,0005,0019,FFFF,0012", manufacturer: "LUMI", model: "lumi.sensor_ht" deviceJoinName: "Xiaomi Temperature Humidity Sensor"

and with both devices' fully matching manufacturer and model strings available at pairing.

So what might cause this mismatch? Garbage characters in the model string that aren't displayed? Something else?

this was the fp i got from a motion some time ago:
manufacturer:null
address64bit:00158D0001E7E006
address16bit:0FB7
model:lumi.sensor_motion
basicAttributesInitialized:true
application:null
endpoints.01.manufacturer:null
endpoints.01.idAsInt:1
endpoints.01.inClusters:0000,0003,FFFF,0019
endpoints.01.endpointId:01
endpoints.01.profileId:0104
endpoints.01.application:null
endpoints.01.outClusters:0000,0004,0003,0006,0008,0005,0019
endpoints.01.initialized:true
endpoints.01.model:lumi.sensor_motion
endpoints.01.stage:4

note that manufacturer is null, if that's also the case for the devices that you're pairing, then leave manufacturer out of the fingerprint.
the only arbitrary attribute in the fingerprint is deviceJoinName

Mike,
I have noticed your complete fingerprint includes the devicejoinname: parameter. However, when i add this to my device handlers, it is never used. When adding a new device that matches the fingerprint in the device handler, the device name by default is simply the device handler name. Am I missing something?

No, its currently not used, the intent of that property
being assigned as the initial device name, not a value to be used in device matching.

Thank you Mike for the reply. Is there a way to set the initial name in Hubitat (perhaps a different parameter)? Or must I simply create duplicate device handlers with different names and fingerprints (this seems somewhat inefficient)?

Why?, you have a driver that works with 6 devices, you put the 6 fingerprints in that driver and call it done.
Obviously all six devices must share the same capability and feature sets, if they don't, then they should have separate drivers.

If you're thinking of a universal driver that might be a switch for this device and a dimmer for another device, that's not possible (dynamic capabilities do not exist in Hubitat, nor ST for that matter), and honestly not worth the effort.

Additionally, zigbee devices do contain the manufacturer and model info in the data section, this can be accessed from the driver to make decisions internally should that be required, although with zigbee devices i seldom have had the need to do this.

I understand the concept of keeping the functionality narrow. I think that Hubitat has the potential to exceed that of smartthings. To do this, it has to at least move towards leveling the playing field with simplicity.
The logic to be able to provide a default name based upon matching Manufacturer and model and id is there.
Real life example is
I have three zigbee outlets in my master bedroom.
all three are from different manufacturers.
All three control a lamp.
Lamp_1, Lamp_2 and Lamp_3
The wife and kids have a habit of unplugging these and moving them around. The result is, in HUBITAT, they all are Lamps and zigbee outlets. I have trouble figuring out which one is which. I know I can simply figure this out by toggling them in the hubitat, then change the label in Hubitat. However, in Smartthings, i do not have to do this. Smarthings gives each a unique default name (At least based upon the fingerprint) Each zigbee plug has a specific default name based on the fingerprint, yet they share the same device handler. Therefore, when they get mixed up, i can tell that the IRIS plug is Lamp_1 and the Honeywell Plug is Lamp_2 and the Wink plug is Lamp_3 without having to have had the forethought to name them in such a way.

To be honest in situations where you have two outlets of the same model in the same room and you've named them outlet_1 and outlet_2, Hubitat setting the device name to CentraLite Outlet (from the fingerprint deviceJoinName) isn't going to help you....

Also, not every driver contains explicit fingerprints finger every possible device that's supported bu the driver, some are general and apply to many models.

You'll be better served long term by setting the device name in the driver UI, and or re-thinking your device label naming schema...

This is exactly how everyone of my devices are handled.

I looked in the Hubitat Documentation and searched the forums and did not find any documented method to set the Device Name. Is there a method to set it in a device driver, or can it only be changed manually by the user?

device.name = "my new device name"

So I would use device.name instead of devicejoinname in my device handler?

The question was how to set the device name in driver code.

Is there a difference between driver code and device handler code?

We refer to device driver code as drivers, other platforms use DTH and or device handler...