How to Initialize a device from a Rule

I have a driver that benefits from re-intialization so I am trying to do so via a rule.

My difficulty is finding the initialize action within the rule engine.

I tried to build a rule using a custom action. The rule engine them required that I pick a capability, not a device, as I had hoped. Unfortunately, the capability that I need i.e. Sensor is not available in the drop-down.

Drop-down

Driver capability

Then I tried the actuator route but my device, Range, does not appear in the listing

Am I missing something?

If not then I presume that I need to artificially add a new capability to the driver myself to force it into the listing of acceptable capabilities?

Many thanks for any words of wisdom!

1 Like

Can you link provide a link to the driver?

You'll need to select a capability that your driver implements (and that RM offers). Since you have the code, it looks like that's going to be "Sensor" or "Initialize." RM has "Sensor" for sure. (EDIT: no, this was me mis-remembering.) You could certainly add "Actuator" or something to the driver yourself if you wanted, but I might just try to fix whatever the issue is with the driver in the driver in the first place if possible. :smiley:

Robert, thank you and unfortunately as you can see in my embedded picture, Sensor is not in RM.

...and Ryan, if it becomes a matter of adjusting the driver I can certainly do that. My concern was that I am missing something in the correct usage of the Rule Machine.

You should be able to just add capability "actuator" at line 18.

1 Like

Thank you and that did it. So, one question remains, should RM be augmented to include the Sensor capability? That too would have worked and it would have been "out of the box" so to speak.

Ha, you're right, I mis-remembered "Sensor" as being there. "Actuator" is the other sort of catch-all and definitely is.

My thinking is that they did not include it because there are basically two catch-all capabilities in case the driver doesn't have anything else that can be used: Actuator for devices that accept commands, and Sensor for devices that just send reports. Since the point of a custom command is to, well, send a command, this usually doesn't make sense for "Sensor" devices. That being said, since you have access to the code, neither of these capabilities really do anything on their own (and don't require any commands or attributes like most capabilities), so at least you have any easy fix.

Though I'd still probably try to figure out what's up with the actual driver issue. :smiley:

1 Like

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