How to set up Automations in Home Assistant tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so automations are the coolest thing in home assistant because with automations you can virtually connect every device that you have in your house to any other device in your house and let them act upon each other's actions which is really nice and really cool you know if this than that i mean you know connecting one device to another device well automations in home assistant is like if this and that on steroids i'm going to show you how automations work what you can do with it and i'm going to show you some examples on how i implemented it in my own house to inspire you so let's dive into it [Music] automations can be found in configuration and then you scroll down and then you see automations here so if we click here you already see a lot of automations that i created in my home assistant instance so but actually this is my live production environment and because i'm from the netherlands some of the words will be in dutch but i think you will get it what i mean so if you want to create an automation you can click on the plus on the right lower corner and then you have two options you can create an automation from scratch or you can let home assistant determine itself how an automation should work based on what you want for instance here are some examples you you can also type in the text you can say turn on the lights if motion is detected and then i say create automation and then home assistant automatically knows what to do so it's asking you what motion sensor do you want me to use to detect motion so i'm going to check my motion sensors and for instance i have one in the kitchen so i'm saying use my kitchen motion detector detector to detect motion and what do you want to do if it detects motion well i want to switch on all the lights in my kitchen and then i say create automation and what you see now is that home assistant automatically created an automation that will switch on all the lights in my kitchen which are shown here don't worry about it i'm going to explain everything so just leave that for now um and uh based on motion that is detected by my ikea motion detector and then if i say if i save this then it saves and it will run automatically how cool is that it is cool but you can also be more like an expert and make a professional automation by building it from scratch so i'm going to show you how you can build it from scratch and what options you have and then i'm going to show you all the nice automations that i created just for you for inspiration so we go back here yes i want to leave and i'm going to create an automation from scratch so i click on the plus in the right lower corner and now i'm not going to choose one example i'm not going to type in any automation that i want i'm just going to type skip and now you're basically into the automation editor well in the automation editor is really big you can do a lot with it i'm not going to explain everything because if you start with this and basically all the tutorials that i make are mostly for people that start with home automation with a home assistant so i will make a more professional and a more advanced course later but now i'm going to show you the basics i'm not going to dive into deep things like templars and events because that will basically blow your mind if you you know if you have everything in just one tutorial so i'm going to show you the basic things so you can give your automation a name so say my very cool automation and i give it and i can give it an optional description this shows more information about my dopamine i hardly ever use that thing but you know can come in handy and then you can choose four kinds of modes within your automation well let me explain that you have the single mode the restart mode acute mode and the parallel mode so what's the difference between these four the single mode is that if a trigger is detected for instance let's say we have the motion detector so if motion is detected then it will run this automation one time restart means that if a motion if a trigger is detected so if motion is detected in this case and motion is detected directly after that then the first automation will stop and it will run again immediately with cued oops with qt it means that if a trigger is detected and an automation is running and then the trigger is is detected again while the old automation was still running then it will wait until the old one is finished and then it will start the automation again so it will build up a queue and start it one after the other and parallel well i think you guessed it already is that if an automation is triggered and it's running and then it's triggered again while the old one is running then it will start the same automation in parallel so at the same time so then you can you know uh let things run at the same time so most of the time i think you will choose single so we just signal for this one now we go over to triggers so what you always have with automations is that you have a trigger that triggers your automation so for instance uh there's motion at uh at your front door of it's starting to rain or you know things like that there is a trigger and next to the trigger you also have conditions so for instance if you say there's motion detect detected at your front door which might be a trigger and then you can say emit a condition but i only want to do something if it's night or between 9 and 10 in the morning so that's a condition and after the condition then there's the action so basically what the automation needs to do so for instance turn on the light or turn on the alarm whatever there are a lot of things that you can that you can do here so that's the basic thing so you always have a trigger you have a condition or more conditions and you have one or more actions you can also have more triggers by the way so you can also say if if motion is detected in the hallway or motion is detected in the kitchen then do this and this so there are different trigger types and there are a lot so if i open this you see device event state geolocation home assistant mqtt numeric state blah blah blah a lot of things i'm not going to explain all these triggers i'm just going to explain some of them because some of these triggers are you know more advanced more professional and you can always look them up in the home assistant documentation which is online but i will show the other ones in a later tutorial which are you know the more advanced ones so for instance you can choose trigger type device so if if you see if you choose trigger type device let's choose that and i'm going to say okay i'm going to click on device then i see all the devices that i have in in my house for instance the kitchen where is it where is it where is it the kitchen motion sensor here it is so now i've chosen my kitchen motion motion sensor here and then it's um then there is a trigger on that and i can choose between different triggers of for this device so in this case the motion sensor from ikea has three triggers that are defined within home assistant one is motion sensor battery level battery level changes you can use this for instance that if the battery level of your motion sensor goes below let's say 10 percent then send a message to my phone to tell me i have to change the batteries in the motion sensor other one is motion sensor started detecting motion so if motion is detected then do something blah blah blah turn on the lights or if motion sensors stop detecting motion then turn off the lights well there are a lot of different options here but for now i'm going to say let's start detecting motion so if the throttle motion sensor started detecting motion then i can do one other thing and that is i can add a duration here so i can say for instance i want my motion detector to detect motion for 10 seconds so if there is motion for 10 seconds then start to do something put this back to zero that's a lot of zeros so put it back to zero and the other thing for instance the battery level i can say if the battery level is below ten percent this is the percentage here then send me a message so there are different things to do here um so that's how device works so you can choose any device that you have and any device has something else i have for instance a smoke sensor so smoke sensor has the same thing smoke sends a battery level if the smoke sensor started detecting smoke smoke sensors stop detecting smoke do something bring an alarm so that's what what device do event is a bit more advanced and i'm going to skip that for this tutorial now we're going to state so state is if the state of a sensor changes then do something for instance let me see so okay for instance i'm going to use this one which is one of my door sensors which sees if the door is open or closed so i'm going to i want to check if the door has been opened and do something based on that if it starts if it goes from closed to open open do something for instance if i'm not at home and if my door is opened by someone then ring an alarm send a message to my phone that there is a burglar for instance so that's what state does and you can choose different a lot of different entities here and every entity has his own things to uh to work with so then you have home assistance so for instance you can say if home assistant starts then do something or if home assistant shuts down then do something i'm going to skip mqtt numeric state also another sort sort of state for instance let's say my climate in in the living room if the temperature in my living room gets above 20 degrees then start my air conditioning for instance that's what you can do for instance with numeric states there are different things to do with it but this is one of the examples uh sun i can also see if it's sunrise or if it's sunset then do something at sunrise or do something at sunset and you can also say but i want to have an offset for instance let's say i want to start my garden sprinkler 10 minutes before sun rise so then i say min minus 0 0 and then 10 minutes and 0 seconds so zero hours ten minutes zero seconds so basically what i'm saying here is start something for instance turn off the lights or start my garden sprinkler as i already said uh ten minutes before sunrise or maybe 10 minutes after sunset or at sunset so that's what sun is doing you also have tag i'm going to explain that in another tutorial in the tutorial about tags which is taxes are quite new to home assistant and it is nice but that is a different topic it's i can make a separate video of it template i'm also going to skip template because template is also more advanced more professional to use time is something that you will probably use because you can say at a certain time start something for instance i always want to start in the morning at let's say at 8 30 i always want to switch my smart switch that is connected to all my office equipment at 8 30 because then when that is when i'm going to start to work that's one of the things that uh that you can do with time so you can have a fixed time or you can have a value of a daytime helper so you can say add time and this is something that is more advanced then you need to know what helpers are i'm going to skip the helper part for here but i will show you in a different video so for now it's just fixed time let's say at 8 30 i want to start something okay so that's time time pattern is also something that that's sort of the same for instance you can say let's let's start every six hours i want to start my um i don't know what can you start every six hours your air conditioning anything basically or you can say i want to start my uh ceiling fan every six hours or every er every 10 minutes or every uh five seconds i want to do something so that's what time pattern does then webhook is also more advanced i'm going to skip it for now and you have zone so you can say if a certain entity is within a zone for instance if my phone is within the zone home then if i enter the zone home then do something so for instance if i enter the zone home with my phone so if i enter my house with my phone turn on all the lights or turn off the alarm or if i leave my house turn off the alarm and and turn off the lights and also turn down all the heating so that's what you can use this for okay so we make it a bit easier we go back to device and then we go to the the motion sensor of my kitchen and i'm going to say if my motion detector starts motion then do something now we go to conditions with conditions you can add an extra condition to your automation or to your trigger for instance in this case i can turn on the lights in my kitchen if my motion sensor detects motion then i can switch on the lights but i don't want to do it during the day i only want to do it at night or at a certain time so i can say well i can add a condition here and i can say for instance if i use sun i can say do it only after sun set so only after sunset you can and and do it before sunrise and after sunset then you can turn on the lights when motion is detected in the kitchen so that's what you can do for instance with conditions there are a lot of other things you can also do end and or and not and state and basically these are the same things as that you can see here in in the triggers so i can also choose for device here so i can say well if motion is detected in the kitchen and for instance well what shall we say well let's say and my doorbell it has been someone pushed on the doorbell then turn on the lights it's totally useless example but it's just to show you that you can do multiple things so yeah i'm not going to need any condition here so let's oops nice so i'm not going to fill in anything and now the actions part so now now we are getting to the action so what we had with the trigger again was if there's motion detected in the kitchen then turn on the lights in the kitchen so i'm going to choose a device device and i'm going to say all done here kitchen spot one i'm going to say turn on kitchen spot one i can also give it a brightness because they are all dimmable and then i'm going to well what now happens is that only one spot is going to be um turned on so i'm going to add another action device and we go to kitchen spot 2 and we're going to set turn on case and spot 2 and so on and so on and so on and then if i save this then all my lights in my kitchen turn on as soon as there's motion detected oh that's easy now um this is just a simple example i'm going to show you some examples of things that i uh created already and i use in my home every day so you get a bit of an idea of what you can do with all these automation stuff [Music] so i've shown you how automations work in home assistant and now i'm going to show you some examples of automations that i use every day in my system just to show you how powerful they are well let's start with let's say this one turn on the fan if humidity is above a certain threshold in my bathroom i have a humidity sensor and that detects the humidity of the bathroom and if it comes above 75 percent then i want to turn on my ceiling fan so my ceiling fan is triggered by a smart switch and which i built in so let's open this so what i created is a trigger of numeric state sense or bathroom humidity if it's above 75 then trigger the bathroom fan and turn it on this one is pretty easy pretty straightforward and i created the same one for turning off so if if the bathroom humidity is below 75 percent but for five minutes so it has to be below 75 for five minutes then turn off the bathroom fan also pretty straightforward okay let's get another one um this is well maybe this one is nice oh this one turn the lights in my hole on when motion is detected so i have this ring doorbell in my uh at my front door and i have in the hallway behind front door i have a light and the front door has windows in it so and the windows you cannot see through it but you know there are windows not sure what the english name for it is if you know it let me know i can learn something here um so if motion is detected on my ring doorbell then i want to that the lights in the hole switch on so if someone is at my door at night then the lights should go on and that's also handy against burglars so let's see how this works so if there's motion detected by my doorbell at the front door and it is at night so it is before sunrise and after sunset then turn on my light in the hall downstairs at a percentage of 100 percent wait one minute and then turn it off again so this is already a little bit more advanced right okay now we go to the next one let's choose another one yeah this one is really nice this is one of the things that i'm not sure if you can relate to it but i always had the thing that you know you want to print something in your printer and then you start printing and then your printer says sorry i'm out of ink and you really need to print it today and then there is stress because you have to go to the shop and you have to get a new inked cartridge and you don't know what ink cartridge it is so i had this all the time so i thought i have to create an automation for it and then i discovered that it was possible that i can see the levels of inked in my printer with home assistant so this is what i created for that uh whereas printer inked is low so what this thing this thing does is it's it's i think it's brilliant that's okay um i have a printer it's a canon mx-510 it's an old printer but you know it it works and you can use your own printer for it and i have triggers on that printer i noticed that home assistant has these triggers by default that you can see the value of the black cartridge and the value of the color cartridge so basically what i'm saying here is if the value of the black cartridge is below 20 or the value of the call of a card which is below 20 and now it's going to be a bit tricky then send me a message to my phone and this one is you know a bit more advanced but just to show you how how it can work so it's sending me a message and then i have to fill in some data about uh what is in the message so i'm entering a url here and the message is that it shows me the cartridge levels so percentage of my my black cartridge the plus percentage of my color cartridge and it sends me a text click to order here with the title your printer is running out of ink so basically i'm getting a message now on my phone telling me my ink my printer is running out of ink and if i click on that message it will lead me to this online shop where i can order my ink cartridge for my printer just below before it runs out of ink that's really cool i don't have any stress anymore that my inked cartridges are running low on inked and uh yeah you know these are the powerful things that you can do with home assistant and automations it's really more advanced okay um yeah so well i want to show you one more thing i also have another one which is really cool that is you know if someone rings on the door then my tv it will be set to pause because why should you want to put your tv on pause manually when somebody rings at the door i mean every time somebody rings at the door you have to get your remote put your tv on pause and walk through the door so you can automate that you know all these kinds of ideas that you have another thing that i have here is that i have a sprinkler in my in my garden and it will water my garden based on the amount of rain that has been fallen the amount of rain that is expected to fall and the temperature that it has been during the last three days and based on those variables it will water my garden for a certain amount of time you know all these things that you can you can do it's so advanced so if you are used to using if this and that for for example and you find that this is really simple then really look into home assistant look into automations you can virtually build everything that you want but there is one warning that i have to give that as i hope that your partner has a really good hobby because if you dive into automations you will get remarks about that you are constantly working on automations and make your house more intelligent and more intelligent so uh yeah you know the sky is the limit with this so i hoped this video helped you and inspired you if so share the video give it a thumbs up subscribe to my channel and let me know in the comments what kind of automations you created or what kind of automations you would like to create or maybe you want to have some more advice on things in in home assistant let me know i will read everything i will respond as soon as possible and yeah well that's it i hope you have a great day and thank you for watching bye bye you
Info
Channel: Smart Home Junkie
Views: 65,604
Rating: undefined out of 5
Keywords: home assistant, automation, home automation, iot, automations, tutorial, trigger, Home Assistant, Presence Detection, How to, homeassistant, smart home, smarthome, google home, smart home automation, smart home tech, internet of things, raspberry pi, hassio, hass.io, beginners guide to home assistant, home assistant automation, IFTTT, ifttt
Id: KXTs5_x_T5c
Channel Id: undefined
Length: 29min 34sec (1774 seconds)
Published: Sat Sep 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.