Is wait for local end point possible?

Feature request if it's possible would make some rules I have a bit cleaner and more efficient.

Predictive condition

Trigger local endpoint

Set variable

Wait for another local endpoint

Set variable

I will look into it... In next release.

4 Likes

BTW, did you know that you can set a string variable with a Trigger endpoint? It will also be possible to do this with a Wait for Event endpoint.

Nope I didn't. so the variable endpoint could be a trigger?

No, there is a way the endpoint triggering URL can carry with it an instruction to set a variable.

Normally, a trigger endpoint looks like this:

http://[hub-ip]/apps/api/[appId]/trigger?access_token=xxxx

That can be extended like this:

http://[hub-ip]/apps/api/[appId]/trigger/setGlobalVariable=stringV:abcdef?access_token=xxxx

where 'stringV' is the variable name and abcdef is the value to set into it (which can be URL encoded if need be).

The new format for wait endpoint will be:

http://[hub-ip]/apps/api/[appId]/wait?access_token=xxxx

And that could be extended in the same way.

There is a completely different thing that can set a variable from a Get or Post response, but that's not the same as a trigger or wait endpoint.

1 Like

Clearer head today.

So once the local end point has been created I can just set the GV directly from the URL?

So don't even need the rule!

Yes, this is correct.

See this, near the bottom: Rule Machine API

It says Global Variable, but it actually sets Hub Variables for a 5.1 rule.

You still need to have the rule as it supplies the endpoint. And, it will be triggered by setting the variable. I just found a bug too: if you remove an endpoint trigger, it still works and still triggers the rule. I think this is easy to fix, and the fix is such that the variable would be set but the rule wouldn't be triggered without the endpoint trigger.

This is so good for my OCD, multiple endpoint rules can be combined into a single rule with multiple else-if's.

EDIT: found it, now to use (or misuse) it. Thanks.

Quick link to documentation if possible (spend no time on it, I haven't looked for any it because I haven't needed it, but I can see how this could be useful to me).