# GLUE lock working in Homey

**URL:** <https://community.homey.app/t/glue-lock-working-in-homey/47204>\
**Category:** Devices\
**Tags:** app, homeyscript\
**Created:** [May 8, 2021, 11:28am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204 "2021-05-08T11:28:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [May 8, 2021, 11:28am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/1 "2021-05-08T11:28:39Z")

</div>

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](https://homey.app/en-us/app/com.athom.homeyscript/HomeyScript/) 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](https://reqbin.com/curl) 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.

---

<div class="post-metadata">

**Author:** ![NiklasOstberg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niklasostberg/32/34635_2.png) [@NiklasOstberg](https://community.homey.app/u/NiklasOstberg)\
**Post date:** [August 16, 2021, 3:14pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/2 "2021-08-16T15:14:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [August 16, 2021, 8:44pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/3 "2021-08-16T20:44:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kent\_Ellegaard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kent_ellegaard/32/43914_2.png) [@Kent\_Ellegaard](https://community.homey.app/u/Kent_Ellegaard)\
**Post date:** [August 21, 2021, 8:45pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/4 "2021-08-21T20:45:00Z")

</div>

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 “”

---

<div class="post-metadata">

**Author:** ![NiklasOstberg](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niklasostberg/32/34635_2.png) [@NiklasOstberg](https://community.homey.app/u/NiklasOstberg)\
**Post date:** [August 23, 2021, 8:02am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/5 "2021-08-23T08:02:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kent\_Ellegaard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kent_ellegaard/32/43914_2.png) [@Kent\_Ellegaard](https://community.homey.app/u/Kent_Ellegaard)\
**Post date:** [August 23, 2021, 8:38am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/6 "2021-08-23T08:38:05Z")

</div>

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”’,

---

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [August 23, 2021, 12:31pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/7 "2021-08-23T12:31:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kent\_Ellegaard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kent_ellegaard/32/43914_2.png) [@Kent\_Ellegaard](https://community.homey.app/u/Kent_Ellegaard)\
**Post date:** [August 23, 2021, 4:37pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/8 "2021-08-23T16:37:10Z")

</div>

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.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/4/14ab3b7f51b2dc51f7dcdbf4f421ac7404b27072.png)

---

<div class="post-metadata">

**Author:** ![Kent\_Ellegaard](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kent_ellegaard/32/43914_2.png) [@Kent\_Ellegaard](https://community.homey.app/u/Kent_Ellegaard)\
**Post date:** [August 23, 2021, 5:12pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/9 "2021-08-23T17:12:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [August 27, 2021, 5:49am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/10 "2021-08-27T05:49:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mow87](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mow87/32/34093_2.png) [@mow87](https://community.homey.app/u/mow87)\
**Post date:** [September 7, 2021, 11:16am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/11 "2021-09-07T11:16:33Z")

</div>

Hi @Kjetil_Vert

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

Thanks!

---

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [September 7, 2021, 11:39am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/12 "2021-09-07T11:39:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mow87](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/mow87/32/34093_2.png) [@mow87](https://community.homey.app/u/mow87)\
**Post date:** [September 8, 2021, 11:44am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/14 "2021-09-08T11:44:51Z")

</div>

@Kjetil_Vert  
Sorry it’s working now!

---

<div class="post-metadata">

**Author:** ![Tarek-Salmi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tarek-salmi/32/45264_2.png) [@Tarek-Salmi](https://community.homey.app/u/Tarek-Salmi)\
**Post date:** [September 27, 2021, 6:11pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/15 "2021-09-27T18:11:29Z")

</div>

I get the following error when trying to get the api keys via curl:

{“correlationId”:“166c3a8c”,“code”:50003,“title”:“Limit of 10 api keys reached.”,“status”:400,“detail”:“Limit of 10 api keys reached.”,“instance”:"/v1/api-keys"}

---

<div class="post-metadata">

**Author:** ![PeterSthlm](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/petersthlm/32/34840_2.png) [@PeterSthlm](https://community.homey.app/u/PeterSthlm)\
**Post date:** [October 8, 2021, 12:31pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/16 "2021-10-08T12:31:08Z")

</div>

> [@Kjetil\_Vert](#):
>
> ```auto
> 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"})
> });
> 
> ```

A big thank you, who wrote and shared this!!!

---

<div class="post-metadata">

**Author:** ![Patrik\_Henriksson1](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/patrik_henriksson1/32/56421_2.png) [@Patrik\_Henriksson1](https://community.homey.app/u/Patrik_Henriksson1)\
**Post date:** [August 30, 2022, 8:32am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/17 "2022-08-30T08:32:15Z")

</div>

I get it to work lock the door, but not unlock it. Why not open?

---

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [November 10, 2022, 9:25pm UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/18 "2022-11-10T21:25:19Z")

</div>

I am 💯 this is a copy past error as this is working 100% for me for more then a year and on 2 locks at home.

The only change between lock and unlock script is the word lock and unlock 🤘

---

<div class="post-metadata">

**Author:** ![Ford](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ford/32/47941_2.png) [@Ford](https://community.homey.app/u/Ford)\
**Post date:** [October 3, 2023, 5:53am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/19 "2023-10-03T05:53:53Z")

</div>

I can confirm this works. But I’ve noticed that after a while, the unlock stops working and just initiates the lock, i.e. I can hear the little motor running but it doesn’t rotate to open. Any idea what could be causing this? Both (lock and unlock) worked for my initial tests, but now it stopped working.

---

<div class="post-metadata">

**Author:** ![Kjetil\_Vert](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/kjetil_vert/32/16770_2.png) [@Kjetil\_Vert](https://community.homey.app/u/Kjetil_Vert)\
**Post date:** [October 3, 2023, 6:41am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/20 "2023-10-03T06:41:53Z")

</div>

Hi I dont know what is wrong with your lock but it sounds like this has nothing to do with the script if it runs and the motor is moving.

I have this running at home and I only have a problem some times if the hub is offline and all I have to do then is cute the power and give it power again.

But as i have this now running daily for over 2-3 years I know the script is working 100%

---

<div class="post-metadata">

**Author:** ![Ford](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/ford/32/47941_2.png) [@Ford](https://community.homey.app/u/Ford)\
**Post date:** [October 4, 2023, 6:47am UTC](https://community.homey.app/t/glue-lock-working-in-homey/47204/21 "2023-10-04T06:47:46Z")

</div>

And after a bit more research on my part, I did notice that your script works perfectly indeed. I had trouble identifying the data from the Aqara push buttons. Was almost no documentation and I had to figure out the hard way exactly what was incoming when pushing. But as soon as I did, everything worked perfectly. Great job in the script!

[Next page](https://community.homey.app/t/glue-lock-working-in-homey/47204.md?page=2)
