Device discovery of a Raspberry Pi

Sorry, I don't understand. My device driver has an attribute called Volume. Why would changing it to waterVolume make a difference?

Because the capability AudioVolume uses "volume" as an attribute and there it has a very different meaning. To not "collide" with defined capabilities and their attributes it is strongly advised to not re-use attributes defined and used in capabilities for something different. There is also another thing, if your attribute really starts with a capital letter, that is also something to avoid, in groovy Class names start with capital letters, this is a property, not a Class.
With all that said, there is nothing stopping you from using "Volume" as an attribute other than convention.

2 Likes

It doesn’t make a difference. Adding the Capability “Sensor” is what made the difference. Without at least one capability, RM and and other Apps can never see your device.

Did you try the driver I revised for you above? I even showed showed Rule Machine working.

As @markus mentioned, you can change the custom attribute back to ‘volume’ if you are so inclined. I only changed it to avoid confusion.

2 Likes

Ok, I understand. I will just add the capability "Sensor".
Ogiewon, thanks for your help, but I don't need to be able to set the water volume, my Raspberry Pi calculates and sends the value once a minute.
Markus, I will rename my attribute as you advise.

So we can't have custom 'capabilities'? Seems strange, but as I said, I'm new to all this.

No, there are no custom capabilities. Hubitat decides what the capabilities are for the platform. As demonstrated, custom commands and custom attributes are allowed. Since a capability simply defines a standard set of attributes and commands, you basically can create your own custom device. However, standard Hubitat Apps are always looking for standard capabilities. Thus, the reason custom drivers typically try to implement standard capabilities.

There are two high level standard capabilities, “Sensor” and “Actuator”, which have no attributes or commands. These can be used to allow nonstandard devices to become visible to apps which are capable of utilizing custom attributes and commands. Rule Machine is one such App. The Hubitat Dashboard can also display custom attributes.

4 Likes

Great. Thanks for the clarification.

Good to know! I was wondering if there was some sort of generic capability that would allow arbitrary values to be used when something doesn't quite fit any of the other capabilities.

2 Likes

FWIW, I thought using illuminance was a great work around.

2 Likes

Illuminance, Temperature, and Voltage are all decent capabilities as they allow an arbitrary numeric value.

1 Like

I am partial to using Relative Humidity to store WiFi Strength of some Tasmotized Sonoff devices. :grinning:

Why not just use SignalStrength as the capability?

SignalStrength

Device Selector

capability.signalStrength

Driver Definition

capability "SignalStrength"

Attributes

lqi - NUMBER

rssi - NUMBER

Commands

1 Like

I am using existing virtual device instead of creating a driver. And I didn't know that was a capability.

2 Likes