Rule Machine API

Perhaps in the future. Not easy to do for now.

When I access this list via an HTTP request I get a JSON response of the list of RM rule ids and their names, but don't seem to be able to access either the triggers or the actions of each of the rules.:

[
{
"939": "Bathroom Outlet Auto Off "
},
.........
{
"903": "Track Music Room Dimmers "
}
]

Is this correct? Is it possible to access the triggers and actions in a similar way via an HTTP request? Is it possible to access these for Simple and Motion lighting?

I am trying to create a "performance" monitor that follows the timing of trigger/app/action cycle and being able to access this information would be really helpful .

They all come in that one list. getRuleList is not limited to "Rules", but grabs all child apps of RM.

Thanks Bruce . I must be even dimmer than usual as all I seem to get is a listing of the rules from RM:

Here's the get request and response I see (minus my authentication token) .

Am I missing something in the rule definition that creates the local endpoint?

From the OP above. You get the endpoint by creating a Trigger in RM.

What does this mean? What are you trying to do? This API is for causing RM to run a rule, or other actions on rules from this list:

Ok that's my misunderstanding of what would be returned when accessing this.

"Rule Machine maintains a list of available Rules, Triggers, Triggered Rules, and Actions."

I am trying to access a list each of the triggers and actions for the rules that have been set up so I can identify the ""trigger(s) - rule - action(s)" sequence in the logs and track times for these responses in an effort to tweak the system performance by identifying slow responses, recording how often and when and when they occur.

Not what the API is intended to do - but would be really helpful as, at present, I'm identifying the sequences from the available socket streams, which is less than ideal.

1 Like

There is no such facility.

Thanks, as always, for the responses.

@bravenel couple of questions:

  1. when "runRule" action is triggered does it evaluate any rules specified and then perform the true or false action based on result of rules evaluation?
  2. when "runRuleAct" action is triggered does it always run the true action?

thank you.

Hi @bravenel I was wondering if something along these lines was possible. I would like to be able to pass in information from an outside call and either set a GV with the value or pass the attribute directly to a device driver.

Curious what your thoughts are. Thanks in advance.

Yes, it runs the true actions of a rule or triggered rule.

1 Like

I think this can be added to set a GV from an endpoint call. The value passed would be a string, and only a GV of type string would make sense. The string would be URL encoded, and then URL decoded into the GV. The GV could be passed as a string parameter to a driver using a custom action.

Would that work for you?

1 Like

This sounds about perfect. Thanks for the consideration!

This feature is now available in Rule 3.0, now released.

See [Released] Rule Machine 3.0 and the top post of this topic Rule Machine API

2 Likes

Wow now that is super fast service thanks as always @bravenel and hubitat team!!!

Trying to select cloud endpoint as a trigger gives me this error..

OK, we messed up and didn't turn on OAuth. Will get it fixed.

1 Like

I just updated he but it looks like it’s rule machine 2.5

They look the same until you set up Actions.