What is the proper way to add commands in an EDGE device driver like there in the DHT/Groovy world? I assume it is something with Custom Capabilities, but that section is blank in the documentation.
Regards,
Jose
What is the proper way to add commands in an EDGE device driver like there in the DHT/Groovy world? I assume it is something with Custom Capabilities, but that section is blank in the documentation.
Regards,
Jose
Are you asking about the equivalent of the custom attributes and commands in Groovy DTHs? For example …
attribute 'accelsensitivity', 'string'
attribute 'tiltangle', 'string'
command 'changesensitivity'
If so, that is indeed where custom capabilities come in. The legacy platform effectively placed attributes and commands in a single flat namespace, with the capabilities defining which attributes and commands to expect. It was all very relaxed and you could pretty much do what you liked.
With the current platform there is a well-defined device > component > capability > attribute/command
hierarchy that can be, and is, enforced. So to add commands and attributes you have to define new custom capabilities that include them. In the case of the example that might mean adding a sensitivity capability with an attribute and command, and a tilt angle capability with an attribute.
@orangebucket Yes, that is what I am referring to. Sounds fine by me… I have looked at the documentation you are pointing to. How do you do it with Edge?
Regards,
Jose
Hi, @josep1972
Custom capabilities can be used in different integration types, their creation process doesn’t depend on which integration you’re developing.
With this in mind, here’s a tutorial where a custom capability is created based on a custom attribute/command defined in a DTH:
After you finish creating that custom capability, you need to add it to your device profile, and in the driver, you can make reference to it with this line:
local waterFlowRate = capabilities["capabilityID"]
Note: The capabilityID is formed by a randomly created namespace and the capability name in camelCase. Something like: commonsmall09402.waterFlowRate