I was saying it in my Year in Review, my focus for 2019 is to work on the Gladys Gateway and Gladys 4.
So today, I'm happy to release the Open API of the Gladys Gateway! This enable many things, including the ability to control your house with Siri.
Configure the Gateway Open API
The first step is to upgrade Gladys to version >= 3.12.0.
To upgrade, you can launch the script "/home/pi/rpi-update.sh" on your Raspberry Pi.
Activate the Gladys Gateway API
Go on your local Gladys instance, and go to
Gladys Gateway, then at the bottom of the page, activate the Open API.
I decided that Open API would not be turned on by default so that people can choose.
Create an API key
The following step is simple. Go to plus.gladysassistant.com, connect with your Gladys Gateway account.
Note: If you don't have a Gladys Gateway account yet, you need to subscribe to Gladys Plus 🙂
You should see this screen:
Give a name to your open API key, then click on
The Open API key will be displayed. You need to save it somwhere, because you won't be able to see it again as the key is saved as a hash in DB.
Testing the API
Note: This step is not mandatory, but will help you understand how it works.
Download an HTTP client like Insomnia.
Create a new request by clicking on
Give a name to your request, then select
POST on the right, then
Finally, click on
Call the API for a message command
Replace the URL with
Don't forget to replace your API Key in the URL.
In the JSON Body, put
You can put any sentence you want to say to Gladys.
Send, your Gladys instance should receive the request.
Call the API to create an event
There is another API route that enables you to create event in Gladys.
Just change the URL to:
And the body to:
You can put any code you find in this list.
The "house" attribute is the ID of your house in Gladys.
We are now going to create a Siri Shortcut.
You need to download the Apple Shortcut app.
In the app, click on
In the search bar, search
Url and click on the
In the URL field, enter the URL we used before:
Then, look for the
Get Contents of URL block, and click on the element.
Advanced, change the method to
In Request Body, click on
Add new field =>
Key = "Text" and as
Text, put your sentence
Finally, click on the configuration button on the top right, and select
Add to Siri.
Give a sentence to Siri, like for this example
I'm leaving home.
To do the same with event, it'll look like this:
You can test the integration by clicking on
Play or on the shortcut on the homescreen of the app.
If you want to use this shortcut without talking to Siri, you can even add the shortcut to the home screen or in the widget view:
This was just a simple example of what it's possible to do with this new Open API. Of course you can do many other things: use Tasker, IFTTT, and I'll probably write more about this in a new article.
Thanks for reading this article, if you have question, don't hesitate!