SuperHouse #24: Home automation system architecture

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi i'm jonathan Aqsa and this is super house one thing that many people ask me about is the overall structure of my home automation system how do all the different pieces fit together I often refer to things like mqtt and open have and other technologies but without any real explanation of how they link to each other what I'm going to do in this episode is just run you through at a very high level all of the different things that are using my home automation system I'm not going to show you everything and I'm not going to dive deep into anything in particular I'm just going to show you the different pieces the building blocks or the pieces of the puzzle that come together to make the overall picture that way you can then see how it all fits together and when I talk about something in particular like a sensor that might publish to MQTT you'll know what I'm talking about so I'm just going to give you a quick overview look around the house and I'll show you some of the things I use most home automation tours do things totally backwards they start with showing you something like a light and then you know controlling it from your phone which is cool but it doesn't really explain how anything works what I'm going to do today is take you through more of a signal path approach I'm going to show you how power comes in to the property how it gets into the house and then we'll follow the path through to how it goes through the control system and eventually ends up back out on lights or whatever it is that you're wanting to control around the house now my house has a switchboard out the front pretty much all houses do because there needs to be somewhere to have the electricity meter so the power company can come along and read it there needs to be some form of external master circuit breaker for safety reasons now it's fairly common in separate dwellings like this to only have one switchboard in fact before the renovations this was the entire switchboard for our house power came in from the street came to the switchboard there are a number of circuit breakers the power meter was sitting next to this and from here it's distributed out to the various power points the light switches and everything else around the house that's all there is to it there's nothing else there but in multi-tenant dwellings things like apartments or anywhere that you need to have separated control it's fairly common to have a sub switchboard so what happens then is power comes into the front of the property and then it's distributed to a separate switchboard that might be inside each apartment or each dwelling and in larger houses and also with home automation systems that's very common as well the reason is that if you're going to be controlling a whole lot of things around your house and you want to have a control system inside your switchboard you don't want that sitting out accessible from the street you've got a whole lot of expensive home automation gear there that you don't want people messing with so typically what happens is the power comes in from the street goes to your primary switchboard and is then distributed to a sub board somewhere else in the house somewhere that is secure and you random members of the public can't walk up to and it's going to be a lot bigger than a standard switchboard because it will have all of the control system in it and that is where all the home automation system lives so in my particular case we have power coming in underground going to the main switchboard from there it's distributed to two sub boards now to minimize wiring runs because everything has to be cabled back to it we decided to put one sub board on the west end of the house and one sub board at the East End of the house that way we can distribute power to those two locations and then from there distribute out to the rest of the house so where I'm standing right now is that front switchboard this is the primary one where power comes in from the street looking at our diagram is this red square right here power comes in and from here it's distributed to a couple of direct power circuits things like the oven which isn't run through the home automation system it just gets direct power and then from there it's distributed to the other two sub switchboards let's check those out now this is the smaller of the two sub board so this is at the East End of the house looking at a little diagram it's right about here this is the switchboard itself ignore all of that interesting looking stuff up there for now come back to that that's part of the home automation system as well but for now we're just looking at how gets to the lights so if we have a look inside here at first it'll just looks like a normal switchboard it's got a couple of circuit breakers on there and that's about it all of the interesting stuff is inside if you look at the whole switchboard it's probably pretty confusing it just looks like a whole bunch of wires let's narrow it down and go through it step-by-step just over here is where the main power Inlet comes in this is the big cable that comes from the other distribution switchboard that I just showed you out at the front of the house so this is where the main power comes in from the straight through that distribution switchboard and ends up down at this one there are three cables that come in from here first is earth that comes across to this busbar which is across on the right that provides a whole lot of convenient places that you can screw earth connections in there's also neutral which runs up to this other bus bar up in the top left from there it runs down to one side of the earth leakage circuit breaker which is sitting just down here on a din rail there's also active that goes to one side of a master circuit breaker this circuit breaker basically controls all the power through this sub switchboard so from there on the other side of that circuit breaker it also runs down through to this earth leakage circuit breaker so if you put those three things together we've got the main inlet coming through we've got earth neutral and active so then just beside that we have some regular circuit breakers this is exactly what you would see inside a normal switchboard nothing that I've shown you so far in here is specific to home automation in fact if you look at this section in the middle that's exactly what you would see on a typical you know small suburban switchboard there's pretty much the same as what was in the original switchboard for the whole house it might have a couple more circuit breakers than that but that's basically it the interesting thing happens with the connections coming out of the circuit breaker so normally what happens is that from these circuit breakers power goes out to things like your light switches and from the light switch it goes to the light itself so the switch that's on the wall directly controls the power that's going to the light but in my house because it's been totally rewired for this home automation system it doesn't the power stays within the switchboard here and it goes up to these banks of din-rail relays the output from those three circuit breakers goes up and supplies power to the relays and the relays themselves can then control power going out to the rest of the house each one of those goes to a different load in the house like a light or one of the blinds and they can control whether the power goes to it or not that way there is central control over each of the lights each of the devices in the house instead of having them controlled through switches located on the wall each of these relays is double pole double throw which means that it can make connections on two different seconds at the same time so what I've done is had the electrician loop around the active and neutral to the common connection on each of those relays you can see that it's got multiple connections to the top of each relay little mount there and then the output which is the normally open contact on both sides for the active and neutral goes back out to the load in the house the light or whatever it is that it needs to turn on these relays have 12 volt coils so the screw terminals that you see along the bottom roted there are their 12-volt inputs that fire the relays they come from a little control box which is down near the bottom of the switch board right now this is about the weakest part of the whole home automation system you can see that it's a bit of a temporary job the cable from the controller which is basically a free Tronics ether mega with some relay eight shields on it goes on this cables up to the relays that way the Arduino can control the relays and turn them on or off it's got Ethernet built in so it also has a connection through here to a network socket effectively this gives the switchboard an Ethernet connection and it allows all of the outputs in the side the switchboard to be controller to the network so when I first took the cover off this switchboard you probably looked at this and thought it was all just a big mess but now you can see that it actually makes sense we've got the input feed goes through some circuit breakers which go up to those relays the relays go out to different devices around the house there's a controller which turns the relays on or off effectively it's a switchboard with an Ethernet interface that allows it to be controlled now if we look over on the right-hand side there is a bit of 19-inch rack I've mounted it vertically with the rack rails horizontal just because that was the only way I could fit it into this space it has a patch panel which has connections to Ethernet connections all around the house including the one from the switchboard so one of these ports is actually the switchboard it also has an Ethernet switch simple enough in between them is this power over ethernet injector so if you combine these three one-unit devices this is basically the networking for this part of the house we have the patch connections to the endpoints we have the Ethernet switch and we can inject power into the network just beside that is another mysterious looking device this is for connection to the light switches I'm not going to talk about that in detail right now I've got an entire episode which I've actually finished filming already which will be uploaded after this one which explains exactly how I built this and it's a very important part of the system so it really warrants a lot of detail and just down the bottom here we have this funny-looking box this is the limbus breakout I didn't entire episode about this previously this is what controls the electric motors in the conservatory to open and close the windows it really needs to be put into a nice rack mount case and put up the top or I need to do something else with it to make it a bit more neat it's not nice having it just hanging out the bottom here now that's the simpler one of the two home automation switchboards let's go and have a look at the other one it's got a whole lot more stuff in it system at this end of the house is a lot bigger there was a lot more space to work with so what we do was locate most of the home automation gear down this end instead of in the switchboard at the other end that I showed you a moment ago the basic layout is the same it's got the main switchboard which is used to control power to the different devices it's got a little bit of a rack which has got even its switch patch panel and power over ethernet injector that sort of stuff same there's at the other end let's have a look inside the switchboard and you'll see that it's very similar it's got a few circuit breakers on there just like the other one if we open it up you can see it's got circuit breakers din rail-mounted relays and in this particular case the controller for the relays is external it's not mounted inside the metal cabinet itself now this controller is obviously a temporary system we're going to get to that in a future episode I'm going to go through a lot of detail about how I'm going to solve that problem but it's basically an Arduino compatible board it's a free tronics ether mega it's got some real age drivers there which just wired through to the din rail-mounted relays and that way this switchboard also has an Ethernet connection it's just that instead of being physically mounted inside it it's mounted outside that's basically because I ran out of space there's so much more stuff in this switchboard than in the one at the other end down in the bottom of the cabinet we have this little rack as you can see it's got a couple of patch panels couple of Ethernet switches it's right down the bottom with all of those yellow cables it's got that button controller that I mentioned once again that's in a future episode in fact it's going to be the very next one to be uploaded straight after this one otherwise it's basically just networking for the house just above that little rack you can see some miscellaneous things there are some little power supply is plugged backs up in the top right there is the black hard-disk so it's a couple of disks in a little array which is used for backup purposes for all of the Apple devices on the network that's connected to the airport extreme wireless base station on the right-hand side on the top left there you can see a couple of little boxes that say super house that those are basically the brain of the house and there are two of them it really only needs one but I've got two running at the moment one is running the previous release of openhab and the other is running the new release I'm experimenting with migrating from one to the other so I've got both of them running at the same time that little box is really the core of the system and we're going to look at that in more detail in a moment and up towards the top is the switchboard now that you've seen how the other one was laid out you can see the order is a little bit different with this got the relays at the bottom and circuit breakers at the top but if you understood the diagram for that previous one and what I talked through with that then this should make a whole lot of sense a whole lot of relays driving loads at this end of the house and circuit breakers for those circuits those two little white boxes I just showed you or what I call the building brain just my nickname for this sort of thing and there's nothing really special about it but this is the hardware that the primary software runs on for controlling my house so I'll show you what's inside the box now you don't actually need any special hardware to do this I just made this for my own purposes so inside there is just a Raspberry Pi in this particular case it supplies zero with Wi-Fi but normally I use a full size PI on this and I've designed it just to fit into this standard case with little slots in here where circuit boards go in so I included a rounded bit on the end so I can get my finger in so I get the circuit board out I can just spread it and pop it out like that so there's a carrier circuit board and what that includes is the little switch mode power supply there's a radio transmitter and receiver these are for 33 megahertz transmitter and receiver there's an 18 mega tree to wait and the crystal so this is basically like an arduino uno on a board with built-in transmission and reception and the built-in switch mode power supply it's got an FTDI header on there just for loading up the sketch and the power LED there's a receive activity transmit activity DC jack there is no included this little switch mode regulator module was I wanted to be able to just plug in you know any random plug pack like ninebot 12 volt whatever doesn't matter just plug it in you know it's going to work and communications happens through here there are a couple of level shifters here so there's a serial connection between the Raspberry Pi and this main carrier board now the thing is that you don't actually even need any of this you could just use Raspberry Pi or an old PC any old computer like a laptop that you got lying around you could use that to run all of us software that I'm about to show you don't know reason that I have all of this is to make it a little self-contained unit with the on-board power regulation and ability to do both transmission and reception of signals for controlling wireless devices so now it's time to talk about software they can be pretty hard on a video because I can't really show you very much it's a whole lot of hand waving and I'll try to draw some diagrams hopefully you'll get the gist of it now the core of the system that I use and something that's really really important in a lot of home automation systems now an industrial automation is MQTT now in QT T is a bit of glue what it allows you to do is take a whole lot of different software systems that don't normally talk to each other and let them communicate in a really common way so back when I was studying I stayed in a share house and you know back in those days we didn't have mobile phones so what we had was a whiteboard in the kitchen and so whenever we make a phone call from the share house phone we'd make a mark on the whiteboard and that way when the bill came in you could see oh yeah John has made 27 calls and jack has made 17 calls and then you can work out what the proportion of the bill is so think of mqtt this way imagine you've got a whiteboard and yes I know I'm drawing a picture of a whiteboard on a whiteboard that's just the way it is so in our particular case we had a section for the phone and in phone we had a section for John say another section for Jack and then what would happen is that each time I made a phone call from the house phone I'd make a mark on here each time Jack did make a mark there so eventually over time you would end up with a record of all of the the phone calls that have been made so we've got the section of phone and then we've got subsections for the different people inside the house so there might be other things that you use it for imagine that you have a standing arrangement that every Friday you're going to order a bunch of pizza so you have another section which is pizza and you might have a section once again for Jon section for Jack and in there what you do is you say Jon likes meat lovers and you make a mark in there to say whether you're going to be around that particular Friday to have pizza then what happens is when Friday comes along whoever is ordering the pizza can have a look and say yeah that person's going to be home this person is not going to be home don't put in a pizza order it all comes in everybody's happy so the whiteboard itself becomes a central place to share messages and it can be done in a fairly structured way like keeping a tally of phone calls like this there are defined places to put these different bits of information mqtt is essentially that for software now if you're familiar with databases you can think of MQTT as being a bit like a network enabled key value store it's non-relational database it's basically a place to have a holdat of buckets where you can put information and then you can request what the value or the contents of that bucket is and it's got notifications built in so that when the value of a particular key is updated anybody that wants to know about that 30 is told about it now if you don't know about databases that might not have made a lot of sense to you so think about it this way here we have the computer which is running the software so this is the actual hardware or a virtual machine or whatever you might have in my particular cases that Raspberry Pi in a little box so it's the brain so I'm gonna say this is the brain of my system and that's the hardware now running inside that is a piece of software and in my case I use mosquito which is an mqtt broker you can think of the broker as being like the server or the database this is what acts as a central coordination point for all of the different things that might want to communicate through their system in other words this is like the whiteboard for your devices in your home automation system inside that there are a whole lot of buckets where information can be stored and you can assign arbitrary names to these those names are called topics so in the case of the information about the phone calls that I was talking about earlier what we could do is have a hierarchical topic system so we could have a topic that is called phone calls and then underneath that topic we could have a subtopic for John and we also have phone calls and then a subtopic for Jack and then that has a value so what happens is that if I make a phone call and I want to make a record of it then I publish so I might have something else out here and this might be me so I publish into this box and I set a value so I've made 27 phone calls and over here we have Jack who publishers and Jack might be up to 17 phone calls and what this means is that there is a central place where that information can be stored and any other device or piece of software that can communicate with this mqtt broker can look at the value of that particular topic and see what it is but they also get notifications so this is publishing you can also have subscriptions so that's how you get the information back out of it say we have another thing down here which is going to subscribe to both of those I don't know if you can see this green very well I've got to say drawing on a whiteboard is a way to describe software really sucks there's got to be a better way to do this but oh well so what happens is that we have something down here maybe this is a person who has been assigned to divvy up the bill and I will just call him Bob he's black so that you can see it and what they need to know is whenever a an event has been updated in here they need to be notified of it so when I publish into this particular topic Bob is subscribed to that topic so Bob gets the update and reads the value 27 because that's the value that's been put into it so what you have is a way of having a central scratchpad or white board that can be used for transferring messages around the place now you might still be thinking what's the point of this it doesn't really seem all that useful but this is really the enabler this is the key that allows a whole lot of different home automation devices or any devices really to talk to each other without needing to know anything about each other now I've been talking about these as if they're people and we're talking about the share house situation but this could be anything for example this could be a temperature sensor which periodically publishes the current temperature reading maybe it does every 60 seconds it's published 27 degrees is the temperature this could be temperature / loungeroom and so 27 degrees in landrum it's a hot day and then you might have some other system down here perhaps the climate control system which is subscribed to the temperature in the lounge room because it needs to make decisions about whether to turn the cooling on or off whenever this is updated perhaps the temperature goes up it now hits 28 degrees the system down here which is subscribed to it immediately gets that change and it can make a decision it can say 28 degrees I've now my setpoint I'm gonna turn on the air-conditioning but it doesn't need to know where that information came from all it needs to know is how to talk to the MQTT broker to get that data so what that means is that you can have different devices this could be an Arduino based device it could be a data feed from your Bureau of Meteorology it really doesn't matter as long as the data gets into this system and the way the publication and the subscription works is using a very well defined protocol and it can be connected over different methods so this could be over tcp/ip it could be a serial connection it could be a connection from another piece of software just running on the same physical machine it doesn't matter you've got this Universal scratchpad that allows you to pass information around and it does it with quite low latency so as soon as this information is published just 27 value and the things subscribe to it will know well depending on the particular load on your machine and your network connectivity all those sorts of things but it should know within milliseconds so you could have a very high-speed stream of data I'm talking about slowly changing data here like a temperature sensor that publishes every 60 seconds but you could have something that's publishing many many times a second you could have you could build quite big infrastructures using this and then have all sorts of messages passing through it so a lot of instant messages systems actually use mqtt as their back-end messaging system I guess the way of passing messages because these things could be an app running on a phone which connects to the MQTT broker or it could be a physical device like an Arduino which is reading values and from sensors and then publishing them or it could be a device that is subscribed reading values and in making decisions based on what that is so the MQTT structure really forms the glue that lets you take a whole lot of different devices that don't necessarily need to know anything about each other and stick them together so that need to operate now to give you a practical demonstration of what I'm talking about here are four shells that are logged into the building brain that little Raspberry Pi with the mosquito and PTT broker on it down the bottom two shells what I'm going to do is subscribe to a couple of topics you can see the mosquito sub command is just a little helper program that you can use to subscribe to a topic and you can see that I've specified the topic is office / temperature and over in the shell I'm going to subscribe to office / humidity now up here what I can do is publish to those topics so I could publish to office temperature and I'll give it the message of 12 and down the bottom you can see that the message of 12 came through on the client that is subscribed to that particular topic if I publish a different message then that comes through as well and you can see that it's pretty much instant we're on the local machine here it's just publishing and subscribing directly within the box so you know fractions of a millisecond should be the response time on it and we could push quite large volumes of data through now I'm going to publish to the humidity topic and you should see that the message comes through on the bottom right so we have two clients there that are subscribed to different topics what we can also do is use wildcards because the topics are hierarchical in this case I'm going to subscribe to office / hash and hash in NQ TC is a wild card so now if I publish to the humidity topic you'll see that the clients in the bottom right which is subscribed to that topic has seen it and also the clients in the top right which is wild card has seen it now if I publish to temperature and this time they'll make the message some text random staff once again you can see it's been picked up in the top right and in the bottom left so these different terminals don't know anything about each other one of them is publishing the others have subscribed now I have a little Arduino with the temperature and humidity sensor connected to it and that's going to publish to those same two topics I've just plugged it in now and if you look at the SUBSCRIBE topics in a moment once it starts up well you can see now it's just published 21.7 in office temperature in the bottom left and 46.1 in office humidity on the bottom right you can also see that the wild card client there is picking up both readings now I started by publishing today's topics using the command line client but now those same topics are having messages published to them by a totally different client in this case it's a little hardware device which is sitting off connected to my Wi-Fi and publishing values from the sensor that's connected to it so let's look at a few very specific examples of how I use MQTT as glue to pull this together so we have the brain the little Raspberry Pi running to MQTT broker which is mosquito now we also have the switchboard that we were looking at earlier switchboard has unit those din rail-mounted relays and those relays are wired through two different lights around the house that way I can turn them on or off by applying power to those relays it also has the arduino based controller in it and that's what is connected to the ethernet network when we're looking at those switchboards earlier there was the ethernet connection and that means that this device is connected to the same network as the Raspberry Pi now the way I use that is the controller subscribes to a topic within the the MQTT broker so we have a topic here and it's watching for messages that might appear in it now that particular topic might be say switchboard East or switchboard West and anything that is published to this particular topic will be seen by the switchboard that means we can send commands to the switchboard simply by publishing to em qtt we don't need to know anything about how this works all we have to know is the address of the broker to connect to and the topic to publish do all right so that's part of the puzzle but what actually publishes to that topic what is it that sends the commands that allows the switchboard to turn on and off well it could be all sorts of things there is another very important thing that I haven't shown you yet you saw it in the switchboard but I haven't explained how it works and that is my light switch controller so around the house I have light switches there might be one game to game 3 game for game doesn't matter those are all connected to the light switch controller and once again it's an Arduino based device so it's got an ether mega in it and it reads when these buttons are pressed now then in turn publishes so it's a pub into a topic and the topic might be just buttons all light switches whatever you want to call it it doesn't matter so when a button on the wall is pressed the light controller detects that and it publishes back to MQTT so we now have incoming commands and we have outgoing commands but they're in isolation during different topics this is publishing the command that goes out and this is where the events from the light switches come in but we need somewhere to glue them together it's still just a scratch pad does publishing information now I deliberately haven't shown you much about the lighting controller yet I've shown you how the switch board works but I've got an entire episode dedicated to the lighting controller and that's going to be uploaded right after this one so if you know more about how that works you'll have plenty of information about how to build your own for now all you need to know is that when a button is pressed on the wall a publication event happens to mqtt so that something here whatever is subscribed to that topic knows that someone activated that light switch so next we need something that is going to link these together there needs to be some glue in the middle now when I started this what I was doing was using little scripts that I'd written that were just running directly on the box so what I had down here was a little script it was actually written in PHP and I've got a version written in Perl and what that would do is it would subscribe to certain topics and publish to certain topics and it was basically a rule engine so it would say if this particular light switch with this ID is pressed it knows that the you need to turn that particular light on or off of course you also need to keep track of state so you need to know if it's currently on and if it is turn it off and if it's currently off turn it on whenever someone activates one of these switches so the rule engine keeps track of the state of all of the different devices in the system and it knows how to bind them together so by defining linkages between the inputs and the outputs you can then have all sorts of different things happen you know this is where you have a lot of flexibility in the system because now the control over the outputs is disconnected from the inputs except through software that means that you can simply reconfigure your software to totally change the behavior if you want to change one of these light switches and make it do something different there is no physical connection between this and the lights that it might be controlling all you have to do is update your rules you could say or that button on the wall I don't want to do the exhaust fan in the kitchen anymore I want it to do the under bench lighting change a couple of entries in your configuration here and now the light switch does something totally different now just to show you what I mean about the flexibility I'm going to change this light switch in the kitchen and I'm going to do it right now if no edits no cuts so you can see the result right now I have this two way switch and if I press the top one it controls the lights turn it back on again now the second button controls the electric blind which you can just see over my shoulder there so when these buttons are pressed the button controller is seeing an event so it's seeing a button press event on button one or on button two it's then publishing to mqtt and then the rules engine is saying that particular button is associated with the blind or with the lights or whatever now we recently had some exterior lighting installed if you look outside just about there somewhere out on the veranda there is a lamp and there are a series of these lamps on the posts around the veranda so when the electrician came around he installed those and ran the cabling all the way back to the switchboard one of those little relays that you saw earlier is to control power to those lights now I can control those lights using my phone because I can send a command using openhab that is going to turn on that particular output but I don't have a physical light switch on the wall that allows me to control it so what I'm going to do is pull off this switch so I'll just pop the cover off and through it so as you can see there it's got the two ways switch on it now this particular switch is not controlling the power directly as I said it's just a logical input and it's using Ethernet cable with an IJ 45 connector so I've unplugged it and over here I've got a three-way switch which is the same thing that's just that instead of having input one and input two it's also got an input three so as you can see it's currently powered down I'll plug it into the cable the light will come on so now we have three inputs and if I press the top one it's still button one so it still controls the lights as before button two still controls the blind and prior to doing this I've already updated the rules engine so it now knows that button three is to be associated with the lights outside so if I press button three you the lamp that's outside there came on so we now have a switch in the kitchen which can be used to control those lights so I can now put that back on the wall and away we go now the skeptical among you will be saying well so what like changing a light switch is a very rare event you've gained a little bit of flexibility but not you know anything that's really exciting so why would you bother well the interesting thing is that now that we have this software linkage we can introduce a whole lot more intelligence into the system now I was using this little homegrown rules engine for a while if I was doing this now I would use a piece of software called node-red so what you really should do is go and check out node-red if you're interested in this right now I'm not using it I've still got my original homegrown piece of code doing that but that's because I started doing this before like long before node-red existed so I'm not even gonna bother publishing my code for that there's no point node-red is far more sophisticated if you're wanting to set up rules based around MQTT go for node-red but even with this little rules engine in place that's still just the start what I have hanging off the side here is another piece of software called openhab and there are a variety of options for the code that you can be running here I've been using open head for a while I'm currently still on the one point X release series and I've got that second little brain running the two release series but that's not live yet on my house my house is still running on the one point X release and openhab is essentially like a Rolls engine on steroids what it does is keep track of a whole lot of things within the system so it keeps track of the current state it knows whether things are on or off so that it can toggle the results it has rules built-in it has scheduling built in so what you can do is define a whole lot of different circumstances under which you want things to happen so for example you can have open hubs subscribe to a say we've got a topic which is luminance and it's how bright is the light outside it knows time of day in various other things so we could have a rule in here that says subscribe to the luminance topic and if luminance is less than 50% and the time of day is from 7 p.m. to 11 p.m. then publish to this topic and turn on the outside lights so with a couple of lines of code we can now make a system that will turn on the lights at dusk and then turn them off again at 11 p.m. so you'd been gives you the flexibility to start thinking about how do we make this system behave and as you get more and more inputs and more and more sources of data you can make more and more decisions for example openhab has plug-ins for a whole lot of different services one of them is the network health service which allows it to detect whether certain devices on the network now one way you can use that is to detect whether people are home if the open HAP system can detect that your mobile phone is currently on your Wi-Fi network it knows that your home so you could have it so that the exterior lighting is only turned on if you are not home it assumes that if your home then you don't need it on or you'll turn it on yourself manually but if you're not home and these conditions are met you're probably going to be coming home so it turns exterior lighting on and then you can have all sorts of other factors come into play as well what you'll find is that it starts off very simple just with some controls some inputs but then as you start taking all of these different things and gluing them together you can do far more complex things another good example is that we can define a button so in fact you could have one of these buttons on the wall here it's just like a light switch on the wall there might be you're leaving home button and that could be one year front door so you press that button publication happens to the MQTT broker and then your rules engine whatever it happens to be might say oh this person is just pressed leaving home button so that means I need to do a whole series of events I've got to turn off all of the lights in the house except for the front light if it's dark outside you'll leave that on for a while and then turn it off ten minutes later I need to close all the curtains in the house close all the windows and lock all the doors also change the settings on the climate control to save energy maybe do a few other things as well so you can have one button which is like central locking for your house but more than just the locks it does a whole lot of different things so if we look at an actual physical button on the wall I've got one just down here this button panel here is connected through to the controller which is mounted in that little rack so when I press this button what actually happens is that that button press was detected by the button controller it then published to mqtt so that and after that of course it doesn't care it's done its job it's just published that publication was then seen by openhab which knows that that means I need to change the state or toggle the state of the lights in the office and it then published to the broker again to the switchboard command topic and said turn off this channel and then the lights turn off so if I press that again it'll know that once again it's a toggle a state and then the lights turn back on but because there is that software link and openhab is the one that's doing the work the actual source of that command could come from all sorts of different places as I said it could be based on rules it could be button presses it could also be coming from the open hand app which is connected Cerreta here so on my phone for example I'm running the open habit I can go into the office garage section and say office light click the button it sends the light off so that command that I just sent from here came into openhab which then publish to MQTT switchboard turned off so now I can control the lights either from my phone or by pressing the button on the wall and the state because the state is being tracked through openhab it knows that it updates so right now don't know if we can focus on here the app at the top is showing that the it's the little green slider and showing that the lights are currently in an on state so I reach back here and press the button and the state on the app updates to show that it's off and I'll press the button again it stayed on the app updates to show the lights are on so it's all linked together the events coming through here updating the state within open have so it keeps track of what's going on around the house now this is barely scratched the surface of what I've got in my home automation system I've only shown you a couple of things just the core of the system and how the lights are controlled and button inputs from the wall but there's a whole lot more to it lots of sensors and other devices but this video is long enough already and now that you know the basic framework as I do more episodes you'll be able to understand how they fit together when I show you something like a sensor that publishes two mqtt you know what that means so finally I want to say a big thank you to all my patreon sponsors patreon supporters and what I'm going to try to do in future episodes starting right now is give away something to a random patreon supporter in each episode now for this particular episode it's just about the architecture of the system there isn't a particular thing that's in it so I figured what I would do is I'm going to give away one of my building brains it's got the Arduino I'm sorry yeah the Arduino derived daughter board that I designed it's got that for 33 megahertz transmitter and receiver in it it'll switch mode regulator it's got the Raspberry Pi 0 W in this particular case and I'll include a micro SD card with the with all the software on it that I'm running so what I did was have a look at my list of patreon supporters and I randomly picked one and there was a supporter the only name on the supporter profile is Rizla someone in the UK so I'm going to contact them by email get some shipping information and send this building brain to them so for future episodes I depending on the episode I might do more giveaways and if you want to be in the running please go and support me on patreon and that'll help me do more of these videos thank you very much see you next time [Music]
Info
Channel: SuperHouseTV
Views: 179,774
Rating: 4.8300428 out of 5
Keywords:
Id: vL54JfldB4Y
Channel Id: undefined
Length: 46min 54sec (2814 seconds)
Published: Thu Sep 21 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.