To get GLUE smart lock working in Homey you can do this by using the GLUE api and calling this with two (lock and unlock) Homeyscript app that you then uses in a flows.
First you have to you need to create an api-key from GLUE api this is done by going to this page here and add this script and press run
remember to change <user>:<pass>
to your user and password for the glue lock without the <>
.
curl --location --request POST 'https://user-api.gluehome.com/v1/api-keys' --header 'Content-Type: application/json' -u <user>:<pass> --data-raw '{ "name": "My Test Key", "scopes": ["events.read", "locks.read", "locks.write"] }'
After this you will now have the api-key in the replay to the right in the page.
Copy this and replace <api-key>
in this script and past and run this at the same page.
You will now have the lock-id
curl -L -H "Authorization: Api-Key <api-key>" https://user-api.gluehome.com/v1/locks
Then you have all you need to make the 2 homeyscript in homey to make the lock and unlock scripts.
So go to homeyscript and add a new script called unlock and past this
Remember to replace <lock-id>
with your lock-id from before and <api-key>
with your api-key from earlier.
fetch('https://user-api.gluehome.com/v1/locks/<lock-id>/operations', {
method: 'POST',
headers: {
'Authorization': 'Api-Key <api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({"type":"unlock"})
});
Then add one more script and call this lock and past this
Remember to replace the lock-id and api-key here also.
fetch('https://user-api.gluehome.com/v1/locks/<lock-id>/operations', {
method: 'POST',
headers: {
'Authorization': 'Api-Key <api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({"type":"lock"})
});
Then you can call the scripts in any flow you would like to lock and unlock your GLUE lock.