 Okay, hurry up or do you have to hear another bad joke? I have like a four part of it. It's a tongue ear, no don't worry. Okay, yeah. So sorry. Alright, yeah. I'd just like to give a disclaimer at start. You'll see a lot of Google related stuff but it's nowhere sponsored by Google. It's just some of the techs I've used in this. Okay, so I'll talk about how I used Google Home which comes in with Google Assistant to control my accounts. I can just talk to it and just add it to switch on my account or just change the temperature. Okay. So the inspiration behind this, I went to Google IO this year and then when they talked about Google Assistant they had this really cool demo where they had a mocktail mixer. So you could like, they had this device set up, you could talk to it and just ask it to create a mocktail for you. And this is what it looked like. They had four, five cylinders on top which they had drinks coming out. So you could tell it, I want this thing and it will just pour it out for you. So this along with the fact that I've been wanting to learn how to hack around with a Raspberry Pi for like a couple of years. I just had it but never got around to using it. So this kick started everything. And then, so I just go briefly run through the boring part essentially just to get you up to track. Google Assistant is just a conversation platform provided by Google. You can actually just, it's on your iPhone, it's on your Android, it's on Google Assistant, it's on Google Home, it's coming out on washing machines, whatever. And similar to like building apps, you can build apps for Google Assistant using actions on Google which is just like an SDK. So as I said, I used to Google Home for this project. Then the good thing about this is like if anybody of you has worked on chatbots, it's extremely similar. Just that instead of text now you've got voice but the core technology and the core concepts is entirely the same. So for me, I use api.ai it's another Google sponsored project but nowhere, I'm not nowhere related to them. I just use them to convert voice to text, pull out actions. Like if I say switch on the lights, the action is like switch on and then there's a there's a part you need to understand which is the lights, so what I'm understanding. So that's what api.ai helps you. And then you build a webhook which is like it understands what you want, it sends it to your server, your webhook, you process what you want to do, return back the response and then it will just speak it out through the Google Assistant. So here's the part here because anything you say to Google Assistant or the Google Home in this scenario it's going to be processed on Google going to be passed to api.ai and then they'll need somebody to react to that and that's where the Raspberry Pi comes in but again because this is all in the cloud your Raspberry Pi needs to be able to talk to it so you cannot just basically let it run on your web server local it cannot be local, it needs to be connected to the internet So what I did is something entirely very basic not something recommended you can't really use this to host a website so simply you just install Flask which is just a Python server it's barebones, it can do one request at a time so it's not multi-user it crashes so often it's not really that secure and I would really like to highlight that it's really difficult to set up there's an entire guide available online and post the links eventually that was the only thing which got it to work for me So now is I would say the most interesting part which is how do you reverse engineer an Aircon remote because nobody's going to provide you you can't go to your Aircon manufacturer and be like the signals you're sending so you really need to sorry so first thing what you need to do is first I'll go through the basics of what an Aircon remote is I'm not really sure about what other remotes are like the Aircon remote essentially blasts the entire signals it's on, off, everything going on at the same time there's no up or down temperatures which are going and there's a Python library called LIRC which is then used to which you can use to blast off infrared commands to any receiver out there so essentially you just need to set that up on your Python again there's an entire tutorial available on LIRC's website how you do it and then so you set up a receiver on Raspberry Pi you play your remote on it and you'll see something like this space is essentially the amount of time in microseconds the receiver was quiet and then the pulses whatever it hit all gibberish right now you need to pass it through an IR record command which will then convert this into a state information comes something like Alina the 45 seconds I guess it converts it into some kind of config file for you so essentially what you're doing is you're recording whatever the remote is sending and then you're going to replay that back using an IR blaster so LIRC is just a mechanism to convert those signals into something code will understand and then just replay that back so essentially this is what you'll do you'll set up your IR blaster that's in my room I couldn't bring it over and then you just blast those signals back again so now since you have everything set up normal tips we can probably go through this later if you have any questions about some how the debugging went about through all of this you put it all together essentially you talk to google home goes to the cloud comes back to your Raspberry Pi through a through the fulfillment engine fires off the IR blaster to the aircon and then responds back by saying you're done yep that's about it I have a video let's see if it loads yeah this is just a 20 second clip of how it works in my room I hope the audio works okay google talk to lord commander alright let's get the test version of lord commander greetings fellow member of the night's watch hey please switch on my aircon trying to switch on your aircon so you can see there's a light which lights up and the aircon is turning on yeah that's about it yep that's it if you have any questions so so your current can we just turn on the aircon turn on turn off increase temperature not decrease yet so I set it to like 20 degrees when I switch it on unlike a remote there's no memory in the Raspberry Pi as of now will this work with TV soon? yes I believe you just need it would work with any remote which uses infrared to communicate like that's essentially a remote out there you just need to be able to decode what the signal is being sent out someone just told me recently it was really cool that it sends out IR codes for like every TV out there it's basically like a TV killing device so I'm thinking about those like the big but like universe of the world yeah universe of the world so could you make something like that or maybe like you know make it pocketable so that you can actually like pocket your TV off okay this cannot be carried in your pocket but I used to use one app on my phone as well to control aircon and television sets but I think recently Android has a lot of new phones don't have the IR blaster anymore so no choice anymore yeah that should be possible let's say you can have a separate device near the IR blaster it should actually be possible also because another thing I would like to highlight the entire reverse engineering process I went through it especially because the remote I had so the LRIC community actually maintains an open source project and where they've reverse engineered a lot of remotes like you even have like star herb TV remotes and sync tell TV remotes out there but they didn't have the my aircon model so I had to go through the reverse engineering process but you could just get it off from there and just replay so like most of the comparatively difficult part is anyway done for you yeah did you actually recover the structure of the commands like can you send out an IR command for any temperature setting any fan setting or did you just record the 3 or 4 so what I realized right I've not gone into specific details I just had a basic idea about what it looks like so what I realized is 16 bits the first 7 is just a static header and the last one is a checksum and then the first one so the 8th one becomes your power on off if I remember clearly the next 4 represents the more then it's the fan speed and then it's the temperature and I think there's one more setting in my aircon the economy or the super high mode so that's one of them so you can essentially now rearrange them in any order and just send it out for you so recording just helps you decipher that information to begin with where can you go up and go down because I haven't said that I didn't like I haven't written that command yet that's your thing I mean it's not like it's much more difficult I have just not written it yet so did you say that high needs to be connected to the external internet that it can receive the web port? correct because google home is connected to my whole house wifi right so when it sends to api api actually needs actually needs a URL to which it could send your the json to that needs to be on the internet right can't be on your local web so you won't get it ok google we are at time we'll do it for later you'll be at high enough