FlagX/ha-ledvance-tuya-resync-localkey
关于
pyscript for homeassistant to resync local keys from private tuya api
系统与基础设施实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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
- A script
print-local-keys.pyto print out local keys for your Ledvance devices (They must be already registered in the Ledvance app), which can be used in the LocalTuya integration for Home Assistant - Setup via Pyscript Integration to automatically resync local keys
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
If you want to run the script non-interactively, set the environment variables
LEDVANCE_USERNAME and LEDVANCE_PASSWORD to your Ledvance account credentials.
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
- Pyscript Integration
- Set
allow_all_importsandhass_is_globalto true. (Described here) - Ledvance account with devices configured
Setup
- Replace placeholders in
pyscript\sync_tuya_keys.pywith your Ledvance account credentials. - Copy
pyscript_modulesandpyscriptto your Home Assistant config directory. - In your Home Assistant dashboard should now be under
Developer tools-->Servicesa service calledPyscript Python scripting: synctuyakeysthat 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/
探索相关项目
加载中…