[Solved] MakerApi - Get and Set Modes

Ahh I see now. Yeah it works as intended but I guess not the way I expected it to.

If I type in...
http://[ip address]/apps/api/5/hsm?access_token=[access token]

it returns...
{"hsm":"disarmed"}

I wanted to get it working with the HomeHabit app but that uses the Get All Devices url and HSM is obviously not part of that list. I'm not even sure HomeHabit would recognize it anyway, so I'll look into controlling it another way (probably using virtual switches).

Nope, and neither are modes.

Gotcha, I see that now. Thanks for the quick response Jason.

1 Like

Hubitat integration in HomeHabit will get further improvements in the near future, which will include support for both HSM and modes.

1 Like

Cool, thanks Igor. I'll stay tuned.

Sorry to revive an old thread... I managed to set Away mode via the MakerAPI but I can't set to Home?

:33 is my Away mode ID

http://192.168.33.193/apps/api/1/modes/:33?access_token=my_token

How do I find these ID's? I want to trigger Night or Vacant mode through MakerAPI

TIA,
Ryan

http://192.168.33.193/apps/api/app_number/modes?access_token=your_token

Your app_number is the MakerApi app number, if you go to its settings, in the URL bar.
image

Thanks - except I can't find the "33" for Away Mode in your example. I created a few also, but can't figure out what to click on to reveal it in the URL.
image

I was using a scene activator device previously, but am tweaking it to just change the mode, and then have RM manage it based on "set scene per mode" and then have them all in one clean rule.

If you enter the http://192.168.33.193/apps/api/app_number/modes?access_token=your_token URL in a browser, you'll get a json response that contains your hub modes.

[{"active":false,"id":1,"name":"Day"},{"active":false,"id":2,"name":"Evening"},{"active":false,"id":3,"name":"Night"},{"active":true,"id":4,"name":"Away"},{"active":false,"id":33,"name":"Home"}]

And after pasting that, I just realized that I picked up the wrong mode ID when I posted a few months back. LOL

1 Like

Ah, I see - perfect, thanks! I'm super noob to anything api or app dev level. Mostly just familiar with logic/rules and still new to hubitat on that end!

Thanks sir, and glad to hear you are still tweaking too - seems it never ends ha

Why am I gettin a invalid token message when I do this? It 100% is the right token. MakerAPI is 150 and the Modes Manager is 141. I tried both but I get the same. Has the spelling changed in recent updates?

Either the app number is incorrect, or the token is incorrect. BTW, the app number should be for the instance of MakerAPI that your integration is using.

No.

Thx for the answer. I'm using 150 for the MakerAPI that's the number showing when I open its page in the browser and it works for sending commands to devices, together with this very same token, all is working fine.

How do I find if there's another instance of MakerAPI with another app number? AFAIK, I only have one instance of MakerAPI, as I only installed it once and only have it once on my list of apps.

I don't know what you are doing incorrectly, but just to verify - on the MakerAPI app page, what is the App ID shown? Is it 150?

My MakerAPI app id is 1522 (see below):

Here's an example of getting and setting modes:

curl http://192.168.1.46/apps/api/1522/modes?access_token=xxxxxxxxx > out

cat out
[
  {
    "active": false,
    "id": 1,
    "name": "Home"
  },
  {
    "active": false,
    "id": 3,
    "name": "Sleep"
  },
  {
    "active": true,
    "id": 4,
    "name": "Away"
  },
  {
    "active": false,
    "id": 65,
    "name": "Dummy"
  }
]

This basically shows that my HE is currently in Away mode.

To set the mode to Home mode, I would send this URL:

curl http://192.168.1.46/apps/api/1522/modes/1?access_token=xxxxxxxxx

Because the id for Home mode is 1.

1 Like

I'm feeling ashamed.... It was as simple as an extra letter that somehow, found its way into the middle of the access token. All is well when it ends well....

5 Likes