Extend groovy device driver capability with a Default/Priority/Primary flag

One thing that pops up often is devices aren't recognized in a smart way. Specifically - if I create a dashboard of all my devices and 'auto' fill - numerous devices come up incorrectly or at least in a way that is either unexpected or unnatural.
I feel there is a missing attribute or maybe a better word is parameter that all drivers could / should have for setting a primary capability.
For example, I have a sensor that has multiple functions - battery, presence, humidity, motion. When my dashboard fills from a clean start - one of my sensors comes up as Generic. I have to reach in and toggle it to Motion sensor. There are a number of things like this - tiles with text, some switches that report presence...
As an enhancement, and a flag as drivers improve and move forward, adding a 'Primary' value or parameter on the line such as:

capability "Motion Sensor", Primary
capability "Presence Sensor"

This would allow a detection of what the developer wants displayed by default, without displaying everything the device can do and making it less intelligent at the user GUI side.
I'm not suggesting that HE is wrong and powerful in that it displays everything - I'm suggesting that Drivers could get smarter. Adding this parameter would help dashboard app developers and dashboard users get a clean generic installation - without loosing the ability to change the display of the tile to whatever they want.

1 Like

Currently, how does the dashboard decide? I actually have never checked. If it takes the first capability on the list then all the author needs to do is order the capabilities differently.

Alternatively how about writing them in a way so that the user decides in preferences? For example I have a couple of SmartThings contact sensors I am actually using solely as temperature sensors in drinks chillers.

Thats a really interesting question - I'd not really thought about how a device driver chooses. I just assumed it was alphabetical! ordering them... Not sure that is how it works - but it's worthy of some quick trial and errors to see if I can spot the pattern. Still - my feedback is more about improvement and clear definition as opposed to easily obscure easily forgotten concepts. it will be interesting!

Not sure of the pattern, but not Alpha or the order inside the driver code.