Skip to content

aniketgohelimp/ttlock-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ttlock-docker

A restful API for TT lock; handles access tokens and dates

Requires gateway and uses TT lock API

  1. Create an application here: https://open.ttlock.com/manager
    2) Register a user in the application - returns a prefixed user that you can add to your lock
curl --location -g --request POST 'https://euapi.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

  1. Add your new prefixed user to your lock in the TT lock app
    4) Download docker image: https://hub.docker.com/r/stevendodd/ttlock
    5) Create a Docker container
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
  1. Add the following sensor and rest command to configuration.yaml in home assistant

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"
rest_command:
  unlock_door:
    url: "http://192.168.1.162:8125/123/unlock"
    method: get

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 91.4%
  • Dockerfile 8.6%