You can create both cloud and local endpoint as OR triggers in same rule. Then in Tasker, setup a variable that is set to "X" when connected to your home WiFi and "Y" when not. Then in Tasker, your task checks the value of that variable and sends appropriate HTTP Request.
Great thread. I didn't even realise we could trigger a rule from an endpoint. Today I learnt something once again Schweet.
Yep, thanks all for your help, I think I got it.
I don't use these endpoints in Tasker directly, I create a "web service" using AutoWeb - basically a collection of endpoints so that I can abstract tasker from direct calls.
Next step for me will be to figure out under which conditions to call the local endpoint, and under which a cloud one.
Again thanks all for your help, it took some time for me to wrap my head around this concept, but I guess I at last got it working
I don't have that piece of Tasker installed. I will have to give it a test.
I assume the appiid is the appid of Rule Machine, as seen in http://10.0.0.102/installedapp/configure/6/mainPage
.
But this: 10.0.0.102/apps/api/6/trigger/getRuleList?access_token=xxx
returns
<oauth>
<error_description>xxx</error_description>
<error>invalid_token</error>
</oauth>
What token do I use? The only places I can see to get a token is in the Maker API app, or in an individual rule if I create a local end point trigger. None of those tokens work. What am I missing here?
Is there an equivalent "get" global var? I know I can create a RM connector and enable it in the maker api and then query the device, but that's clumsy and clutters up the devices list.
Thanks.
Create an endpoint URL in a Rule (local or cloud as you may need), and that will have the access token in it. This is described in the original post above:
Hmmm, it does seem to be broken. Will investigate...
I assume then that what you mean by the above is "Create an endpoint URL in ANY rule, it doesn't matter which one, and that will have an access token you can use for getRuleList and setGlobalVariable". Is that correct?
Since getRuleList and setGlobalVariable have nothing to do with a specific rule, do you use the appid of the rule you got the token from, or the app id of Rule Manager itself for these two commands?
The rule with the endpoint has to exist. The API access is via that rule.
I just confirmed that setting a GV with this works.
Yes it does, but it also runs the rule. Is that intentional?
Is there a complimentary /getGlobalVariable? If not, can it be added?
If I try /getGlobalVariable I don't get an error but the rule runs.
def rules = RMUtils.getRuleList()
Is there an update to this to pickup up the new RM 5.0 rules?
Yes, sorry that I haven't caught up with the documentation yet.
def rules50 = RMUtils.getRuleList('5.0')
and for actions:
RMUtils.sendAction(rule50abc, 'pauseRule', app.label, '5.0')
Defaults to Rule-4.1 when omitted.
Thank you!
Thanks,
Yes, sorry that I haven't caught up with the documentation yet.
def rules50 = RMUtils.getRuleList('5.0')
and for actions:
RMUtils.sendAction(rule50abc, 'pauseRule', app.label, '5.0')
Defaults to Rule-4.1 when omitted.
Happy New Year Bruce. I'm adding RM5 support to my ABC app. Can you tell me what the minimum HE firmware version is needed for RMUtils to support version 5? I want to include this info in my changelog.
I don't know. That would take a lot of digging to find out.
minimum HE firmware version
If you want to play it safe, it was probably somewhere in 2.2.8, so maybe the latest in that series, 2.2.8.156, would be something to specify (it was definitely there before 2.2.9, given that the post was made on August 21 and 2.2.9 was released on October 7).
Thanks...I'll put 2.2.9 as the minimum.
Can we do this as save rules?