FlagX / ha-ledvance-tuya-resync-localkey

pyscript for homeassistant to resync local keys from private tuya api
MIT License
108 stars 17 forks source link
home-assistant homeassistant iot ledvance localtuya tuya

ha-ledvance-tuya-resync-localkey

pyscript for homeassistant to resync local keys from private tuya API.

This also works for Sylvania devices by changing/uncommenting the keys in pyscript_modules/tuya/const.py.

This repository includes

To just print out your local keys...

First, create a Python 3 environment - version 3.10 is confirmed as working.

Then install the dependencies and run the script:

pip install -r requirements.txt
python print-local-keys.py

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 generated if you reset/re-register your devices).

Prerequisites

Setup

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/