Maker API Fail - Help Needed

I'm trying to use Maker API to send a value command to a device I have with the notification capability and I'm failing miserably. I've spent the morning screaming at ChatGPT to no avail.

My end goal is:

  • Apple Shortcut
  • Enter text
  • Text goes to my dashboard tile

The dashboard tile is my notification capable device driver (which is working but I need to make some alterations). As I was getting nowhere I thought I'd just update a variable via makerAPI and make a rule that when the variable changes, send it to my device tile - easy....not so much. I've added an instance of makerapi, enabled cloud, authorised the hub variable. Copied the url from maker adding in the hub variable and value and pasted it in a browser. It just returns 'Hub variable not found or not authorized' Where am I going wrong?

Edit: I mistakenly authorised the connector device and missed the Hub Variables selection so I've got that working OK. My workaround using a variable and RM will likely work but...

What I cannot fathom is how to send a command directly to my notification device

1 Like

I don't know anything about the Apple side of this, but if you can get your shortcut to make a http request to the hub, the MakerAPI side shouldn't be too hard. All the URLs you need are listed on the MakerAPI page.

You can use the following URL to get the commands for a specific device. Your Maker API page will have the correct app ID (33 on my hub), and the device ID goes in place of [DeviceID]. You could also use the local links instead of cloud links for this step.

When I point this at one of my notification devices, I get this:

image

So that shows the correct command is "deviceNotification".

The Maker API page shows this as the cloud URL to send a command:

There is a "secondary value". I tested and confirmed the secondary value is the notification text.

So when I access this URL in a browser...

https://cloud.hubitat.com/api/{api_key}/apps/{makerAPIappID}/devices/{deviceID}/deviceNotification/this_is_a_test_message?access_token={access_token}

... my device displays the notification. In my case, device #1 is my Hubitat mobile app device, and when I send that command to device 1, I get this in the Hubitat mobile app:

1 Like

Thanks @Alan_F . I've gotten a little further.

I was struggling to change a variable with maker API - managed that. Constructing the Apple Shortcut was the next issue but I've got that working now too. So opening the Apple shortcut 'Send Message' on my phone presents me with a text input box. I enter the text and behind the scenes it inserts that text into the maker api url and updates the hub variable - result!

I can easily now set up an RM rule to monitor that variable and send it to my dashboard notification tile on change. I could just put the variable directly on the dashboard I suppose but the reason for wanting it to go to my notification driver is that it'll add multiple messages into a sequence which is handy.

Your info is very helpful (particularly regarding command and secondary value) so hopefully I'll be able to reconstruct my shortcut to do everything directly. :+1:

Got it all sorted after a lot of messing on:

I had a couple of issues:

1 - My driver needed to see a message ID before the message. I had to alter the driver code to add an ID automatically when a message is received without one.

2 - Apple Shortcuts app. I had a lot of messing getting the maker api url assembled. I needed to account for multi word messages as these were being ignored due to the spaces. Encoding the whole url put unwanted characters in that stopped it from executing. The solution was to url encode the text input only, then have shortcuts save that encoded text to a variable, then insert that inside the standard maker api url.

Result - Text input from iPhone goes into my dashboard message tile queue/sequence. Next up - get that to work with Siri...

Edit: Working with Siri too :slight_smile:

1 Like