Note! The following instruction is dedicated for the second generation HTTP Gate module!
The following instruction for integration with Tedee lock is based on the information provided on:
https://tedee-tedee-api-doc.readthedocs-hosted.com/en/latest/index.html.
To integrate Grenton system with Tedee lock, please follow the steps described below:
1. Create following User features on Gate_HTTP.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119081609originalpd4VA2co-VDvjW-hBx9NWpx3R7gApymRCw-2.png)
Note! The value of the tedee_lock_sn feature is the serial number of your lock. This information is available in the dedicated application: My devices-> Door Lock -> Lock -> Settings -> Information.
2. Create a HttpRequest virtual object.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119079885originalOUsaObg0ELl7T8FN6X4XDQWE_6C9RJwVng-2.png)
3. Set the TedeeLock_AuthorizationKey virtual object’s properties as follows. This configuration allows retrieving basic information about the lock (i.a. access key).
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119243022originalm16bqpfMkl3WuJu21cntjOi9JUI9jMVq1g-2.png)
Where:
Host: https://tedee.b2clogin.com
Path: /tedee.onmicrosoft.com/B2C_1_SignIn_Ropc/oauth2/v2.0/token
QueryStringParams: \z
4. Create a Tedee_AuthorizationKey_req script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119242768original_HilsniczuhzPRmw9xf2uEC36x8H8Bf3Bg-2.png)
Note! The username (MAIL) and password (PASSWORD) must be replaced with the data used to log in to the dedicated application (according to URL encoding).
Note! The @ sign in the email address should be replaced by %40.
local get_key = {"&grant_type=password&client_id=02106b82-0524-4fd3-ac57-af774f340979&scope=openid+02106b82-0524-4fd3-ac57-af774f340979&response_type=token&username=MAIL&password=PASSWORD"}
Gate_HTTP->TedeeLock_AuthorizationKey->SetRequestBody(get_key)
Gate_HTTP->TedeeLock_AuthorizationKey->SendRequest()
5. Create a Tedee_AuthorizationKey_resp script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119242046originald64tG_n5RQdVPsoDYanxVShLDDhwUr8ktg-2.png)
if(Gate_HTTP->TedeeLock_AuthorizationKey->StatusCode==200) then
local resp = Gate_HTTP->TedeeLock_AuthorizationKey->ResponseBody
Gate_HTTP->tedee_access_token = resp.access_token
Gate_HTTP->tedee_token_type = resp.token_type
Gate_HTTP->tedee_token_expires = resp.expires_in
end
6. Assign this script to OnResponse event of the TedeeLock_AuthorizationKey virtual object.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119241962originalxJ3WTDi8HngEg70q9Gb8we8BI6qcmRrnqw-2.png)
7. Send the configuration to CLU and run the Tedee_AuthorizationKey_req script. User features will take appropriate values.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119244056originald3bFJfO7laoy-wNcoUfmzacr6fA1WzjwVw-2.png)
8. Create a HttpRequest virtual object - TedeeLock_DeviceID – which allows retrieving the lock’s ID.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119241842originaldwLRGqCe4k4wiw39T8D9YnVY-AbgsfEYJg-2.png)
Where:
Host: https://api.tedee.com
Path: /api/v1.15/my/lock
QueryStringParams: \z
9. Create a Tedee_DeviceID_req script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119241650originalMRVlpcvAmZUgaNPKVNXFHw3qxlYQO4KrBw-2.png)
local key = "Authorization: Bearer " .. Gate_HTTP->tedee_access_token .. "\r\n"
Gate_HTTP->TedeeLock_DeviceID->SetRequestHeaders(key)
Gate_HTTP->TedeeLock_DeviceID->SendRequest()
10. Create a Tedee_DeviceID_resp script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119241529originalKwgH22NMaKIfjp5axvMvgPtj7CaYrV_Shw-2.png)
if(Gate_HTTP->TedeeLock_DeviceID->StatusCode==200) then
local resp = Gate_HTTP->TedeeLock_DeviceID->ResponseBody
Gate_HTTP->tedee_lock_sn_get=resp.result[num].serialNumber
if(Gate_HTTP->tedee_lock_sn==Gate_HTTP->tedee_lock_sn_get) then
Gate_HTTP->tedee_lock_id = resp.result[num].id
else
Gate_HTTP->Tedee_DeviceID_resp(num+1)
end
end
Where num feature is a parameter of this script.
Note! One Bridge and one Tedee lock were used in the example shown.
11. Assign Tedee_DeviceID_resp script with num parameter equal 1 to OnResponse event of the TedeeLock_DeviceID virtual object.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119241242originalED8le0ALDMGJ48qdvM5iqg_h3TrNiSPpag-2.png)
12. Send the configuration to CLU and run the Tedee_AuthorizationKey_req and Tedee_DeviceID_req scripts. User features will take appropriate values.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119244824originalaAa9S7fj5K3OLKpTGFb7XHR54x6WJ39N2g-2.png)
13. Create a HttpRequest virtual object - TedeeLock_LockID – which allows retrieving information about the lock (i.a. lock battery level).
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119241004originalrW8z0xBTH4NPJnvyDE0lwvnA2RpgG1v6sQ-2.png)
Where:
Host: https://api.tedee.com
Path: /api/v1.15/my/lock/
QueryStringParams: \z
14. Create a Tedee_LockID_req script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119240728originalu2U1ZE1ZJmfIRKywysf-3APwx_vtZprY0Q-2.png)
local path_1 = "/api/v1.15/my/lock/" .. Gate_HTTP->tedee_lock_id .. "/sync"
Gate_HTTP->TedeeLock_LockID->SetPath(path_1)
local key = "Authorization: Bearer " .. Gate_HTTP->tedee_access_token .. "\r\n"
Gate_HTTP->TedeeLock_LockID->SetRequestHeaders(key)
Gate_HTTP->TedeeLock_LockID->SendRequest()
15. Create a Tedee_LockID_resp script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119240607originalnmULajrrHgUUSkIC0He6tClJgQbDYFWZ8A-2.png)
if(Gate_HTTP->TedeeLock_LockID->StatusCode==200) then
local resp = Gate_HTTP->TedeeLock_LockID->ResponseBody
Gate_HTTP->tedee_lock_state = resp.result.lockProperties.state
Gate_HTTP->tedee_lock_charging = resp.result.lockProperties.isCharging
Gate_HTTP->tedee_lock_battery = resp.result.lockProperties.batteryLevel
end
16. Assign this script to OnResponse event of the TedeeLock_ LockID virtual object.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119240443originalJtzuU6IxwdybH5oxeyVW1xxy0ImHQ2Tjxw-2.png)
17. Send the configuration to CLU and run the Tedee_AuthorizationKey_req and Tedee_DeviceID_req and Tedee_LockID_req scripts. User features will take appropriate values.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119225309originalKUE1mE5eE69XJxhAagXag-ep6xVJ1eGOsg-2.png)
18. Create a HttpRequest virtual object - TedeeLock_Open – which allows to open the lock.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119240287original0B8rIxnO2M41B1DaR9tEA7Qy_kPXKDZyeA-2.png)
Where:
Host: https://api.tedee.com
Path: /api/v1.15/my/lock/open
QueryStringParams: \z
19. Create a Tedee_ Open_req script. After sending configuration to CLU, this script will open the lock.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119239553originalibxPsSQuF_xFo-qzFJKUdpEfVTqt5_4cLw-2.png)
local body_1 = {deviceId = Gate_HTTP->tedee_lock_id}
Gate_HTTP->TedeeLock_Open->SetRequestBody(body_1)
local key = "Authorization: Bearer " .. Gate_HTTP->tedee_access_token .. "\r\n"
Gate_HTTP->TedeeLock_Open->SetRequestHeaders(key)
Gate_HTTP->TedeeLock_Open->SendRequest()
20. Create a HttpRequest virtual object - TedeeLock_Close – which allows to close the lock.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119239405original4TCwZVoDl6k7dE2yNCD5Qb4uR8YSz9LQxA-2.png)
Where:
Host: https://api.tedee.com
Path: /api/v1.15/my/lock/close
QueryStringParams: \z
21. Create a Tedee_Close_req script. After sending configuration to CLU, this script will lock the lock.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119238991originalZ4g1hVFnxqaFl81X-mEV1LgFTAtsT-Ukow-2.png)
local body_1 = {deviceId = Gate_HTTP->tedee_lock_id}
Gate_HTTP->TedeeLock_Close->SetRequestBody(body_1)
local key = "Authorization: Bearer " .. Gate_HTTP->tedee_access_token .. "\r\n"
Gate_HTTP->TedeeLock_Close->SetRequestHeaders(key)
Gate_HTTP->TedeeLock_Close->SendRequest()
22. Create a HttpRequest virtual object - TedeeLock_ PullSpring – which allows to pull the spring.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119238844originalAFp4dVcikdURbKSMVIAHHfItyAd9PoYvBg-2.png)
Where:
Host: https://api.tedee.com
Path: /api/v1.15/my/lock/pull-spring
QueryStringParams: \z
23. Create a Tedee_ PullSpring_req script. After sending configuration to CLU, this script will pull the spring.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119238559originalkZRBJJ6_GL7ScTRcIyZ7ayX8kXqGGHegWQ-2.png)
local body_1 = {deviceId = Gate_HTTP->tedee_lock_id}
Gate_HTTP->TedeeLock_PullSpring->SetRequestBody(body_1)
local key = "Authorization: Bearer " .. Gate_HTTP->tedee_access_token .. "\r\n"
Gate_HTTP->TedeeLock_PullSpring->SetRequestHeaders(key)
Gate_HTTP->TedeeLock_PullSpring->SendRequest()
24. At the end, the call of Tedee_AuthorizationKey_req script assign to OnInit event on Gate_HTTP.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119238428originalch402D8D8QwVSqkdsqvVpYLNHaJUpmOmyg-2.png)
Note! The token expires after defined time (tedee_token_expires user feature), thus the Tedee_AuthorizationKey_req script requires to be called cyclically, for example by using a Calendar virtual object.
25. The call of Tedee_DeviceID_req script add in Tedee_AuthorizationKey_resp script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119238364originalozPb8kIFWDEC4nCXkROtWYOexXCxXsy5FA-2.png)
26. The call of Tedee_LockID_req script add in Tedee_DeviceID_resp script.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/s3.amazonaws.comcdn.freshdesk.comdatahelpdeskattachmentsproduction35119238142originalG-jzVVyl7cV9k7KabI8Fu4yOmc4bD0lI6g-2.png)
27. The configuration prepared in that way, send to Gate_HTTP module.
The way to control a Tedee lock using the myGrenton app is presented in the following article: Control with Tedee Lock.
![](https://knowledgebase.grenton.com/hubfs/Knowledge%20Base%20Import/support.grenton.plensupportsolutionsarticles35000167879-gate-http-integration-with-tedee-lockhit-2.gif)