I'm hoping to find a nice way to set some hub variables from a bash script running on my Raspberry Pi which is on the same network as the hub.
I saw some related posts on here but they didn't seem to quite hit my use case. I believe I need to hit the hub API with a curl call and provide an apikey, but Maker might be involved?
Has anyone been through this one that can provide some assistance?
I don't quite get why I need to have a rule to make this work but I'll try to work through this concept. I guess the API calls somehow leverage a rule which seems odd.
You do know what you're doing. This is accurate (and the docs mention it, which is I assume where you got it from):
And that is because when you add a local (or cloud, depending on your needs) endpoint trigger to a rule, you will get a URL. You can use that URL as a start, modifying the paths or parameters as needed. It includes the access token (and the app ID, which you will also need--the 10249 in the example above).
When I create a Maker app, it seems all about getting info and controlling devices which is not what I want to do. I simply want to make an API call to set a hub variable.
It's also unclear whether I can repurpose the access_token already created for my Maker which is set up for Locative presence or not.
It's also unclear how the connection is made between an app with a Local end point trigger and an access_token from a Maker app. i.e. Having more than 1 Maker app means having than 1 access_token
That is correct. Why are you trying Maker API? You linked to the Rule Machine docs above, and that is the correct app to use for this purpose.
No. Access tokens are particular to the app they were created for.
Correct. The access token is sort of a password. It does not "connect" the HTTP call to a particular app; the app ID in the URL does that.
You need to create a rule with a local (or cloud, whatever you need) endpoint trigger. If you only want to use the HTTP API to set a variable, you don't even need any actions, just the trigger.
You need to create a rule with a local (or cloud, whatever you need) endpoint trigger. If you only want to use the HTTP API to set a variable, you don't even need any actions, just the trigger.
When you add a local (or cloud, depending on your needs) endpoint trigger to a rule, you will get a URL. You can use that URL as a start, modifying the paths or parameters as needed. It includes the access token (and the app ID, which you will also need--the 10249 in the example above).
If that second part sounds confusing, just try it and you'll see.
Again, even if you got this token, it would not work for another app.
Ok now I see what happened, I ran into a RM bug where I cloned a rule, deleted the trigger, and when I added Local end point trigger I didn't see that URL link.