in today's video we're going to be having a look at another way of extracting your local keys
from your two-year devices in order to make use of
the local two-year integration in home assistant check it out
what's going on guys i hope you're all doing well in my previous local two-year video i showed
you how to extract your keys using the two-year developer tools well if i've already showed you
how to do this why am i showing you again well in the last couple of weeks since creating that video
two you have been updating their api and one of the significant changes they've made is they've
changed the way that accounts work if you set up a new account now just to give you a bit of
a heads up the next couple of minutes is just going to be me talking about the recent changes
to the 2d developer tools and how those changes have affected the previous method for extracting
your local keys now if you're not interested in any of this be sure to make use of the chapters
below and just jump ahead to the what you're going to need for this project if you're sticking
around for this bit let's have a quick look at the recent change that's affected the previous method
for extracting your local keys the actual change that's an issue is this part here
and in this change any project that was created after the 24th of march can no longer use this
linked devices by products and in that previous tutorial i showed you that's the part where we
link our smart life app to the two-year developer tools and then we get that little qr code and then
when we scan that it's linked and it pulls all of our devices in if you created a project before the
24th of march you should have no problem following that tutorial since this change has come about i
have spoken to a few people that have actually created accounts and projects after the 24th of
march and they've been able to see this linked devices to products and they were able to follow
along with the previous video with no issues at all a few other people have said that they
followed along and it was missing and they spoke to the two-year tech support and the tech support
enabled the actual link devices on their account now i actually had to go this myself i created a
brand new account and a brand new project and sure enough that link devices by products was missing
using that contact us on the two-year page i got in touch with their technical support and
ask them if this link devices by products if it's been permanently removed is it temporary
like what's going on and i got no feedback or response about that i then message them again
to say can i have this enabled on my account and i got response from someone a couple of minutes
later saying if i refresh the page then this would show up so i did that and there was still nothing
a message back saying hey i've refreshed the page and nothing's happened and i didn't get a response
then for two days and then two days later i got notification from them saying if you create a
new iot account then this link devices by products will actually be there so i created a new account
and still nothing so to me that doesn't seem super stable for some people it's there for some people
it's not some people can request it and get it some people can't and over the last couple of
weeks the developer tools has changed quite a lot so while it might be there today it could be gone
tomorrow you never know what's going to happen really and with today's video we're going to be
getting the local keys and we're not going to be using these developer tools whatsoever and you
might be thinking if there's another way to get the local keys and you knew about it how come you
didn't show us that way in the first place well in my opinion i think that the developer tools
is a much simpler way just because all you've got to do is create an account on the website
tick a couple of boxes and then you're good to go and while the method i'm going to show you today
isn't difficult there is just a few extra steps which is why i opted for just using the website
so enough blabbering on about that let's say goodbye to the developer tools and get on with our
new method okay then mark if we're not using the developer tools what are we using to get our local
keys from our two-year devices the method we're going to be using today is extracting the local
keys from the smart life app on a rooted android device and if you're an android user with a rooted
device and also have the smart life app then be sure to use the chapters below and just skip
over the whole emulator setup because you can jump straight into the actual key extraction as always
then let's have a look at what we're going to need in order to complete this tutorial and i think
this list is actually pretty short there's just two bits of software we need so first up we need
the bs tweaker or bluestacks tweaker and secondly we need bluestacks now there'll be links for these
in the descriptions below so go ahead and grab those for now you can just download them to your
desktop and we'll run through the install together in a second there is also a third bit of software
that we can download but this one's entirely optional and all it is is just a c-sharp script
that i've written myself and what it's going to allow us to do is just print out our keys and
it's just nice and simple if you're interested in that then download that in this video i will show
you how to use that and i'll also show you the manual way if you don't want to use that and that
code will also be on github if you want to just go and read that code or have a play around with it
another download we're going to need to get is the smart life app and we're going to grab this
from apk mirror now the important thing to note here is that it's version 3.6.1
and it needs to be this version 3.6.1 in order for this tutorial to work there'll be a link
for this download in the description below so go and download that and stick that on your desktop
if you're following this tutorial to get your device local keys in order to make use of the
local two-year integration in-home assistant you're obviously going to need a working version
of home assistant you're also going to need to have hacks installed if you have no idea what
hacks is or how to go about installing it i'll link a video that i've created which will show
you the setup and installation of hacks so go and check that out and then come back here okay
the last thing we need to do then is just hit that subscribe button if you haven't already
and if you press the notification bell you'll be alerted to whenever i bring out a future video
if you've got all those things let's get on with it okay so we downloaded
bs tweaker and bluestacks and we can see those on my desktop just here
the first thing we're going to want to do is just extract the contents of bs tweaker now you can use
whatever you preferred an archiver is or just a windows 10 default one in this case we're using
winrar but you can just right click on that i'm going to say extract to the bs tweaker folder
and once that's done we're going to just end up with a folder here just for clarification
i'll have on screen the versions of bs tweaker and bluestacks that i'm using
for this particular video and those should be the versions that i'm linking to in the description
okay the next thing we're going to want to do then is just to run the bluestacks installer
in the bluestacks installer we're just going to accept the software license and we're just going
to hit install now then just give that a minute to install once that's done then we'll see a little
installation complete in the bottom right there i'm just going to hit launch this is then going
to take us to the bluestacks dashboard we can just click close on this google play sign in and just
skip through these little pop-up messages and then we want to just press on my games on the split tab
at the top you're then going to need to get your smart life apk from wherever you downloaded it to
i've just dragged mine to the desktop here so i'm just going to double click on that
and you'll see that that starts installing in bluestacks
again just to reiterate the reason we're using this apk is just because it's an older version
of smart life in the newer versions of smart life you can't actually access the local keys
using this method so once that apk is installed we're just going to run the smart life app here
we then need to press log in you need to agree to the terms and then just log in with whatever
details you use for your smart life account once you press log in you should see all of the devices
that are linked to your smart life account we're then done with the smart life app so we can just
close out of this at the top here once the smart life app is closed we're just going to minimize
blue stacks we're then going to open bs tweaker from the folder we extracted it to earlier on
so we're going to click on that one and bs tweaker 6 then we're going to click the
bluestacks tweaker.exe that should then pop up the loading bar and once that's done it's going
to give us this little control panel from here then we're going to just press on file manager
and what we need to do now is just navigate to the config file that smart life just created
so at the top of this control panel we've got three options we're going to choose data here
we're then going to scroll down and go for data again
this will show us all the applications installed on our emulated device we're just going to scroll
all the way down to the bottom and we should see com.2yo.smartlife there so just press on that one
we then want to press sharedpress and we should see two different preference
underscore global.keys and the one that we want is the preference underscore global
with key and then a bunch of different characters after it what we need to do now is just copy that
config file from the virtual device across to our desktop and this control panel split into
two sides this left hand side here is our window side and the right hand side is the virtual device
so it's quite straightforward on the top you've got all of your different drive letters
so just navigate to wherever you're going to store it so for me i've gone for c users and
then my desktop and then all you need to do is just grab the config file and just drag it across
there's one that i did earlier on but i'm just going to overwrite that for the sake of this video
and once that's done it will just appear there on the desktop once we've done that we
can just close the file manager in bs tweaker if we click this little stop button here it's
going to stop bluestacks so just press that and then we're also just going to close bs tweaker
and with those couple of steps we've actually just exported our local keys and all of the information
about all of the devices on our smart life account and all of that info is just in this xml file
now at the beginning when i said you need to have a rooted device that would be if you're using an
android device because to get that particular file and config your device needs to be rooted so if
you're doing this on an android device you'll just need to go to that set path which i'll probably
have on screen somewhere now or and it'll also be in the description so just go to that path
and grab that file and then just export it to somewhere that's accessible for you as i said
these devices now contain all of our local keys and the information about our 2d devices so i've
made a duplicate here and i've just modified the information inside of it so i'm not sharing my
whole config with all of youtube i'll open this up and show you the manual way of getting your
keys from this file so i'm just going to open it with the default windows editor so i'm just going
to right click on it and choose edit for me this is opened up in wordpad and what we can see here
just kind of looks like a bunch of gobbledygook xml now that's not super readable and if you're
only after your local keys and your device ids it's quite hard to find them through that the
easiest way that i found for finding them is just by doing a simple search so in your document you
can do control on f which will do a find then if you do a search for local key and hit find next
it will take you to a match so we can see here this one's found a match on local key so just
after the word local key there'll be a string with a bunch of different characters and numbers in
and this particular string is actually my local key we can't really see what device that actually
is so reading on from here we'd have to read on a little bit to find the actual name so
i can see here it says name and then the name of that device then is tracker so i know from
my devices that that's my actual robot vacuum and it doesn't really make a difference if you use any
of the text editor so if you use notepad plus plus or vs code anything like that the formatting for
it is still pretty horrible so you can if you want to just comb through that and find your local key
your device id and the name but it's a bit clunky now for me i really didn't like the idea of having
to comb through that and just manually find all those bits and just piece it together so i went
and did something slightly different and what i did is just create a little console application
which is going to pass all that information and just spit out the information that i want
i did design this tool for myself but being so that whole extraction process if you're
doing it manually is pretty horrible i thought i'd share it with everyone else so if you are
interested in using this tool i'll leave a link in the description below to my github so you can
go and download that and i did kind of just slap it together at like half two the other morning so
it's not the neatest almost standardized and if you're interested in adding to it or changing
parts of it then feel free to do that and make some pull requests and i'll pull those in but yeah
it's just a simple console app that passes that information and then displays it to us i'm just
going to give you a quick demo of it now but if you're interested in it i'm going to do a separate
short little video just showing it off and that should be linked in the description below as well
okay then so here's my little two-year key extractor tool so it's just a console app with
the command line interface the first thing we need to do to use it is just set the config file path
and this file path is just the location of that xml that we just extracted from smart life
so here's my test one here so i'm just going to grab that location
and then back in my command line tool i'm just going to hit number one to set the config file
path so then it's going to ask me for the path and i'm just going to paste that in
and hit enter and that's told me the path has been set so i'm going to hit enter again
from here then i can see what the path is currently mapped to and that looks right to me
and then this is where the magic happens so if we now hit number two and hit enter
that's now printed out all of my devices with the name the local key and the device id
so i can just scroll through all of them here so yeah not bad it's definitely better than reading
through that whole xml file but again this is just optional you don't have to do this
you can just do that manual process if you want to as i said i did create this tool for myself
so i haven't actually tested it on anyone else's config or setup but if you are interested in that
tool go ahead and download it and let me know if it worked for you if it doesn't work for you and
enough people are interested i'll actually spend a bit of time on it and make sure it does work
and there we go whether you've used my tool or you've manually combed through and grabbed your
information you should now have access to your local keys with our local keys then we can now
set up the local two-year integration in our home assistant if you're not sure how to do that i'll
have a link to the video that i did previously which shows you the full setup of local two-year
and you can just follow along with that if you want to but you get local to you
from hacks and once it's installed you can add devices to it so you just go add integration
and then local to you and it should automatically discover any of your local 2d devices on your
network so i'm just going to choose one from this list and just hit submit it's then going
to ask you for that local key so whether you manually extracted that or you used my tool
you just go into the tool then find the device and then just copy and paste the local key
so give it a name paste in the local key and then just hit submit it will then ask
you to set up the entities associated with that device so this particular one is just a switch
and then you just fill in all the data points for that entity and just hit submit and then if
you're done you can just leave that ticked and it should hopefully tell you you were successful and
you can just click finish there and then there we go my device has now appeared in that list
and that's pretty much it sorry if that end bit felt a bit rushed through i did previously cover
setting up local 2 yet in my previous video so if you want a bit more information and a bit more of
a detailed breakdown then be sure to check that one out the aim of this video was primarily just
to show you another way of getting your local keys so that you could use them and make use of them in
the local 2 integration as a quick summary then we first downloaded bluestacks bs tweaker and the
smart life apk we then set up and installed bluestacks and installed the smart life apk
we then needed to sign into the smart life app just once in order for it to generate that config
then we used bs tweaker to extract that config from our emulated device and just place it on
our desktop and once we've done that you either manually combed through the file or you had to
go with my little tool and just extracted all the keys you wanted and i think that was probably it
so thank you for watching if you've enjoyed this video then don't forget to drop me a like rating
if you hit that subscribe button and ding dong the notification bell you'll be alerted to any future
video i do if you previously had a go at using the developer tools and now you've tried this one
let me know in the comments which one you prefer to use also if you have a go at using my little
tool let me know how you got on with that if you are interested in using that tool there
will be a link for it in the description below it is quite straightforward to use
it's just a command line interface so push a number hit enter and it will do its thing
and if you're interested in having a poke around the code and just wanting to refine it then
again the github will be linked in the description below and i'll catch you in the next one cheers
i think we're about five minutes in without
actually physically doing anything with the tutorial