A restful API for TT lock for home assistant integration; handles access tokens and dates
2.5K
A restful API for TT lock; handles access tokens and dates https://github.com/stevendodd/ttlock-docker
curl --location -g --request POST 'https://api.ttlock.com/v3/user/register' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'clientId=your id' \
--data-urlencode 'clientSecret=your secret' \
--data-urlencode 'username=lockuser' \
--data-urlencode 'password=your application users password md5 hashed' \
--data-urlencode 'date=1650909361599'
https://currentmillis.com - get the current date
echo "password" | md5 - md5 hash password
docker run \
-e CLIENTID='your id' \
-e CLIENTSECRET='your secret' \
-e LOCKID='your lock id' \
-e USER='your prefixed application user' \
-e PASSWORD='your application users password md5 hashed' \
-p 5000:5000 stevendodd/ttlock
rest:
- scan_interval: 60
resource: http://192.168.1.162:8125/123
sensor:
- name: "Front Door"
value_template: "OK"
json_attributes:
- "autoLockTime"
- "electricQuantity"
- "firmwareRevision"
- "hardwareRevision"
- "lockAlias"
- "modelNum"
- "passageMode"
- "passageModeAutoUnlock"
- "soundVolume"
- "tamperAlert"
- scan_interval: 5
resource_template: http://192.168.1.162:8125/123/users
sensor:
- name: "Front Door unlock name"
value_template: '{{ value_json.list[0].username }}'
- name: "Front Door unlock date"
value_template: '{{ (value_json.list[0].lockDate | int / 1000) | timestamp_custom("%a, %d %b %Y %H:%M") }}'
rest_command:
unlock_door:
url: "http://192.168.1.162:8125/123/unlock"
method: get
https://community.home-assistant.io/t/ttlock-integration-with-ha/211244/26
Content type
Image
Digest
sha256:551b57c8c…
Size
47.8 MB
Last updated
about 4 years ago
docker pull stevendodd/ttlock