I am writing a driver for hydroponic garden automation, that is able to measure pH, temp and EC, and then correct pH and EC using peristaltic pumps. All sensors and motors are addressable through http API.
I can add temp and pH capabilities to the driver, but am struggling to choose capability for EC measurements. I do have EC data captured through an attribute, but I need to expose it as a capability in order to drive automations like [if EC<2.0 then [add 5ml of nutrients]]
EC is measured in mS/cm (milliSeimens per centimeter) and value is typically between 0.0 and 5.0
Any suggestion what capability to choose that would look similar to EC? pH and Temp are already used on the same sensor.
got it; I can see attributes being available as triggers in the Rule Machine. So, do I just ignore capabilities and do everything with attributes? What is the best practice here?
That depends. Capabilities are, essentially, actions that you can take on the device. Many of them also have predefined attributes (just keeps you from needing to explicitly define them in the driver). You could delete your line with attribute "pH", "number" and the pH attribute would still implicitly be there because of the "pHMeasurement" capability.
So, you could write a rule to use the "Refresh" capability of the device to force a refresh (assuming the driver has that capability mapped to a method). But, if you are just using the monitoring values to do some actions, then you just use the attributes.