Help with rule machine local endpoint basics


Please forgive me if I am missing something basic. This is my first deeper dive into the Hubitat world and working with Rule Machine.

I am having a terrible time getting the local endpoint to work and keep getting the same error (below). Can someone please let me know what I am messing up in the code?

Here is the base code given to me from RM for the local endpoint (Token and address changed for security)

I am attempting to trigger the app with this code:

But keep getting this error:
"error": true,
"type": "java.lang.Exception",
"message": "An unexpected error occurred."
13 should be the correct AppId and I have read through the documentation several times but don't see what I am missing (Rule Machine - Hubitat Documentation

Any help would be very greatly appreciated!

Welcome to the community! Could you explain what you're trying to do? I prefer not to speak geek. Post a screenshot of your rule or something. There isn't a wrong way necessarily, but maybe a different way, but there's no way for me to tell what your goal is based on what you posted.

It sounds like you're combining two different things. If you created a "Local Endpoint" trigger in RM, then doing an HTTP GET on that URL will cause the rule to trigger. (This is a way to manually or automatically trigger a rule from something on your LAN outside of a Hubitat app, as an alternative to "traditional" triggers built in to RM, like device events or specific times.) The exact URL provided here is the only one that will work for this purpose, and its only purpose is to trigger the rule.

The docs you linked to are for the RM API that you can use if you are writing an app yourself on Hubitat in Groovy. It looks like you are just trying to run the rule actions (if my assumption based on what parts of the docs you were looking at is correct). That's what triggers do, so a simple HTTP GET (or just visiting the URL in a browser) on the local endpoint URL provided by your Rule trigger will do that.

If you're trying to do something else, I second the idea above to provide more information about the automation you're trying to achieve. Good luck!

Hello @april.brandt - thanks for the quick reply. I am just trying to wrap my head around this so I am just trying to trigger a light to flash when the endpoint is hit. However I just get that error whenever I go to the end point (either with the browser on when doing a GET using Postman locally.

Hello @bertabcd1234 thanks for the feedback. You are absolutely correct I am just trying to do something simple (using the URL to trigger a light to flash). I first thought I could just put that into my browser and it would work and then started using postman to do a GET but in both cases I get back the same error I put in my post "java.lang.Exception". I suspect there is something wrong with the way it is formatted (e.g. is runRuleAct=13 not the correct way to trigger this? or do I need to do additional setup?)

Correct, this is wrong. (Did I phrase that confusingly? :rofl:)

You want the first URL in your post. This is the one RM directly provided you, the one that looks like http://<hubIP>/apps/api/<appNum>/trigger?access_token=<access-token>.

@bertabcd1234 - okay so the URL provided should work as is? When I put that in a browser or run a http get through postman I still get the same error "java.lang.Exception". So I feel quite dumb because I still don't understand why it is not working.

Just to be clear since it is easy for me to miss something... Putting " "" in a browser on my local network should trigger the rule (with the correct HubIP and Access token)?

Yes, the URL should work as-is and is the only URL/path that will work for this purpose. Does clicking the link in RM do anything? You should have seen something like this when creating the trigger, which is presumably where you got the link from in the first place, but you can get to it after the fact with the "Edit event trigger" dropdown after clicking into your "Triggers" section to edit:

"Use this local URL to trigger: Local end point URL link" screenshot

If clicking that link works, then I'd say something went wrong with your copy and paste, and you can probably try it again to figure that out. If this link doesn't even work in your browser (you are correct that this should work), then something else is wrong. Maybe try removing this trigger and creating another one? I'd also hit "Done" to save the rule if you haven't already--I'm not sure when these endpoint settings get committed to the app/rule, but a "Done" would for sure do it.


@bertabcd1234 - thanks for the clarification, it was helpful and allowed me to focus on the real issue. I redid the rule as suggested and it is working. There was some mistake in how I had it set up that did not have to do with the endpoint. Apparently you get the "java.lang.Exception" error when your rule logic is wrong which was confusing since I thought that seemed like a error with the endpoint.

To come full circle I now have a NFC chip glued to the entry of my building that turns on my entry lights when I come home. It is a good day. Appreciate your help on this!

1 Like

Thanks for this, I worked a whole day trial and error before finding the solution here.

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