For anyone interested like my when my tuya iot sub ended and can not get local key from website it still works! (make sure you have compatible version of bluestack and bstweaker) Nice guide and good work. You helped me a lot! Thank you
@@supperka2 A bit late, but today i used the latest version of bstweaker 6.9.2 and bluestacks version 5.1.110. Make sure to disable Hyper-V and Core Isolation otherwise the installation fails. Furthermore you have to start bstweaker as administrator. Without admin rights I were not able to see the files bluestacks files within bstweaker. But i experienced keys that were not extracted correct by Marks tool, cause they are not only numbers anymore. The include special characters like ":". So if you see very short keys or have keys which are not working, open the extracted file with a text editor and search for the device id. Not much behind you will find the localkey. You have to copy everything from the beginning, which was recognized from Marks tool until the next ""e;" For example: "localKey":"'7:ABCDEF|GXYZ" The key is: '7:ABCDEF|GXYZ
I've been meaning to add a comment to this but haven't had the time so here it. I want to thank you for this tutorial because it managed to help me get my devices into my installation of home assistant but to start I have to admit that I wasn't going to use it because I didn't want to use the Smart Life app and basically delete all my hard work under the tuya app. I managed to find a version 3.6 of the tuya app that allowed for the same method to be used to get the keys and all the devices are working great now except for cameras, haven't figured that one out yet. I do have to say there was some finagling I had to do because sometimes the keys didn't work and had to re-add the device multiple times until I got a key that worked properly but I managed to get everything into my home assistant setup and for that I have to thank you. Keep up the good work
Woohoo just got my local keys with this method.Very clear & easy to follow instructions, thanks Mark! After the Tuya outage issue recently, I had to physically switch off my lights, which simply won’t do! Also used your C# Tuya key extractor app and it worked a treat! Terrific content!
You sir, are a champion. After setting up home assistant about 12 months ago and not adding anything to it, and getting a few new items recently and not being able to use the tuya developer site, this saved lots of frustration. Cheers!
After two days of working on it and repeatedly watching your video/s, I finally managed to integrate my plugs.....phewwww, i was already so much annoyed that I was almost ready to return them. Thanks a lot for this video, and the previous one. I've shared this video on my post on Tuya integration on Home Assistant FB group. 100 likes to you Mark.!
Hi Mark, I just wanted to say thank you for this totorial. I had all but given up on LocalTuya; after following your instructions I now have a working light fixture. Only 27 more to add.. cheers!
This is a game changer for me, finally I'm taking out of the cloud my smartlife dehumidifier, and dropping inconsistencies in the method I've been using. Thank you.
@@MarkWattTech yeah, that's for a fan speed like low/medium/high, but what about the actual input of the desired humidity? Can I write you on facebook/twitter for further discussions?
BSTweaker didn't seem to work anymore on the recent version of BlueStacks (I had 5.12 using Pie64 - on a HyperV-enabled PC) so I had to improvise to get the XML. The virtual android is stored in C:\ProgramData as a virtual disk in VHDX format. After copying this VHDX to another folder, and converting it to VHD (using PowerShell), 7-Zip let me open it as an archive, and then you can extract the XML with the local keys from there. I did give up on LocalTuya though. Most of my smart devices are connected through a Tuya Zigbee gateway, which is not (yet) supported in the LocalTuya app.
Spot on - I instantly refer back to this video as like any good old skool techie - I never write things down so always forget the path where the prefs file is located.
ATTENTION: July 2021 and it still works, but if you had bought a new Tuya Device recently and if you have added that to your smartlife app already then be aware that ALL NEW devices are listed on THE TOP of that XML preferences file and NOT at the bottom as usual and you might have expected. It will be the first local key you will find I was pretty astonished cause I had already 4 and then had added number 5 and 6 when I wanted to add those 2 afterwards and had to install the whole android phone emulator again to get that file. I found that preferences file again and when I tried to get into it again 2 months later I also stumbled a bit when my first impression was "far too short", nothing in this file any more, but I had forgotten the most important part for all manuals local key seekers: If you use notepad plus or npp then it is also beneficial to activate the option of showing line feed which should be found unter notepad plus menu VIEW and then at the end of the first third as "automatic clrf or line feed". Helps a lot to find the key and see the context next to it. With that I managed to find those local keys and went for the 5th appearance assuming that this should be my new one. Good idea but somehow I remembered that in the following segments the Smartlife App plug Name should be mentioned and there I found an old one. I went on to the 6th occurence of such local key and again a plug I knew for a long time. So I went on with my search which then began from the top again and there I found my new plug. So : if you add plugs and search for the local key in that global preferences file then pick the first hit as your new plug.
Thankyou very much. This all worked well. My tuya oit account does not work so this was the answer. Your program key extractor worked well on my Alienware computer. Good Teacher.
i created a tuya IoT account in 2023. i could locate my key via tuya under 'device management' then 'query device details'. entered device ID and it returned in the json response perfectly. thanks for this video also. saving it for when they kick me off the internet haha
Great video. I was about to pull my hair out trying to get the local keys for my Tuya devices - Thank you! One note - your app did not work on my Windows 11 install. What I did instead was copied the ugly XML into an online XML entity decoder to pretty it up. Then I opened the decoded XML into Visual Code editor to get a pretty view - though not nearly as concise as your program's output. Thanks again, cheers!
Thanks for a clear and concise video. I had previous;y spent days trying via the Tuya IOT method but failed because of the frequent changes Tuya make to their web pages. This method worked 100% first time, outstanding ! I only have one question, the most important requirements for monitoring devices is power consumption and energy used. The local Tuya provides power (W) but not energy (Wh). It is available on the Smart Life app on my phone, how do I access energy used within HA?
had to twiddle a bit to get it to work, as my account was not working, as I used the tuya-smart-app. But I only have 2 tuya lights, so i set up a new account with the APK on my phone. Then i followed your tutorial and got the keys without any problems.
Got all 6 of my local keys using your method. :-) Spent about 6 hours total but ended up with one lamp going off-line and the others only responding to on/off, no brightness or color temperature control. Anyway, I'll call it a day, get out the soldering iron and pursue the ESP32 / Tasmota path.
Ah what a pain! It's a shame Tuya Convert doesn't work on new products. If you can save a few quid and get them onto ESPHome and Tasmota then 100% do it :)
@@MarkWattTech Got the first downlight done by swapping the Tuya module for an ESP32-C3 running Tasmota. Brightness control is much better than Tuya original, especially on low settings. CT control same as before. 🙂
Hello! Thank you fornthe tutorial. I have managed to add some devices but some of them in the smart life app in bluestacks says bluetooth is off and are not working. And Incan not extract the key. Any ideas ?
Hey Mark, great work, I'm going to make a video about it in danish, and with some extras to it of course, I wouldn't recommend the bluestacks any more, but NOXPlayer works fine. One extra twist to your script would be to show the local IP or MAC address, I also went with tuya-local instead of localtuya, that automagically recognized all my devices 😲
This saves a lot of effort with faffing with the Tuya API nonsense, which even as a professional sw engineer who deals with APIs all day every day I find utterly perplexing - anybody would think they're trying to make their UI hard to navigate, on purpose. Still definitely works with BlueStacks though watch the tweaker version support and grab an older version.
I think you are currently stuck with the cloud for this one. Even in the new Tuya v2 integration created by Tuya they aren't supporting IR devices : You can use scenes to control the IR devices (But you are tied to the cloud)
#Mark Watt Tech I have thermostatic GTZ04. This device use tuya gateway to connect to Smart Life or Tuya app. How I can get local key to configure it to local tuya in HA? When I use your tutorial my xml file show only Tuya Gateway. Can you help me?
Thanks for the video and console app. Your extractor worked almost flawlessly for me once dotnet was installed. I tried the csv and txt generator. Got success message, but do not know where file ends up after being generated. Such great work. Cheers!
@@mrguitare wicked was going to say it will just generate where you run the Extractor from :) Can always add an option to set a file path for export if you want? It was really just designed to be a quick and disposable tool so most people will bin it when done. Cheers.
@@MarkWattTech you could just add message "CSV successfully generated in Extractor file". For future users, it could save the hassle of having to find it.
Hi, After almost all the process I'm stuck in the bluestacks tweaker as it's not showing any file in the data/ folder. Do you have any recommendation to move on with this? thank you
I've had a fight with Tuya local - using the website - The Android copy is the best solution I found - I love the idea of your extractor tool. I'm now fighting with devices, If it isn't simple is doesn't seem to work! - I think it's to do with additional parameters held in the XML - Have you thought of expanding your extraction tool and working with the tuya-local developer?
Hey Martyn. Thanks for the feedback. I did think about adding Api calls etc to the tool and fleshing it out. Another thing I thought of was maybe having an option to export directly to YAML or even just spit out optional Data Point information the help with the local setup. It really depends if enough people are interested to be honest. I should have put a download counter on the tool to gauge how many people had used it. I may just add a post to see if people have used it, and if they wanted any extra things etc. I personally just saw it as a disposable thing. People would use it to get the keys, and then be done with it. Feel free to shoot me any ideas or anything you would like. Cheers
I posted on your other LocalTuya video. This one helped me and now I have my tuya devices integrated to HomeAssistant. Thank you. Also, what about notifications in AppleTV? Thanks. ;-)
I love the idea. However, the info is outdated and I could not find a mtching Bluestacks version (there's 4, 5 and 10) with a BSTweaker). Most BSTweakers seem to be gone, could not find a download that would work with any BlueStacks version, tried 4 and 5)
Thanks for the great tutorial😀 I experienced that devices have to be added to the Smart Life app (not the Tuya app) before they are detected in the Smart Life app in BlueStacks. After adding the devices in Smart Life app the devices previously set up in Tuya app are gone. However the devices and settings of the devices are recovered through the device ID.
Question: I need absolutly a Tuya Zigbee HUB to intregreate the devices in the Cloud to create the data, right!? I User a Sonoff Dongle and have no HUB from tuya, thats my Problem...
Thank You Mark, This process has served me well for quite some time but it looks like they have changed the key format to now include symbols. I just added a device and it contains symbols : . > / but looking at the preferences file some symbols use HTML formating, for example the > is > in the config file. Replacing this with the correct > and adding to home assistant works fine. Thought I would let you know incase you had a chance to update your project :)
For my understanding, if I manage to get the local keys(that I already did) and using them in loclatuya, am I completely free from dependences from tuya in change they change access or whatever? I guess the whole thing with localtuya is working without any of their cloud services, so the local key will work forever right?
Thanks for your work. Everything works if you follow the program versions. But there is a question. I have 8 devices, 3 of them have a key (gateway and 2 Wi-Fi lights, and in the rest the Local_key field is empty. What could be the problem. Are they not supported? If so, then tell me how to manage the devices locally. Thank you.
It seems that the Btweaker does not allow access to the file manager on the latest version of Bstack - I tryied to find a V4 as in the video, but didnt find any. Tried BStack 5.0 & 5.9, but the /data subdirectory ( and all others) are empties from Btweak perspective. Wonder if anyone had seen this
Nevermind - The appropriate BStack versions are on their site - Need to dig a bit. Use the same version as in the videos for both Tweaker and Stack, otherwise it does not work.
I've been running my local tuya devices for over a year now, thanks to you. I was wondering, am I able to delete devices from my Smart Life app now that they're imported locally into my HA instance? Or do I need to maintain them.
It’s totally up to you :) There’s no harm keeping them. I would personally keep them in the app. Should they fall off your local setup or become unresponsive etc, you will have to repair them to tuya again to repeat the process. Also if you delete them and there not fully locked down on your network, they will wipe there local key (so make sure it is locked down if you do delete them).
Excellent video Mark, the older video didn't work, you promised a new one and here it is. Works perfectly. I just have one question, for some reason the localTuay doesn't detect any of my switches even though they connected and being recognized in HA. Any idea how to solve that? Thanks again.
@@TheLiorNt are you able to share some more info on my FB group? I can further help troubleshoot then with images etc and can also direct people with similar issues at that post then :) Im a little behind this week on comments and posts but will try and get round to it.
@@stevengriffin4027 Just fixed it, I removed the entity from my HA and I discovered it again. Once its done the localTuya recognized the switch. Try that
Hi Mark, Nice video! I wasn't able to run that bluestacks from linux in an emulator: it requires virtualization instructions, I tried MEmu the same. Finally I managed to run that app flawlessly in my LineageOS phone and get that file with adb. Thanks for the trick!
I know this is a somewhat older video. However, after downloading the smart life app (3.6.1) on my rooted tablet, the application wasn't under (root)/data/data. Only in (Internal storage)/Android/data/. However this doesn't have any preferences_global_key file. Not even an xml file. Then I looked a bit further, I found that I have an com.tuya.smartlife folder under (root)/data/app/. Unfortunately, this only has lib files. Is there something I'm doing wrong here? Thanks in advance!
Thanks worked for me although I couldn't get it to work with the latest version of bluestacks as bstweaker couldn't see the files. Downloaded Bluestacks 4.2 and it worked flawlessly.
Hi Mark, Nice work of creating all these video. Very clear. Easy to follow.... but if Tuya keeps changing functionality all your work hard work is in vane. I have written to Tuya asking for an official way to obtain needed local key. If this functionality is not available anymore I, and many others will, look for alternative product. If these new version of products cannot be flashed, cannot be used with 'local Tuya' I am not interested in buying them. Will returns that I have purchased and cannot use. If and when Tuya will make available again this functionality we will consider them again. Last I looked Home Assistant had 45000 users.
Hey Carlo. Since creating these videos Tuya have changed things up a few times. I don’t think they are planning on getting rid of the local stuff as they wouldn’t want to alienate and loose people. But they could one day decide to.
Hi Mark, i downloaded the old apk but the smartlife app asks me to turn on bluetooth in bluestacks. Since this seems not supported i ignored it and the xml file doesnt contain any localKey entries. Is there a way around?
Sorry Mark - a great video and you are a VERY clever guy, but I was unable to access the Android files in the Tweaker App. The right-hand side was just blank - no files showing. I did and everything search of the files and still nothing! Any ideas?
I logged in on the Tuya App but no devices are showing. All the credentials worked to get me in but no devices are showing at all? Am I doing anything wrong. I used the exact versions you mentioned
Thanks for the great video. The challenge I find in getting it going it working out the pin numbers. Whilst most devices seem to follow standard patterns, every now and then I find a few devices that don't quite work. I tend to use to YAML as the localtuya config continuously failed after I selected the device/ip address. Is there a way of determining the values for the pins etc.?
Cameras are a no. You would need to check some of the other devices against the Local Tuya Git. Also worth noting some supported devices can be picked up, and you can fiddle about and setup the individual entities as sensors and switches etc. Doing this I have been able to add in and control unsupported diffusers and a robot vacuum.
Hello. I'm sorry to write on an old video, but I have a garage door opener brand DASPI. They use a customized smart life app for their products. But the only version available is based on new version and preferences XML are empty. Is there any way with new versions to extract the local keys? I cannot use IoT because my account used to register this product is not working. I think they use they own tuya server. Thank you for reading.
Heya. In newer versions this method is blocked and the data is no longer written into the xml file (which will be why it’s empty). The simplest option will be to just use the dev tools on the Tuya Cloud to find out what your local key is.
@@MarkWattTech I had a custom app for my product that wasn't able to add it to the tuya IoT cloud project. I was able to use the product with the SmartLife app and after that I could get the keys from the IoT platform. Thank you for your time 🤗
Tried starting the extractor tool but it immediately closes. Am i missing some dependencies? On Win 11 atm. regards! i did install .NET 7 (x86) and also put the hostfxr.dll into the folder where the tool resides in, to no avail.
Is there a way to do this without the Bluestacks software? This won't install the old version of the app as my PC apparently doesn't support Virtualization
Hi Mark thanks. However, after installing Bluestacks and SmartLife from your links, when I open the BSTWEAKER nothing appears on the right side on the file manager, (in /data). Any help?
Thanks for the video. However, this doesn't work for me. I have followed all your process step by step buy in the file i transferred to my desktop I couldn't find my local-key. I do run couples of smart socket and strip light, am not sure if this are not supported or what might be the reason. Thanks
I've just added more sensors and went to grab the keys. The extraction tool only gave me a 5 character key for one device. The 6th character of that key was a comma so I think the extractor tool omits everything after the comma. Not a show stopper as I found the key manually in the xml. Just a note in case anyone else has this issue and is puzzled why one key is shorter than the rest.
Any suggestions, I have gotten to the point of opening the file manager and accessing my preferences_global_keyaz1542 file but unable to copy to desktop. For some reason it won't let me copy
Does this version also use phone number sign in? In newer i login with mail, and i tryed 3.4.1 which said at login via number, my country is not supported.
Outstanding content thanks. Took ages to work through various issues but got the keys extracted. Question though - is there anything stopping Tuya pushing a f/w update to my devices and thus replacing the local keys? Is it safe to disconnect the devices from Tuya cloud? Next step is to try and get local Tuya installed and working...
Some Tuya devices require a manual operation to get a fw update and others are automatic. If you block the device connections it will stop this. But in theory they could update the devices yes. There is a small bit of info on the Local Tuya Git about blocking your devices. Once disconnected from the external network you should be fine to remove from Tuya. But if you need to change the device (get a new router etc) you would need to repeat the process. Cheers. Mark
Great, I will try using the Android emulator on my Linux box. On that the file might be available immediately. I was thinking I could batch-edit the xml or your output into a YAML that I could paste into the LocalTuya system somewhere? That would be faster than manually entering the keys via the form.
I haven’t looked into it yet, but I had the same idea with outputting them as YAML. The manual process of adding each Device via the Local Tuya integration is very slow and cumbersome. Especially if you make a mistake.
Thanks for the Tutorial but just gonna let you know my Local Key included characters you might be using to assume the key has stopped, and so myprinted version had part of my key cut off, took me a while to figure that might have been happening and i just copied what was included between the " ", just in case it helps, my key included characters like : ; / ( + ? although it cut off at the : as in it didnt include that or anything after it.
ATTENTION: in case of you get this 'Failed to authenticate with device. Verify that device id and local key are correct.' while adding new plugs or switches via the add function inside local tuya there is a simple reason for that You had chosen protocol 3.3 but the plug itself is still running on 3.1 Authenticate did not work out due to the wrong protocol and not due to false device ID or local key ! It is not that obvious and the error message should be more specific like "wrong protocol" instead of hinting to a wrong direction cause it took quite some time to get behind that issue. Unfortunatelly I could not upgrade the plug to a newer version and have to stay on the protocol 3.1 which is not bad , but becomes a night mare if you have different generations of plugs and switches cause then you need to documentate every detail like protocol.
Hi Mark, your videos are great and I'm getting a lot of things done through your videos... Thank you very much. I have a question! Sorry about my English. I got my tuya keys, but I have a device that has three switches and after completing the procedure the HA only shows one switch. How can I find others?
It will work with the Tuya app yeah :) again it will have to be an old version. However, the Tuya app has started locking down old version logins so im not 100% sure if it will now work.
Hi, Great video and tips thanks . I've got to the part with tweaker and clicked on the FileManager > /data but nothing appears in /data. Checked I'm on the root C drive also tried the desktop path. I did install bluestacks 5. Is this why it is not working? Perhaps I need Bluestacks 4? Thanks
don't close bluestacks, just minimise it. before clicking "file Manager" to the left you should see bluestacks is still running ( have a stop button ) and a green link icon - not red.
is this method working? I followed all the steps (with the smart life 3.6.1 app) and the app is asking me to turn off Bluetooth. The devices are offline until I do so but bluestacks doesn't have bluetooth
All my Tuya devices have now migrated to Local Tuya Integration thanks to your help. Many thanks! Now what is the best way to get rid of the Tuya cloud devices and entities in HA? I tried deleting and empying data of devices from Smart Things App, and this cut communication with local tuya. Should I just delete Cloud integration from HA?
What was wrong when you tried to do it? IOT platform is much quicker and easier to do. This video was primarily for people that had issues using it. Also if you haven't seen, Tuya are working on Local Control as part of the new Tuya v2 integration :)
Too bad this doesnt work with the Tuya Smart app :( I went through the entire setup before I realized I dont use the app :( I STILL APPRECIATE THE EFFORT :))
For anyone interested like my when my tuya iot sub ended and can not get local key from website it still works! (make sure you have compatible version of bluestack and bstweaker)
Nice guide and good work. You helped me a lot! Thank you
Hello , can you tell ,me what version works? please
@@supperka2 A bit late, but today i used the latest version of bstweaker 6.9.2 and bluestacks version 5.1.110. Make sure to disable Hyper-V and Core Isolation otherwise the installation fails. Furthermore you have to start bstweaker as administrator. Without admin rights I were not able to see the files bluestacks files within bstweaker.
But i experienced keys that were not extracted correct by Marks tool, cause they are not only numbers anymore. The include special characters like ":". So if you see very short keys or have keys which are not working, open the extracted file with a text editor and search for the device id. Not much behind you will find the localkey. You have to copy everything from the beginning, which was recognized from Marks tool until the next ""e;"
For example:
"localKey":"'7:ABCDEF|GXYZ"
The key is: '7:ABCDEF|GXYZ
I've been meaning to add a comment to this but haven't had the time so here it. I want to thank you for this tutorial because it managed to help me get my devices into my installation of home assistant but to start I have to admit that I wasn't going to use it because I didn't want to use the Smart Life app and basically delete all my hard work under the tuya app. I managed to find a version 3.6 of the tuya app that allowed for the same method to be used to get the keys and all the devices are working great now except for cameras, haven't figured that one out yet. I do have to say there was some finagling I had to do because sometimes the keys didn't work and had to re-add the device multiple times until I got a key that worked properly but I managed to get everything into my home assistant setup and for that I have to thank you. Keep up the good work
tried tuya 3.6.0 but it the global key was invalid. which version did you used?
3.6.0, I will say that the last time I added anything was back in November but everything seems to be working
@@dannieboiz Could you even login in to the app? I'm getting incorrect account ID/password
One of the best home assistant channel on RUclips. Thank you!
Appreciate that 🙏
Woohoo just got my local keys with this method.Very clear & easy to follow instructions, thanks Mark! After the Tuya outage issue recently, I had to physically switch off my lights, which simply won’t do! Also used your C# Tuya key extractor app and it worked a treat! Terrific content!
You sir, are a champion. After setting up home assistant about 12 months ago and not adding anything to it, and getting a few new items recently and not being able to use the tuya developer site, this saved lots of frustration. Cheers!
After two days of working on it and repeatedly watching your video/s, I finally managed to integrate my plugs.....phewwww, i was already so much annoyed that I was almost ready to return them. Thanks a lot for this video, and the previous one.
I've shared this video on my post on Tuya integration on Home Assistant FB group.
100 likes to you Mark.!
Thank you Nikesh! Glad you got there in the end :)
Hi Mark, I just wanted to say thank you for this totorial. I had all but given up on LocalTuya; after following your instructions I now have a working light fixture. Only 27 more to add.. cheers!
This is a game changer for me, finally I'm taking out of the cloud my smartlife dehumidifier, and dropping inconsistencies in the method I've been using. Thank you.
Glad to help!
@@MarkWattTech Still have to get some way to send a number input to the dehumidifier through localtuya integration. I've barely scratched the surface.
@@darksider4all I used a fan control (which could go 1-3) and this worked for me. Not ideal
But it works 🥴
@@MarkWattTech yeah, that's for a fan speed like low/medium/high, but what about the actual input of the desired humidity? Can I write you on facebook/twitter for further discussions?
@@darksider4all feel free to post in my Facebook group etc :)
FB Group : facebook.com/groups/2963936147172102
BSTweaker didn't seem to work anymore on the recent version of BlueStacks (I had 5.12 using Pie64 - on a HyperV-enabled PC) so I had to improvise to get the XML.
The virtual android is stored in C:\ProgramData as a virtual disk in VHDX format. After copying this VHDX to another folder, and converting it to VHD (using PowerShell), 7-Zip let me open it as an archive, and then you can extract the XML with the local keys from there.
I did give up on LocalTuya though. Most of my smart devices are connected through a Tuya Zigbee gateway, which is not (yet) supported in the LocalTuya app.
This method works. Also, 7Zip (at least in my case) can open VHDX directly so you don't need Hyper-V enabled PC.
I liked it 78 times because I have a lot of devices. Congratulations!
Glad you liked it :D
Spot on - I instantly refer back to this video as like any good old skool techie - I never write things down so always forget the path where the prefs file is located.
I do the same with my own videos 🤣
Does anyone know if this setup still works? I would also like to add that I will stay away from tuya wifi products from now on.
Still work when you follow the instructions ( same Bluestack version ) as the video. I found back my localkeys. Thanks
ATTENTION: July 2021 and it still works, but if you had bought a new Tuya Device recently and if you have added that to your smartlife app already then be aware that ALL NEW devices are listed on THE TOP of that XML preferences file and NOT at the bottom as usual and you might have expected. It will be the first local key you will find
I was pretty astonished cause I had already 4 and then had added number 5 and 6 when I wanted to add those 2 afterwards and had to install the whole android phone emulator again to get that file.
I found that preferences file again and when I tried to get into it again 2 months later I also stumbled a bit when my first impression was "far too short", nothing in this file any more, but I had forgotten the most important part for all manuals local key seekers:
If you use notepad plus or npp then it is also beneficial to activate the option of showing line feed which should be found unter notepad plus menu VIEW and then at the end of the first third as "automatic clrf or line feed".
Helps a lot to find the key and see the context next to it.
With that I managed to find those local keys and went for the 5th appearance assuming that this should be my new one.
Good idea but somehow I remembered that in the following segments the Smartlife App plug Name should be mentioned and there I found an old one. I went on to the 6th occurence of such local key and again a plug I knew for a long time. So I went on with my search which then began from the top again and there I found my new plug.
So : if you add plugs and search for the local key in that global preferences file then pick the first hit as your new plug.
Thankyou very much. This all worked well. My tuya oit account does not work so this was the answer. Your program key extractor worked well on my Alienware computer. Good Teacher.
i created a tuya IoT account in 2023.
i could locate my key via tuya under 'device management' then 'query device details'. entered device ID and it returned in the json response perfectly.
thanks for this video also. saving it for when they kick me off the internet haha
I cant find device management....
Thank you! Perfect explanation and the key extractor is awesome!
Thank you :) Glad you found the extractor helpful too!
Congratulations! Great work! Everything worked as it should... Thank you very much!
Love this method, way better than the previous dev website method
Glad you found it useful :)
Thanks a lot. This was wery helpful. Great work!
Great video. I was about to pull my hair out trying to get the local keys for my Tuya devices - Thank you! One note - your app did not work on my Windows 11 install. What I did instead was copied the ugly XML into an online XML entity decoder to pretty it up. Then I opened the decoded XML into Visual Code editor to get a pretty view - though not nearly as concise as your program's output. Thanks again, cheers!
Did you check .net core runtime is installed? Its needed to run.
Glad you got your keys though 😁
Thanks for a clear and concise video. I had previous;y spent days trying via the Tuya IOT method but failed because of the frequent changes Tuya make to their web pages. This method worked 100% first time, outstanding !
I only have one question, the most important requirements for monitoring devices is power consumption and energy used. The local Tuya provides power (W) but not energy (Wh). It is available on the Smart Life app on my phone, how do I access energy used within HA?
had to twiddle a bit to get it to work, as my account was not working, as I used the tuya-smart-app. But I only have 2 tuya lights, so i set up a new account with the APK on my phone. Then i followed your tutorial and got the keys without any problems.
Got all 6 of my local keys using your method. :-) Spent about 6 hours total but ended up with one lamp going off-line and the others only responding to on/off, no brightness or color temperature control.
Anyway, I'll call it a day, get out the soldering iron and pursue the ESP32 / Tasmota path.
Ah what a pain! It's a shame Tuya Convert doesn't work on new products. If you can save a few quid and get them onto ESPHome and Tasmota then 100% do it :)
@@MarkWattTech Got the first downlight done by swapping the Tuya module for an ESP32-C3 running Tasmota. Brightness control is much better than Tuya original, especially on low settings. CT control same as before. 🙂
Interface of developer Web changed a bit and the API is now called IOT Core. But it worked fine !! Thanks
Hello! Thank you fornthe tutorial. I have managed to add some devices but some of them in the smart life app in bluestacks says bluetooth is off and are not working. And Incan not extract the key. Any ideas ?
I have the same issue, have you found a solution ?
@@janot928 hello try in a few days again, use a smartlife new account and you will get the keys after some tries.
Hey Mark, great work, I'm going to make a video about it in danish, and with some extras to it of course, I wouldn't recommend the bluestacks any more, but NOXPlayer works fine. One extra twist to your script would be to show the local IP or MAC address, I also went with tuya-local instead of localtuya, that automagically recognized all my devices 😲
The Extractor works for me, thanks for a great video.
This saves a lot of effort with faffing with the Tuya API nonsense, which even as a professional sw engineer who deals with APIs all day every day I find utterly perplexing - anybody would think they're trying to make their UI hard to navigate, on purpose. Still definitely works with BlueStacks though watch the tweaker version support and grab an older version.
Their UI design is ridiculous. Menus for menus in menus that take you to another menu thats named something that it isn’t 😆😂🤯
Mark I have a Tuya WiFi IR blaster... the little hockey puck one. Is it possible to use this on LocalTuya, or am I stuck with the cloud service?
I think you are currently stuck with the cloud for this one. Even in the new Tuya v2 integration created by Tuya they aren't supporting IR devices :
You can use scenes to control the IR devices (But you are tied to the cloud)
#Mark Watt Tech
I have thermostatic GTZ04. This device use tuya gateway to connect to Smart Life or Tuya app. How I can get local key to configure it to local tuya in HA?
When I use your tutorial my xml file show only Tuya Gateway.
Can you help me?
Thanks for the video and console app. Your extractor worked almost flawlessly for me once dotnet was installed. I tried the csv and txt generator. Got success message, but do not know where file ends up after being generated. Such great work. Cheers!
oups! Found the file in Tuya Key extractor folder.
@@mrguitare wicked was going to say it will just generate where you run the Extractor from :)
Can always add an option to set a file path for export if you want?
It was really just designed to be a quick and disposable tool so most people will bin it when done.
Cheers.
@@MarkWattTech you could just add message "CSV successfully generated in Extractor file". For future users, it could save the hassle of having to find it.
@@mrguitare I will add it in when I get a sec 😁
Working great mate! Awesome videoes!!!!
Hi,
After almost all the process I'm stuck in the bluestacks tweaker as it's not showing any file in the data/ folder.
Do you have any recommendation to move on with this?
thank you
u may installed a version which is to new for the bstweaker
Thanx very much Mark, i got my local keys !
I've had a fight with Tuya local - using the website - The Android copy is the best solution I found - I love the idea of your extractor tool. I'm now fighting with devices, If it isn't simple is doesn't seem to work! - I think it's to do with additional parameters held in the XML - Have you thought of expanding your extraction tool and working with the tuya-local developer?
Hey Martyn. Thanks for the feedback. I did think about adding Api calls etc to the tool and fleshing it out. Another thing I thought of was maybe having an option to export directly to YAML or even just spit out optional Data Point information the help with the local setup.
It really depends if enough people are interested to be honest. I should have put a download counter on the tool to gauge how many people had used it. I may just add a post to see if people have used it, and if they wanted any extra things etc.
I personally just saw it as a disposable thing. People would use it to get the keys, and then be done with it. Feel free to shoot me any ideas or anything you would like. Cheers
@@MarkWattTech Very Rude of me - Really good video too (Saw the possibilities and got excited :-))
@@MartynSmith not at all :D
I wanted interaction and input from the viewers :)
I posted on your other LocalTuya video. This one helped me and now I have my tuya devices integrated to HomeAssistant. Thank you.
Also, what about notifications in AppleTV?
Thanks. ;-)
I love the idea.
However, the info is outdated and I could not find a mtching Bluestacks version (there's 4, 5 and 10) with a BSTweaker). Most BSTweakers seem to be gone, could not find a download that would work with any BlueStacks version, tried 4 and 5)
Thanks for the great tutorial😀
I experienced that devices have to be added to the Smart Life app (not the Tuya app) before they are detected in the Smart Life app in BlueStacks. After adding the devices in Smart Life app the devices previously set up in Tuya app are gone. However the devices and settings of the devices are recovered through the device ID.
The SmartLife app does not list any of my Tuya devices. I've got 9 devices. Shouldn't they be listed? I can see them in the Tuya app but not this one.
Question: I need absolutly a Tuya Zigbee HUB to intregreate the devices in the Cloud to create the data, right!? I User a Sonoff Dongle and have no HUB from tuya, thats my Problem...
Nice a lot easier then the developer account
bam! works like magic! Thanks much for this video, saved me tons of time
Wicked. Glad it helped :D
Thank You Mark, This process has served me well for quite some time but it looks like they have changed the key format to now include symbols. I just added a device and it contains symbols : . > / but looking at the preferences file some symbols use HTML formating, for example the > is > in the config file. Replacing this with the correct > and adding to home assistant works fine. Thought I would let you know incase you had a chance to update your project :)
For my understanding, if I manage to get the local keys(that I already did) and using them in loclatuya, am I completely free from dependences from tuya in change they change access or whatever? I guess the whole thing with localtuya is working without any of their cloud services, so the local key will work forever right?
Hello Mark, the Tuya Developer Web setup in your previous video dont work for me.
But ! This works perfectly for me ! Huge thanks !
Awesome glad you got it working :D
Thanks for your work. Everything works if you follow the program versions. But there is a question. I have 8 devices, 3 of them have a key (gateway and 2 Wi-Fi lights, and in the rest the Local_key field is empty. What could be the problem. Are they not supported? If so, then tell me how to manage the devices locally. Thank you.
It seems that the Btweaker does not allow access to the file manager on the latest version of Bstack - I tryied to find a V4 as in the video, but didnt find any. Tried BStack 5.0 & 5.9, but the /data subdirectory ( and all others) are empties from Btweak perspective. Wonder if anyone had seen this
Nevermind - The appropriate BStack versions are on their site - Need to dig a bit. Use the same version as in the videos for both Tweaker and Stack, otherwise it does not work.
I've been running my local tuya devices for over a year now, thanks to you. I was wondering, am I able to delete devices from my Smart Life app now that they're imported locally into my HA instance? Or do I need to maintain them.
It’s totally up to you :)
There’s no harm keeping them.
I would personally keep them in the app. Should they fall off your local setup or become unresponsive etc, you will have to repair them to tuya again to repeat the process.
Also if you delete them and there not fully locked down on your network, they will wipe there local key (so make sure it is locked down if you do delete them).
Excellent video Mark, the older video didn't work, you promised a new one and here it is.
Works perfectly.
I just have one question, for some reason the localTuay doesn't detect any of my switches even though they connected and being recognized in HA.
Any idea how to solve that?
Thanks again.
Hey! Thanks for the feedback. So LocalTuya isn't seeing the device in auto discovery?
@@MarkWattTech Exactly, the list is empty.
Only those three dots '...' (clicking on these also gives nothing)
@@stevengriffin4027 unfortunately no, still trying to figure it out
@@TheLiorNt are you able to share some more info on my FB group? I can further help troubleshoot then with images etc and can also direct people with similar issues at that post then :)
Im a little behind this week on comments and posts but will try and get round to it.
@@stevengriffin4027 Just fixed it, I removed the entity from my HA and I discovered it again.
Once its done the localTuya recognized the switch.
Try that
Hi Mark,
Nice video! I wasn't able to run that bluestacks from linux in an emulator: it requires virtualization instructions, I tried MEmu the same.
Finally I managed to run that app flawlessly in my LineageOS phone and get that file with adb.
Thanks for the trick!
Thank you for sharing. Glad you got it to work in the end :)
Thanks!
Thanks for the great video! Can I ask if the local tuya integration supports other entity types like RF blinds via the tuya universal remote?
I know this is a somewhat older video. However, after downloading the smart life app (3.6.1) on my rooted tablet, the application wasn't under (root)/data/data. Only in (Internal storage)/Android/data/. However this doesn't have any preferences_global_key file. Not even an xml file. Then I looked a bit further, I found that I have an com.tuya.smartlife folder under (root)/data/app/. Unfortunately, this only has lib files.
Is there something I'm doing wrong here?
Thanks in advance!
Worked like a charm! Love it. Thank you!
Thanks worked for me although I couldn't get it to work with the latest version of bluestacks as bstweaker couldn't see the files. Downloaded Bluestacks 4.2 and it worked flawlessly.
Hi Mark,
Nice work of creating all these video. Very clear. Easy to follow.... but if Tuya keeps changing functionality all your work hard work is in vane.
I have written to Tuya asking for an official way to obtain needed local key. If this functionality is not available anymore I, and many others will, look for alternative product. If these new version of products cannot be flashed, cannot be used with 'local Tuya' I am not interested in buying them. Will returns that I have purchased and cannot use.
If and when Tuya will make available again this functionality we will consider them again. Last I looked Home Assistant had 45000 users.
Hey Carlo. Since creating these videos Tuya have changed things up a few times. I don’t think they are planning on getting rid of the local stuff as they wouldn’t want to alienate and loose people. But they could one day decide to.
@@MarkWattTech Thanks Mark and All. Received many information and encouragement. Issue solved.
Hi Mark, i downloaded the old apk but the smartlife app asks me to turn on bluetooth in bluestacks. Since this seems not supported i ignored it and the xml file doesnt contain any localKey entries. Is there a way around?
Were you able to fix it?
Sorry Mark - a great video and you are a VERY clever guy, but I was unable to access the Android files in the Tweaker App. The right-hand side was just blank - no files showing. I did and everything search of the files and still nothing! Any ideas?
Same problem. Install exactly the same version (4.2xx) of BlueStacks
Thank you SO SO SO SO SO MUCH!!! Amazingly helpful!!!
Glad it was helpful :)
I logged in on the Tuya App but no devices are showing. All the credentials worked to get me in but no devices are showing at all? Am I doing anything wrong. I used the exact versions you mentioned
Thanks a lot! Extremely useful tutorial.
Sadly, this doesn't work for me. The file isn't present on my phone.
Thanks for the great video.
The challenge I find in getting it going it working out the pin numbers. Whilst most devices seem to follow standard patterns, every now and then I find a few devices that don't quite work. I tend to use to YAML as the localtuya config continuously failed after I selected the device/ip address.
Is there a way of determining the values for the pins etc.?
Great video Mark, does this works for other tuya devices like locks, cameras, roller shades motors??
Cameras are a no. You would need to check some of the other devices against the Local Tuya Git. Also worth noting some supported devices can be picked up, and you can fiddle about and setup the individual entities as sensors and switches etc. Doing this I have been able to add in and control unsupported diffusers and a robot vacuum.
This is freakin' great! Tool works great.
Hello. I'm sorry to write on an old video, but I have a garage door opener brand DASPI. They use a customized smart life app for their products. But the only version available is based on new version and preferences XML are empty. Is there any way with new versions to extract the local keys? I cannot use IoT because my account used to register this product is not working. I think they use they own tuya server. Thank you for reading.
Heya. In newer versions this method is blocked and the data is no longer written into the xml file (which will be why it’s empty). The simplest option will be to just use the dev tools on the Tuya Cloud to find out what your local key is.
@@MarkWattTech I had a custom app for my product that wasn't able to add it to the tuya IoT cloud project. I was able to use the product with the SmartLife app and after that I could get the keys from the IoT platform. Thank you for your time 🤗
Tried starting the extractor tool but it immediately closes. Am i missing some dependencies? On Win 11 atm. regards! i did install .NET 7 (x86) and also put the hostfxr.dll into the folder where the tool resides in, to no avail.
Is there a way to do this without the Bluestacks software? This won't install the old version of the app as my PC apparently doesn't support Virtualization
THANKS A LOT IT WORKED!!!!
Glad it helped :D
@@MarkWattTech :D thanks
now clicking on that button brings the lights on instantly
Hi Mark thanks. However, after installing Bluestacks and SmartLife from your links, when I open the BSTWEAKER nothing appears on the right side on the file manager, (in /data). Any help?
Hey Gianni. Have you made sure the versions are the same? Tuya stop this process in newer app versions
Thanks for the video. However, this doesn't work for me. I have followed all your process step by step buy in the file i transferred to my desktop I couldn't find my local-key. I do run couples of smart socket and strip light, am not sure if this are not supported or what might be the reason. Thanks
Awesome, thank you very much. All worked perfectly!
Glad it worked for you 😁👍🏻
Almost diabolically clever, thanks. Best to stick to the V4 Bluestacks, the latest (May 2023) UI is quite different.
I've just added more sensors and went to grab the keys. The extraction tool only gave me a 5 character key for one device. The 6th character of that key was a comma so I think the extractor tool omits everything after the comma. Not a show stopper as I found the key manually in the xml. Just a note in case anyone else has this issue and is puzzled why one key is shorter than the rest.
Any suggestions, I have gotten to the point of opening the file manager and accessing my preferences_global_keyaz1542 file but unable to copy to desktop. For some reason it won't let me copy
Does this version also use phone number sign in? In newer i login with mail, and i tryed 3.4.1 which said at login via number, my country is not supported.
Outstanding content thanks. Took ages to work through various issues but got the keys extracted. Question though - is there anything stopping Tuya pushing a f/w update to my devices and thus replacing the local keys? Is it safe to disconnect the devices from Tuya cloud? Next step is to try and get local Tuya installed and working...
Some Tuya devices require a manual operation to get a fw update and others are automatic. If you block the device connections it will stop this. But in theory they could update the devices yes. There is a small bit of info on the Local Tuya Git about blocking your devices.
Once disconnected from the external network you should be fine to remove from Tuya. But if you need to change the device (get a new router etc) you would need to repeat the process.
Cheers.
Mark
Bro... You are the champ.
👊🏻😄
Does it allow local control of Tuya Zigbee Devices as the normal Tuya Integration doesn't ?
This video is (currently) 3 years old. Have there been any changes since then?
Great, I will try using the Android emulator on my Linux box. On that the file might be available immediately.
I was thinking I could batch-edit the xml or your output into a YAML that I could paste into the LocalTuya system somewhere? That would be faster than manually entering the keys via the form.
I haven’t looked into it yet, but I had the same idea with outputting them as YAML. The manual process of adding each Device via the Local Tuya integration is very slow and cumbersome. Especially if you make a mistake.
Thanks for the Tutorial but just gonna let you know my Local Key included characters you might be using to assume the key has stopped, and so myprinted version had part of my key cut off, took me a while to figure that might have been happening and i just copied what was included between the " ", just in case it helps, my key included characters like : ; / ( + ? although it cut off at the : as in it didnt include that or anything after it.
ATTENTION: in case of you get this 'Failed to authenticate with device. Verify that device id and local key are correct.' while adding new plugs or switches via the add function inside local tuya there is a simple reason for that
You had chosen protocol 3.3 but the plug itself is still running on 3.1
Authenticate did not work out due to the wrong protocol and not due to false device ID or local key !
It is not that obvious and the error message should be more specific like "wrong protocol" instead of hinting to a wrong direction cause it took quite some time to get behind that issue. Unfortunatelly I could not upgrade the plug to a newer version and have to stay on the protocol 3.1 which is not bad , but becomes a night mare if you have different generations of plugs and switches cause then you need to documentate every detail like protocol.
i am using tuya apk what should i do
Hi Mark, your videos are great and I'm getting a lot of things done through your videos... Thank you very much.
I have a question! Sorry about my English. I got my tuya keys, but I have a device that has three switches and after completing the procedure the HA only shows one switch. How can I find others?
Hey there. Did you manage to resolve this? :)
Hi, Great video Mark…. can this process be done with the Tuya app? All my devices are connected with that app for HA
T
It will work with the Tuya app yeah :) again it will have to be an old version.
However, the Tuya app has started locking down old version logins so im not 100% sure if it will now work.
Hi, Great video and tips thanks . I've got to the part with tweaker and clicked on the FileManager > /data but nothing appears in /data. Checked I'm on the root C drive also tried the desktop path.
I did install bluestacks 5. Is this why it is not working? Perhaps I need Bluestacks 4?
Thanks
Heya :) As in the file isn't there or the file is empty?
I've not tried with other versions of BS so not sure on that one sorry.
don't close bluestacks, just minimise it. before clicking "file Manager" to the left you should see bluestacks is still running ( have a stop button ) and a green link icon - not red.
Great job. Keep up the good work.
Thank you! 😁
is this method working? I followed all the steps (with the smart life 3.6.1 app) and the app is asking me to turn off Bluetooth. The devices are offline until I do so but bluestacks doesn't have bluetooth
It worked for me just now. Are the devices already added to the Smart Life app?
Thanks Mark, work very fine.
All my Tuya devices have now migrated to Local Tuya Integration thanks to your help. Many thanks! Now what is the best way to get rid of the Tuya cloud devices and entities in HA? I tried deleting and empying data of devices from Smart Things App, and this cut communication with local tuya. Should I just delete Cloud integration from HA?
You could remove the cloud integration (that should clear out all if the entities)
with the developer method, when I got the keys after the free period Tuya will change the keys?
I have the same question
Worked perfectly! Thank you! No flashing or bridge required
Hello, key extractor, doesn't work well key was found, but without last two letters. Can you fix it!?
The file manager part of this didn't work for me at all, but you can still use the Tuya IOT website to get the local keys.
What was wrong when you tried to do it? IOT platform is much quicker and easier to do. This video was primarily for people that had issues using it.
Also if you haven't seen, Tuya are working on Local Control as part of the new Tuya v2 integration :)
Nice video, perfect instructions. Reading the JSON out of the XML is pretty easy though, no real use for the tool for me but I like the concept.
Too bad this doesnt work with the Tuya Smart app :( I went through the entire setup before I realized I dont use the app :( I STILL APPRECIATE THE EFFORT :))
bstweaker 6.7.9 is unable to find online. what other ver can I use?
hey mark,
what do i do with the test.xml. i made it empty but it makes you program crash when i run it as config
Heya. The file shouldn't be empty. Have you used the same app version? In the newer ones Tuya block this which is why the file is empty.