I built a small tool to solve a problem I’ve run into a few times with local tuya integration.
Most local tuya integrations can fetch the local key during the initial setup. But if you factory reset a device and pair it again, the local key changes. Your device stops working in Home Assistant, and all you really need is the new local key.
To get the latest local key, you have to go through the Tuya IoT Developer Portal. This tool skips that completely.
Just enter your Smart Life or Tuya Smart User Code, then scan the generated QR code. That’s it. It will list all the devices in your account along with their Local Key , Device ID , Device Name and more. The login session is cached, so you don’t need to scan the QR code every time.
Could you let me know which CPU architecture your Home Assistant is running on? It looks like it is fetching the unknown/unknown build (multi-platform build manifest) instead of a platform-specific image. Right now it only supports amd64 and arm64.
Thanks for trying it out! glad to hear it is working well on HA Green device
I intentionally named the project tuya-local-key to keep its scope focused on retrieving the local key only. I may add a few small features in the future, like, support for a fixed username/password when running the container directly with Docker for users who are not using HAOS, since they can’t use it behind HA Ingress.
In the meantime, I’ll do my best to maintain the project for as long as Tuya/SmartLife doesn’t make any breaking changes
Update: I’ve just released 1.6 and 1.7 with the following changes:
Optional Web UI Authentication
Added optional basic username/password authentication. Set AUTH_USERNAME and AUTH_PASSWORD to enable it.
v1.7: Authentication only applies to direct port access and is automatically disabled when using Home Assistant Ingress.
This is recommended whenever the port is reachable beyond localhost. Basic Auth sends credentials unencrypted over plain HTTP, so still keep it on a trusted network or behind a TLS reverse proxy, and do not expose it directly to the internet. On Home Assistant, ingress already authenticates access, so these credentials are ignored for ingress requests. Set them only if you enable the direct port access and want a separate login there.
24-Hour Device List Caching
Cached the tuya device list for up to 24 hours to improve subsequent page load times and reduce number of requests to tuya backend.
If you need the latest devices, click the Refresh button on WebUI to fetch the newest list from tuya.
Home Assistant QR Code Configuration
Added a configuration option to choose between SmartLife and TuyaSmart QR code schemes. This is helpful if you have trouble logging in with different apps.