Homey Community Forum

GLUE lock working in Homey

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.


Thank you! Is there any way to update the status of the lock after the script has been run?

Sadly not. There is no features in the API for that.

1 Like

Hi Kjetil
Thx for this but i have some problem.
when i trying to run script it says Returned: undefined

I dont know if i copy api key and id in the right way.
but i remove <>and just type id and API without “”

Hi, I had the same issue but got it working after a couple of tries.

Hi Niklas
can you tell how you write it ?
do you remove <> and do you leave " " signs ?

so it looks like this ?
‘Authorization’: ‘Api-Key “xxxxxxxxxxxxxxxxxxxxx”’,

No like this
'Authorization': 'Api-Key xxxxxxxxxxxxxxx'

Thx Kjetil
But now i have testet 20 times. and i cant get it to work.
I dont know if it is becouse they have made a update from glue.
if you lock out on app you need to use phone number to login and not e-mail as user.

any good ideas ? it keeps saying this when i make the test.

So sorry it works now.Awesome script. Thx again Kjetil

1 Like

Great that it works and hope you get it to work with a flow also👍

Hi @Kjetil_Vert

I am stuck on Script Success / Returned: undefined…
Can you help me?


As I have not seen your script I have no possibility to support you.

As this is working for all it have to be a copy past error

Sorry it’s working now!