Tuya Local & ID Key help

Hi Guys,
Which is the simplest method of finding your Local & ID key of your Tuya products pls.

Thanks

I have the same question. I canā€™t get it witch proxy server and tuya app :frowning:

1 Like

yup need the same help too. Please share if you figure out an easy method.

1 Like

I have a rooted android phone, which makes it pretty simple to do.

Otherwise, I wasnā€™t able to figure out how to do it from a PC/Mac/Pi.

1 Like

Hi Randy,
If I root my android phone, how does it work then ? How would you get the codes

Thanks

I put some instructions here

Slightly different version of instructions

Also look at post 3 of that thread.

EDIT: FYI, I recently added a couple outdoor plugs using my rooted phone, so I have found 7 keys using this method.

1 Like

Thanks :clap: Randy , appreciate it :pray:

@Vaughanza, I managed to get the ā€œlocalkeyā€ using linux. If a rooted Android device doesnā€™t work you can try my steps here: Tuya Garage Door Opener with sensors

Having struggled through the ā€œTuya - register as developerā€ method to get the keys, and made it (just about), I thought there must be an easier way for next time. Then to my surprise i found that this method from 2019 still works, and everything can be done within Windows:
2019 tuya local tutorial
and I was able to make this process much quicker by using MEmu (Google it) rather than Bluestacks.

The advantage of doing this is that MEmu comes already rooted, so no lengthy and complicated rooting process, just throw the ā€˜rootā€™ switch in MEmu configuration. Then follow the above HA tutorial to sideload an apk of the old version of SmartLife, and I also sideloaded a version of ES File Explorer of a similar vintage to be on the safe side. Following the first part of the tutorial as described, I was then easily able to access the Tuya Secrets file, containing all I wanted and more!

I recommend accessing devices once from the app first to make sure all tuya data is recorded in the file. As an added bonus, set up the network as ā€œbridgedā€ in MEmu config, then ES File Explorer provides an ftp portal to the host windows system. Copy the file in ES File Explorer to an accessible folder e.g. Downloads, from there grab it via ftp to Windows.

Now you can see all the secrets exposed, process them with MS tools to make the data more readable, and keep them somewhere safely for future reference. No doubt some of these other settings will come in handy as I start to work towards localtuya, with this respository looking like the best bet at the moment.
localtuya
But thatā€™s for another day, early experiments on a test bulb with this look promising, though.

1 Like

One other method, but I havenā€™t tried it

see post 599. An add on that is supposed to find get your keys.

Please note on this the file generated is unsecure and therefore Iā€™ll need to do some work to make sure, if you have your install exposed to the web it isnt allowing it to be accessed.

Update - rainy day so thought Iā€™d investigate Tuya Local further . Iā€™m no developer but have to say Iā€™m blown away with the progress that has already been made. My interest here is for Tuya bulbs. When I ā€˜discoveredā€™ HA - with many thanks to IFTTT for their stupid commercial move! - and realised this is so much better - it was already too late to rescue any of my Tuya smart bulbs. Whereas Iā€™ve fortunately been able to Tasmotize or Tuya-convert all of my sockets and switches. Sadly neither route possible for the bulbs, after extensive on-line research and dismantling them to have a look inside.

Following guidance and using the obtained local keys I was easily able to connect my bulbs on a VirtualBox test rig to Tuya Local using the yaml method. Tried the other method but it is not so clear to a non-programmer what values are needed. The yaml examples for a light more or less work as given, however.

At the time of writing, the area for further development appears to be the ability to enforce a separation from the internet. While the bulbs worked as expected in Tuya Local with access to the internet, like many others in the development threads I found that they gradually stopped working after about 30 mins or so enforced separation. I tried various firewall rules and redirecting DNS to a non-existent server, nothing worked for very long. I also tried a physical separation, putting everything up on an old router and just pulling the internet plug after connections were established. No dice. Seems likely the Tuya firmware instructs the devices to phone home at regular intervals and refuse to work if a reply is not forthcoming within a reasonable time.

Clearly, spoofing of Tuya bulbs into thinking they are still connected is an important goal. Just think - what if ESP versions can be brainwashed into flashing the older, more ā€œHA usefulā€, Tuya firmware? Or, that making bulbs think they are online when they are not could somehow be a gateway to getting tuya-convert up and running again. Well I can dream, canā€™t I? For the moment until the issues are ironed out as I am sure they will be, Iā€™m not going any further with tuya local. But great effort so far and Iā€™ll be watching with interest.