Maker API documentation and examples

I want to use the MakeAPI for simplicity but there seems to be limited documentation. I"m starting with the Philips Hue and can set level and color temperature but I can't seem to set Hue.

Are there examples or more documentation on the Interface?

I also look forward to a notification capability either with WebSockets or a URL.

You’ve probably already found this, but just in case...

https://docs.hubitat.com/index.php?title=Maker_API

Thanks. I found it but maybe it was just thanks to your link. 12 days is so long ago ...

1 Like

(This is partially new confusion and partially an old request)

I'm puzzled by "URL to send device events to by POST" and "include location events to be sent by POST?". I can't find those phrases in the documentation.

What I want is a URL that gets invoked whenever there is an event. (ideally, with a JSON payload with event info). I did implement this on Smartthings but the code would need cleanup to port since it was written as I learned and without good debugging tools. Much better to have the feature as part of the MakerAPI. Even better if it's already there. The static friction of coming up to speed again .. and again ... is high

Some snippets from my implementation (and, yes, not elegant)

	subscribe(d_switchlevel, "switchLevel", "_on_event")
....

def _on_event(evt) {
    msg "_on_event XXX event.id=${evt?.id} event.deviceId=${evt?.deviceId} event.isStateChange=${evt?.isStateChange} event.name=${evt?.name}"

	try {
		def dt = _device_and_type_for_event(evt)

		if (!dt) {
			msg "_on_event deviceId=${evt.deviceId} not found?"
			return;
		}

		def jd = _device_to_json(dt.device, dt.type)
		jd["current"] = null;		// Work-around for now
		_send_pushingbox jd
	}
	catch (e) {
		msg "_on_event error ${e}"
	}
}

..........

/*
 *  An example of how to get PushingBox.com to send a message
 */

def _send_pushingbox(js) {
	msg "_send_pushingbox(${js})"

	js['version'] = state.version	// Identify the version for debugging and whatever
	try {
		def pollParams = [
			uri: "http://<homesystem>",
			path: "/st/devinfo",
			headers: ["Content-Type": "text/json"],
			body: js
		];
		sender("_send_pushingbox", pollParams)

	}
	catch(e) {
		msg "Error in _send_pushingbox: ${e}"
	}
}

etc.

The 1st one is exactly as it sounds. If "URL to send device events to by POST" is configured, Maker API will send events for any devices added in the Maker API config via a POST to the specified URL.

I have some guesses on the 2nd one, but don't know for sure so I'll let someone else comment.

OK, it works! I was being cautious because I didn't want to break anything.

Too bad it's under-documented - it sends the device info as a JSON payload.

Very Nice.

Well... There is this (below) if you search the forum. So that's something.

OK, so it was a new feature and I had just missed the announcement. While the documentation is still confusing because it only describes how to set the URL from a program and not view the MakerAPI user interface which is very simple -- I just specify a URL and listen for the content.

Perhaps I'm being greedy but ... would be nice to be able to get a broadcast message so I can multiple listeners. Shelly is nice in broadcasting every event.

Still, great to have it.

2 Likes

Too bad devices like Yeelight don't seem to do notification so, for most devices, I seem to only get notified if they change through the app.

:man_shrugging: Can't help you there... If it doesn't update/change state in Hubitat, then of course it won't make an event... Maker API can't send events that Hubitat doesn't see.

Understand the limits of Hubitat. But it would be worth having a periodic polling for devices that don't announce. Also, Hubitat can be in the position of representing a market that can petition for such capabilities. I do what I can in my column but the more voices the better.

I do think that the industry is slowly converging on open APIs and notification and other such concepts but, alas, slowly.

That said, I appreciate whatever works.