Skip to content

pyscript for homeassistant to resync local keys from private tuya api

License

Notifications You must be signed in to change notification settings

Salamandar/ha-ledvance-tuya-resync-localkey

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ha-ledvance-tuya-resync-localkey

pyscript for homeassistant to resync local keys from private tuya api

This repository includes

To just print out your local keys...

Replace the placeholders in print-local-keys.py and run the script:

pip install pycryptodome
python print-local-keys.py

(Python 3)

How to resync local keys automatically (via service)

If you have many devices and reset them sometimes by accident like me, you can create a service for resyncing the local keys. (New local keys are genereated if you reset/re-register your devices).

Prerequisites

  • Pyscript Integration
  • Set allow_all_imports and hass_is_global to true. (Described here)
  • Ledvance account with devices configured

Setup

  • Replace placeholders in pyscript\sync_tuya_keys.py with your Ledvance account credentials.
  • Copy pyscript_modules and pyscript to your Home Assistant config directory.
  • In your Home Assistant dashboard should be now under Developer tools --> Services a service called Pyscript Python scripting: synctuyakeys that you can call. (You may have to restart before)
  • (If you want Log output, you need to change the log level to INFO or use jupyter)

Credits

Credits for the python Tuya API client go to: https://github.com/rgsilva/homeassistant-positivo I also extracted the keys/secrets by following his guide: https://blog.rgsilva.com/reverse-engineering-positivos-smart-home-app/

About

pyscript for homeassistant to resync local keys from private tuya api

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%