Automate LIKE A PRO! #01 - Automations Button. Learn to create an automation combined with a button

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey welcome to my automate like a pro series today i'm going to teach you how you can create an automation that turns on all the devices within a specific room at a specific time but also makes it possible to turn them on and off manually with a button let's do it [Music] [Applause] [Music] hi i'm going to teach you today how you can create an automation that turns on all the devices in a specific room automatically but also with a button so that you can turn on them manually in my case i have an office and i start working at 8 30 during weekdays in that office and i want all my devices to be on at 8 30. for example i want to turn on all the devices with a smart plug i want to turn on my air purifier and my heating and i also have lights in that office and i have a motion sensor to do this in home assistance there are a couple of steps that you have to take and i'm going to show you now let's first create a couple of helpers configuration helpers i already created two helpers that we are going to use one is called power office and one and the other one is called office automation active they are both boolean helpers so if you click on add helper you can select the toggle helper and that's the one that you need i already created them so the power office helper is the helper that switches on and off the power in the office and the office automation active helper is actually a switch that makes sure that the automation will run yes or no because during holidays you don't want to turn on all the devices in your office so that's where this one is for so let's first create these two helmets then we are going to create three automations the automations i already created them i created three automations here office turn off office turn on and turn on office on weekdays so let's dive into the third one turn on office on weekdays it has a name mode is single and now what are the triggers i want this automation to trigger at 8 30 in the morning but i also want to only trigger them when i'm at home so i'm first going to add a condition state condition person smart home junkie stay this home so if i'm home you can trigger this automation but not only that you also want to trigger them only on weekdays so there's another condition a time condition and that says it may only trigger on monday tuesday wednesday thursday friday and there's another condition and that one checks the helper that we just created office automation active if it's on so if that helper is on then you can trigger this automation too and what will it do then well normally you would say turn on all the devices that we want to turn on but i'm not doing that because i also want to use a button to turn on all the devices in my office so what i'm saying here is i'm calling a service input boolean turn on and i'm turning on the power office helper so that office helper is sent from off to on that's the only thing that this automation does now let's dive in the other automations there's the power office turn on automation let's edit that one you can see it has a name again so mode single and this one triggers on the state input boolean power office which i set in the other automation from after on so the state has been set to on in the other automation and then this automation runs and what this automation does at that moment is that it will power on all the devices so i have my studio equipment turn on studio equipment which is a smart plug i'm going to call a server set temperature so i'm going to set my front office heater to 20 degrees i have another plug which i turn on which is my air purifier and i'm going to set the temperature of my back office heater also to 20 degrees so that's what this automation does basically turns on all the devices if the input boolean power office helper is switched from off to on and then we have another one the power off is turned off edit that one again name description mode single this goes the other way around so it's saying the state input boolean power office is turning from on to off then it will turn off everything so it turns off the studio equipment smart plug it turns off my other smart plug for my air purifier it sets the temperature to 15 degrees in front of us and to 15 degrees in back office and it turns off the lights in my office i have front office lights back office lights and i have a led screen in my office so you may wonder why i'm turning off the lights here and with the other automation i do not turn it on but the other automation doesn't really need to turn it on because i have a motion sensor in my in my room and that motion sensor makes sure that lights turn on when i enter the office so i save a little bit of energy by turning the lights off with the button because this automation is basically triggered by a button well it is triggered on the input boolean power office from on to off but this is a button that i'm using for that you can also use another automation for that but i'm using a button for it so these are the three automations that you have to create so what you now have is an automation that automatically turns on the office every weekday at 8 30. but i also want to add a button and for that i'm going to add a custom button i'm not going to use the default button of home assistant but i'm going to use a custom button because i want to do something with colors and for that you need hacks and if you don't have hacks install it first it's in the description below where you can find the video on installing hacks and in hex i have some front-end add-ons and one of the add-ons that i installed on hacks is button card so make sure you install burton card first in hacks and then come back to this video so for this i already created the tutorials lovelace dashboard and i'm going to add this dashboard dashboard and i'm going to add a card here i'm going to add a button card but i'm not going to add the default button card of home assistant i'm going to add a custom card for that i have to scroll down all the way down to manual and click on it and i prepared a little bit already here so i'm going to paste code here for this button you can put the video on pause now and type this over or you can copy this code from my github page i'm going to explain what what's happening here so the type is custom button card which is the custom button guide that i installed with hacks and this card has effect on the input boolean power office which is the helper that we defined so every time when i push this button it will switch from on to off to on to off etc the default color is gray and i'm going to say i don't want to see the state of this button i can show you if i say that this is true and you see that the state is on but i want to do that with a column which i like more false give it the name office i can use mdi power which is this icon and here is the state value so if the state's value is on then show the color lawn green and if it's off then make it gray if i click this now you see that now the color is gray and that the devices in my office are turned off and if i turn it on again then it will turn to long green and the devices will turn on i'm going to save this so now i have this button and i have to do one more thing i'm going to add another card and it's the entities card let's fill some default things here so let's remove this i'm going to enter the entity office [Music] automation active this is my other helper and i save this what i can do now is that i can enable or disable my automation so if i'm toggling this button now my automation is disabled so office automation active is now set to off which means that the automation that runs every morning will not run because this thing is off and if i turn it on again it will run every morning during weekdays so now i have created an automation that automatically turns on all the devices in my office and that i can also turn on and off manually with this button one more step that i'd like to take because now i created two cards and i can combine these two in one card because home assistant has the possibility to add headers and footers to cards nowadays so for that i'm going to edit this again dashboard i'm going to copy this code here and now i'm going to edit the entities card and as you can see the entities card has a header and a footer option and i'm going to add a header plus buttons and now um this is a bit strange behavior i think it's a bug but you know this works for me so the curse is now just before the t and if i press the delete button then it changes the code here now i'm copying the code below header and i'm pasting the code of the button now i'm selecting this press tab one more time so the indentation is right i'm going to save this and as you can see now i created one card with the button and with the option to enable or disable the automation that belongs to this button so let's just delete this one delete now you have an automation that turns on all the devices in your office automatically during weekdays and you can turn them on and off manually with a button so yeah i hope you learned something from this video if so give it a thumbs up subscribe to my channel maybe share the video and bye bye you
Info
Channel: Smart Home Junkie
Views: 5,900
Rating: 5 out of 5
Keywords: Home Assistant, home assistant, home automation, tutorial, iot, internet of things, domoticz, google home, google assistant, raspberry pi, smart home, smart home automation, home assistant guide, home assistant setup, smart home tech, home automation ideas, home assistant automation, Professional home automation
Id: lkMoEQmsqIk
Channel Id: undefined
Length: 12min 31sec (751 seconds)
Published: Thu Dec 24 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.