Custom device capability/command that is visible in Rule Machine

I created a custom driver for pH and EC sensor/doser. I created a list of custom attributes that are measured and captured by sensor/doser - and they are all visible in Rule Machine.

I also created several custom commands to regulate pH and EC:

command "phUp", [[name: "ml", type: "NUMBER"]]
command "phDown", [[name: "ml", type: "NUMBER"]]
command "addA", [[name: "ml", type: "NUMBER"]]
command "addB", [[name: "ml", type: "NUMBER"]]

The problem is that I can't see these commands under Custom Actions in Rule Machine, therefore I can't trigger them outside the device itself. What am I missing?

2 Likes

I've never seen your command definition format. Here is an example:

command "setCarbonDioxide", ["Number"]

Try that and see if it works...

1 Like

This command declaration format works for me with Rule Machine from one of my custom drivers.

command "sendSavedCode", [[name: "name*", type: "STRING"], [name: "reps", type: "NUMBER"]]

Are you able to select your device but the command just is not listed? Or you're not able to select the device at all, potentially because it is missing one of the built-in capabilities (I typically use Actuator if another capability isn't applicable).

Please show a screenshot of Rule Machine when you are trying to configure your rule and share more of your driver code that replicates the issue.

1 Like

I am not able to list the capability of my device when I create a new action. My driver/device can take measurements of pH, EC and Temperature, and can dose/inject pH corrector and nutrients.

The only capability that I found that partially applies to me is "pHMeasurement" - which has no actions/commands avaialble.

Perhaps my question should be: what alternative capabilities should I include in my source code to expose dosing/injecting specific ml. Injecting itself works no problem using command stated above. Perhaps I am lacking in the core definition:

metadata {
   definition (name: "Growee sensor", namespace: "Growee", author: "My Name") {
      capability "Initialize"
      capability "Refresh"
      capability "pHMeasurement"
      //capability "ECMeasurement"
       
      command "addA", [name: "SolnA", type: "NUMBER"]
      command "addB", [[name: "SolnB", type: "NUMBER"]]
       
      attribute "LastUpdate", "string"
      attribute "pH", "number"
      attribute "AvgpH", "number"
      attribute "EC", "number"
      attribute "AvgEC", "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"
   }
1 Like

Maybe add the actuator capability? It is a most useful "catch all".

4 Likes

That was exactly what is needed!

2 Likes

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