EC capability (Electrical Conductivity) for hydroponic automation

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. :slight_smile:

You could just create your own custom capability/attribute.

Here's a link to the full existing capabilities list if there's one that may fit the bill.

I did create a custom attribute, but I cannot create custom capability...

metadata {
   definition (name: "Growee sensor", namespace: "Growee", author: "My Name") {
      capability "Initialize"
      capability "Refresh"
      capability "pHMeasurement"
      //capability "ECMeasurement"   //this doesn't work
       
      attribute "LastUpdate", "string"
      attribute "pH", "number"
      attribute "EC", "number"
      attribute "WaterTemp", "number"
      attribute "Username", "string"
      attribute "Email", "string"
      attribute "DeviceName", "string"
      attribute "DeviceID", "number"
      attribute "DeviceNumber", "number"
      attribute "DeviceConnected", "boolean"
      attribute "PHConnected", "boolean"
      attribute "ECConnected", "boolean"
   }

Yep...that was my fault.

You don't need a custom capability to use the attributes in something like RM. Just use the custom attribute option.

Even more so, I don't see pH sensor in the dropdown list when I try to use it...

You want to use Rule Machine instead of Basic rules.

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?

1 Like

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.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.