Maker API

Are there cloud endpoints for the maker api?

Technically, yes. The intent was to be a local API.

However, you can replace the http://ip/apps/api/[id] part with this:

https://cloud.hubitat.com/api/[hub id from settings]/apps/[id]

I've added the option to disable cloud access and to show cloud endpoints as well if enabled to the feature list.

2 Likes

Should this work?

https://cloud.hubitat.com/api/[HUBUID]/apps/api/937/devices/all?access_token=[maker access token]

you have "/api/" in twice. remove the 2nd one before the app id

So I have not gotten to play with this app yet, however I believe it is going to be a gem. I have many use cases where this will be very valuable.

Whoever decided to build this app should be given a raise!!! You read my mind....

1 Like

Actually I built it a long time ago but we just got around to adding it in. It's by no means meant to be a full API (puts, gets, posts, etc with webhooks and such) but for "Makers" who just need a simple way to send commands and/or get device status it has helped me immensely.

2 Likes

I think I’m going to be able to build a chat bot with it but I’m not home to play with it.

I love how much data can be gleamed from this. I can now Powershell my Hubitat and make decisions in Powershell code to turn things on, off, etc or just collect data when desired. Use the API in C#, VB .Net, curl, etc. Oh the possibilities!

Powershell examples:
#Get The current data into a variable we will call $devices
$DeviceFullDetailsURL = http://x.x.x.x/apps/api/xxxx/devices/all?access_token=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
$devices = Invoke-RestMethod $DeviceFullDetailsURL

#List the temperature of sensors
$devices | where {$_.attributes -like "*temperature=*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label,temperature -ErrorAction SilentlyContinue

#List the humidity reading from all sensors
$devices | where {$_.attributes -like "*humidity=*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label,humidity -ErrorAction SilentlyContinue

#List all devices in an ON state
$devices | where {$_.attributes -like "*=On*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all devices in an OFF state
$devices | where {$_.attributes -like "*=Off*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all devices in an ACTIVE state
$devices | where {$_.attributes -like "*=Active*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all devices in an INACTIVE state
$devices | where {$_.attributes -like "*=Inactive*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all locked devices
$devices | where {$_.attributes -like "*=locked*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all unlocked devices
$devices | where {$_.attributes -like "*=unlocked*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all open devices
$devices | where {$_.attributes -like "*=Open*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#List all closed devices
$devices | where {$_.attributes -like "*=Closed*"} | select-object label -ExpandProperty attributes -ErrorAction SilentlyContinue | select label -ErrorAction SilentlyContinue

#Get the last active timestamp (I think this is what this is, comparison with the Devices page mostly agrees
$devices | select-object label,id,date | sort date

So on and so forth.
To look at all available device details that you can work with, just execute $Devices once you've run the Invoke-RestMethod call.

Note: This data is collected when you run "Invoke-RestMethod", after that you are just dealing with the data that was collected at that point in time. To get a full updated list, you would need to run the Invoke-RestMethod call again.

Edited 11/28/2018 to change from returning "name" (which typically contains the device driver name) to returning "label" (which typically contains the name you gave the device)

6 Likes

This could be used to make a mobile app !

3 Likes

This is awesome, but a nice addition would be some configuration of “web hook” urls that would be called on changes to selected devices.

Thanks for this feature! So far I've used it to eliminate two IFTTT recipes that linked into Tasker on my phone. IFTTT is fine when there are no other options, but slow and flaky.

2 Likes
 A real-time event websocket would really round things off ...
4 Likes

Oh yes please.

Could someone explain to us dummies that just copy/paste other people’s code what this can be used for? :crazy_face:

3 Likes

I second that :point_up:

1 Like

Maker API allows external HTTP GET (browser URL) access and control to your authorized devices.

For example, you can get the status of a device in a JSON object or send a command to a device (and get a response of the device back in JSON)

The reason it is called "Maker API" is it is specifically targeted to the maker community that needs simple URL based local access to specific devices.

If you are not a Maker or Developer it probably has very little use to you unless you want browser URL based control of a specific device.

The app itself has several examples of how to use it.

2 Likes

@patrick

Is there a chance you would add arrived and departed as working commands?

Yes. They are in the next update.

1 Like

Lordy, just found this thread. Sooo happy i am on HE.

1 Like

I'm getting the following error with trying to user the cloud end point.

{"message":"Missing Authentication Token"}

I'm using the "token" from the Maker API URL samples.