in today's video i'm going to be showing you how we can take our
2e devices out of the cloud and access them locally check it out
what's going on guys i hope you're all doing well in a previous video we had a look at how we could
make use of the two-year integration and use it to add our two devices to our home assistant
i'm gonna contrast to you and local to you and then i'll show you how you go
about setting up local two-year you can then decide whether you want to
go for the two-year installation or the local to you installation
let's start off by having a look at two-year and why we might want to swap over to local two-year
in short two-year is a software company that create a wide range of iot and smart home devices
this includes things like cameras sensors and other bits you might find in a smart home
in addition to manufacturing some of these devices and other bits of hardware they also host a large
cloud service this cloud service allows to your customers to access their devices while they're
away from home and if we're making use of two-year we're more than likely utilizing this cloud
service now the cloud service does have its pros and cons the pros being that we're able to access
our devices while we're off our network and we haven't got to worry about any port forwarding
or any special config we just connect the device to the service and it should work and the cons be
in we're handing off the security and trust of our devices to a cloud service in my own opinion and
based on my own experience with two-year i think two-year is a great place for any new smart home
user to start my reason for this is that the two-year products tend to be quite cheap and
affordable the quality of them is also pretty good two yet also allow other manufacturers to connect
to its cloud service which is a good thing for the customer because you get more manufacturers
creating devices that are going to link to the same service you're using you then get more of
a range and choice of devices that are available to you again this is just my own opinion based on
my own experience let me know in the comments what you think do you like two-year do you hate to yeah
which i guess brings us onto local to you so as i just mentioned if we use interior we're passing
off this responsibility and the security and the trust and everything else that goes with it to
this cloud service and if you think about it this is quite a lot of trust and responsibility to put
in a company in the service because we could have things like cameras or motion sensors in our home
and this company has access to it so we just have to trust that their security is up to scratch
and that our devices are safe in addition to the security there is also the reliability of
the cloud i did say that the uptime and response time of the 2u cloud was generally pretty good but
pretty good isn't perfect i have experienced this where the two clouds been totally down
and like a caveman i've had to walk over to the light switch and physically turn it on or go to
a plug socket and also physically turn it on i've also experienced it where the cloud's been down
and i've been blue in the face shouting at the amazon echo to turn on a light or turn off a
socket and it's just telling me that the device is unreachable there's also been times when i've used
the home assistant app or the smart life app or even my voice and i've given a command and
then there's just been a huge delay of up to 10 seconds or more before the actual action is done
all of these issues that i've just mentioned are because of this reliance that we have on the cloud
now how do we improve this how to improve the reliability and get that control back
the answer is of course local two-year local two-year is going to take these devices from the
cloud and give us that local control so we can say goodbye to these issues with the cloud being down
or slow response times because we're gonna have all of this stuff local and the responsibility
is going to fall on us there's a few different ways to get your two-year devices out of the
cloud and running locally obviously in this video we're going to be going through local two-year but
another popular option is two-year convert what are the pros of local to you then to start with
we're dropping that reliance on the two-year cloud we're also going to get speed improvements because
for the responses we're not going to be constantly polling the two-year cloud we're going to get in
push-up dates which are all going to be local on our network we're also going to be getting back
this control and the security of our devices that all sounds good so how do i go about doing this
well first of all if you haven't already press that subscribe button below and if you ding dong
the little notification bell you'll receive a notification whenever i bring out a future video
and we're back on our lovely demo dashboard to carry on with this setup process i'm going to be
assuming you've got hacks set up and installed if you're not sure what hacks is or haven't got
it installed there'll be a video linked above and also in the description below so go check
out that video and in that video i'll show you how to actually get hack setup let's get started
then so first up we're going to need to open up hacks we're then going to click on integrations
and in the bottom right there's a little plus button it's kind of just under my arm here
so we're going to press that button and we're going to add a new integration
we then want to do a search for local tuia
and once that pops up we're just going to hit the install the repository in hacks here
and just go ahead and click on install once that's done we're just going to reboot home assistant so
we're going to go down to configuration then we just want to scroll down to server controls
and we're just going to hit restart and okay while we're waiting for home assistant to restart them
we're going to head over to the 2u developer site there'll be a link for this in the description
below on the 2-year developer page then we're going to need to set up a developer account and
this account is separate from the smart life or to your account you're currently using to
control your devices now one important thing to note here is there's actually two different ways
to sign up so the first way is just by clicking the little sign up option here and if we press
that one we'll see it gives us the option to enter an email address a password and a region
if we just go back a page which will take us back to the main two-year developer page and from here
instead of clicking sign up at the top we're going to click the orange iot platform button we're then
going to be taken to this page and from here we can see that there's another signup link here
so if we press that signup link in the bottom left here that's going to take us into another
sign up form but the difference with this one is it's going to ask us to enter a company name
let's go ahead then and start filling this in so first up we're going to need to enter
an email address we're then also going to need to provide a password and a company name
now you can go nuts here you can call the company name whatever you want
it doesn't really affect it so enter your company name and now this next step is an important one
in the region you're going to need to select your region and set it as the united states
now you're going to need to set your region as the united states even if you don't live
in the united states and the reason for this is that it's going to help us to skip a step
a little later on so make sure you've got that set as united states of america
once you've done this we're going to just tick the little agree box there and we're
going to click the orange agree button it's then going to email us a verification code
so we can grab that from our email and just paste that in and then hit create account
and we should then be taken to the login screen and we can just hit log in and we should then
be taken to the developer dashboard we'll get a little pop-up here that's given us some help
messages we can just click continue and then just skip through all these just hitting next next next
from here we're going to navigate to the left-hand menu and we're going to choose cloud and projects
it's then going to ask us if we want to subscribe to the cloud development and we're just going to
click free trial we're then going to want to make sure trial edition is picked and we're just going
to choose buy now once that's done we're going to just choose iot platform at the top again
and then we're going to hit cloud again and projects on the my project section at the top
there we can now see this little trial edition and if we hover over it we can see when the trial
is going to expire with that trial edition you only get one year of access but that's going to
be plenty of time because we only need it just to do this initial setup just to get some local keys
i'm not 100 sure but i think maybe at the end of that year you can actually renew it
for another year but again not 100 sure on that but you can definitely just transfer the account
over to a new one and get a new developer account and do the same thing we've just done
if you wanted to and we're just using this method just because it's the easiest way to
get the local keys there are a few other ways to do it but they're a bit more clunky and cumbersome
and if i remember i'll leave a link in the description below to some of the other ways
that you can go about getting your local keys and if enough people are interested i might
show a video showing off how to use some of those other methods anyway let's get back on
topic so we're in the cloud project section now and there should just be a little option here
to create a new project so just click create in the project name description and industry
you can enter whatever you want here and once you've entered those details just hit create
we should now be able to see that project above that we just created
so in my example here my one's local to you and you'll be whatever you decided to call it
so we're just going to click on that our next step then is going to be to import our devices
from our two year or smart life app into the developer account and to do this we're going
to just press the link device option and then we're going to choose link devices by app account
and then from here we're going to press the add app account button in the right there it's just
a blue button we should then be presented with a qr code and we're going to need to open up
the smart life or two app on our phone and scan this in order to link the app and the developer
account together let's go ahead and do that now then so i've just opened the smart life app on
my phone in the top right there's a little plus button i'm going to press that and then now in
the top right there's like a little square with a line in it i'm going to press that one as well
and it's going to present me with the barcode scanner and then just going to scan the qr code
and it's going to ask me if i'm going to confirm so just press confirm
we should now have this option with the account and the app that we've just synced so i can see
that mine was the smart life app and i can see it's brought through 16 different devices
so in my example here mine's bought through 16 and if i click on that
that's going to bring us into the device listing page now there's currently nothing
displaying because it's looking in the region for registered devices in china
now all of mine have registered to europe so if i click the drop down here and then just choose
europe i'll then see all of my devices that have been pulled through you'll see the custom icon if
you've set any in the app you'll get the friendly name the device id and also the product id
and obviously what the actual product is from here in the top right you can also see out of
those devices that have come through how many of them are online and how many are offline
so far so good yeah cool okay another thing i'm going to point out here in the first
column we can see the device name and id so the device name is obviously the friendly name
that you've set yourself so for example here i've got lite3 and then below it is the id
now this id is what we're going to be using in order to extract the local key from your devices
so in a second when we start talking about extracting the local key from the device it's that
device id that we're going to need so now you know where it is and when we talk about it you're going
to know where to get your id from before we start extracting any of the local keys then we're going
to first need to enable a couple of apis and these apis are going to be what allow us to actually do
the extraction so to do this we're going to click on cloud and we're going to go to api products by
default you're not going to have any apis enabled but we can see in my example here i'm already
subscribed to the smart home device management api now you'll need to find that in the list below
here and just enable it to do that you'll just find the smart home device management and click it
it will then take you into a page like this but for the smart home management one and you're just
going to click the orange subscribe button we'll then just need to click on the time limited free
and it'll tell us that it doesn't cost anything and we'll just click buy now that should refresh
and we should see that available in this list here from here then we're going to just jump back to
the iot platform and we're going to go back into cloud and back into api products so we're back
here on the api products page and we can see that we've got two apis that we subscribe to
the second api the smart home scene linkage you don't have to add that one on i've just added it
because it's gonna be something that i mess about with but if you're only interested in getting your
local keys and just doing this setup then just go with the smart home device management one
another thing to just clarify is that this whole setup process should be free so you shouldn't be
spending any money or entering any card details or anything like that it's free you will have
noticed that my device manager api was already enabled when we actually got on to add in the apis
the reason for this is that prior to recording i actually had a lot of issues trying to get the
apis to install now to go over these issues i'm going to be creating a separate video and it's
just going to be a short troubleshooting video because there's been a few other issues that i've
run into so hopefully by sharing those i can help you guys if you run into any of the same problems
that video is going to be releasing alongside this video so it should be linked above or in
the description below and i'm separating it into a separate video just to keep this a concise install
video if you're enjoying this video and you're finding it helpful then maybe drop me a like right
here and if you press that subscribe button and ding dong the notification bell you'll be alerted
to any future videos i do or maybe you're watching it and you're not enjoying it and you're thinking
wow this video is janky and this dude keeps on changing all different shades of orange
okay let's get back on topic then so there's going to be one more step we need to do before
we do any of the local key extraction so the first thing we're going to do is we're
going to go to smart home device manager we're just going to click on that and once that opens
up we're going to choose project and then we're going to press the new authorization
from here we're going to find our project in the list and we're just going to select it and choose
ok our project should appear in this list and it should now have access to the api the next step
then is the local key extraction so we're going to go to cloud and api explorer in the api explorer
the first thing i'm going to need to do is change our data center to the relevant data center so for
me it's going to be europe we're then going to choose get device details from the side and then
we're going to paste in a device id for something that we want to add to local 2 year so i've got my
device id of one of my lights in the clipboard so i'm just going to paste that in and we're going to
press submit request in the json response that we get back from the api we should see this local key
and this local key is going to be what we need for each device in order to get it added into
local two-year in-home assistant so let's grab that local key now so now we're finally back to
home assistant i'm going to go to configuration i'm going to choose integrations we're then going
to choose add integration and we're going to do a search for the local 2 year and we're just
going to press on that this integration should automatically be able to detect any two devices
that are on our network so in this drop down here we should see all of our available 2 devices
the one that we're going to want to choose from the device list is the one that we just got the
local key for so let's have a look for that now and when we do this we should just see all of
the different device ids you may want to just cross-reference this with the two-year device
list or if you go in the app you can actually view the device id on within the smart life or tv app
so i know that this one's mine so i'm just going to choose that one and i'm going to click submit
it's then going to ask us to name the device for me this particular device is a smart plug
and it's got some fairy lights plugged into it so i'm just going to call this local to your plug
then the local key then is what we've just extracted from the 2developer page so we're
going to want to copy and paste that in here once we've entered that we're just
going to click submit it's then going to ask us to match the entity to the device that we're adding
so again for this example i'm adding a smart plug so in the drop down here i'd need to choose switch
now if you were adding a light or a sensor or any of the other available ones you'd need to
make sure that you add the correct correct entity for the correct device type and this is obviously
important because different entities have different attributes so for example lights you
might have the ability to change color whereas you probably don't have that with a smart plug
i think you get the idea so let's choose switch here for my one and click submit the next step
is to fill out the additional information for the entity now don't worry if you're
not sure what these are or if you get them wrong because you can come back and edit these after
there'll be a link to the local to your github in the description below and this covers some
of these attributes that you can have these are things like additional properties that your device
could have so for example in the case of the plug it could be voltage monitoring current uh current
can you can't even say it current consumption my spark plug doesn't have any of these extra
monitoring features um so let's fill this in now so the id my device pin one is currently off uh
friendly name i'm just going to call it local to your plug again same as i did before current
doesn't have any so false current consumption false voltage also false again check out the
github pages for any additional information on this and also if you want to check if your
device is supported there'll be a link for that as well in the description so we're just going
to press submit we're then going to get another pop-up asking us if we want to create any more
entities for this device now this would be where you add the additional entities so if you've got
multiple different sensors on a device so things like the power monitoring or current consumption
things like that you'd create these extra sensors for it here again we've just got a plain old smart
plug so i'm just going to say don't add any more entities and just click submit we should
then hopefully get a success message and it will tell us that we've just created this new device
so i can see that i've got my local two-year plug i'm just going to choose finish on here
and we can now see the local two-year integration with one device and one entity so if we added more
entities they'd be available here so let's just click on local 2 now and see what that looks like
within the integration then i can see my local 2u plug and i can click on it and
just like an ordinary plug it's got a little toggle so i could toggle this on and off
and that will that's actually turning my fairy lights on now that i kind of around my front
room here so that just toggles them on and off as you'd expect for a smart plug and it just works
and it's instant so there we go guys that's how you get your devices added into local two-year
let me know in the comments if this is going to be something that you actually try out
if you've had any issues throughout this setup process then check the description
for that troubleshooting video that i've done in that video i just run through some of the
issues that i faced whilst setting up local tutor so hopefully that video will be some use
to you and you'll get your issue resolved if your issue is not resolved in that video then
feel free to drop a comment on this video or in that video and hopefully we can get you sorted
and there we go if you've enjoyed this video then don't forget to drop me a like rating
if you press that subscribe button and ding dong the notification bell you'll also be alerted
to whenever i bring out any future videos and i'll catch you in the next one cheers