I just purchased an Aeotic MultiSensor 7 and was pleased that Hubitat had a built in driver for it. I wanted to write a custom app for the device just get get familiar with the custom development environment. I got to the preferences and within my section I wanted to create an "input name: XXX, type: XXX, title: XXX". How should I go about finding the capability.SOMETHING for type? I eventually guessed correctly and put temperatureMeasurement but shouldn't I be able to explicitly get that info and not guess? I have looked in the source code of drivers and it clearly states what capability it has BUT in this case I do not have the source code for the built in driver... OR DO I? I really enjoy the programming environment of Hubitat but so much info I should be able to obtain on my own and I am bouncing around the WEB and the Hubitat community and I think I am getting severely bruised. I am a retired programmer and I should be immune by now. Thanks
If you a new developer to Hubitat, look at the code link below. It gives examples of different device integrations and the capabilities. Hubitat does not share their explicit code for devices and apps. GitHub - hubitat/HubitatPublic
Second method is to search for a community app and driver. These can provide guidance on how to define the metadata for a similar device. Example: you are wanting to write code for a thermostat. Do a search for "thermostat" and browse some of the available code on Hubitat.
Being verbose (and not knowing your level of experience), Capabilities are the first method the environment (rule machine and apps) use to communicate how a device is controlled with the default commands available. The other part of the definition are the attributes that the apps/rule machine) use to trigger actions when the attribute changes. When a capability is declared, the developer is telling the rest of the environment the 'default' commands and attributes that are available to control/manage the device.
I wrote this App to help me find the Capabilities, Attributes and Commands of any driver:
You pick devices and it creates a "Report" that looks like:
Thanks for the App csteele. I will go thru it to figure out what you did but the results really helped. As I go thru it I am interested to know why the capabilities from the report had a capital letter starting them out but I had to change all of them to non-capital to work? besides that it was exactly what I needed... and now i get to digest your App and figure out exactly what you did... thks again. It turns out the app i was writing for the Aeotic MultiSensor 7 won't need to be completed! That device will be returned. The motion sensor is stuck on reporting ACTIVE and I have read from others that is what they are getting. I will return it and see if I can get coverage for its functionality with one or more sensors. I am wondering how good Aeotic's QA can be seeing how they shipped me the device with the wrong batteries!? They provided me with CR2's that are about 25% shy of width instead of CR123's.
The capabilities themselves, as you'd specify when making a driver, uses title case (each word is capitalized, and canonically no spaces, though it technically works either way): Driver Capability List | Hubitat Documentation
The type
parameter for an input
in an app takes "device.capabilityName"
as the format, where the capability name is instead camel-cased (each word except the first is capitalized, and no spaces). See, for example, App Preferences | Hubitat Documentation.
I don't know the reason for the difference besides the fact that this isn't a choice that they made directly; it significantly improves compatibility with certain code that may have been written for a certain other platform that did make this choice.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.