this method for ttlock2mqtt
i managed this to work with ha and here what i did
first you need to register at this site : https://open.ttlock.com/login
then click on create application and fill application name , logo , type (choose whatever you want , i chosed them all) and description .
after you get the approval you will be having 1- client_id 2- client_secret (save them to text file for use later ) .
** important note : the user for this application you can view it on the same site , press on top right at your email beside managment , and there is you can see your user name (not email) and write it in the text file with previous info .
now open terminal and paste this to link account with the application
** please note you have to md5 encrypted your password , open this site https://www.md5online.org/md5-decrypt.html and put your password to decrypt
$ curl --location --request POST 'https://api.ttlock.com/v3/user/register?clientId=put here your client id&clientSecret=put here your client secret&username=put here the user name from the site not the email&password=put here the password md5 decrypted for account at site&date=CURRENTMILLIS' \
--header 'Content-Type: application/x-www-form-urlencoded' \
next step i assume you already have the app at the mobile working since before , so do this the following command at terminal to get the token
curl --location --request POST 'https://api.ttlock.com/oauth2/token?client_id=put here your client id&client_secret=put here your client secret&username=put here the user name from your account&password=put here your decrypted password&grant_type=password&redirect_uri=https://yourdomain.com/' \
--header 'Content-Type: application/x-www-form-urlencoded' \
if all goes successfully you will get token and refresh token and other info , save them all
add this to your repo add ons
tonyldo HassIO Addo-ns
[email protected]
install the TTlock2MQTT
at configuration fill the client ID and ttlock token and fill the mqtt data , server , port , mqtt user , mqtt password and start the addon
at Mosquitto broker you will get two devices , the lock and the gateway , enjoy
and many sorry if my english wasnt clear enough
** few references
https://www.md5online.org/md5-decrypt.html