Geofencing in Home Assistant - TUTORIAL

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

I was not aware of the existence of the proximity integration

Thanks!

πŸ‘οΈŽ︎ 5 πŸ‘€οΈŽ︎ u/NicoLeOca πŸ“…οΈŽ︎ Mar 13 2022 πŸ—«︎ replies

Does this require HA to be accessible externally?

πŸ‘οΈŽ︎ 4 πŸ‘€οΈŽ︎ u/chench0 πŸ“…οΈŽ︎ Mar 14 2022 πŸ—«︎ replies

Brand new to HA and just watched your video on samba. Thank you! Keep up the awesome work!

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/longclippers πŸ“…οΈŽ︎ Mar 13 2022 πŸ—«︎ replies

Didn’t see anything mentioning access to HA when away. Does this integration require that I have Nabu Casa subscription and/or can reach my HA instance from the Internet? Seems like this would be required for this geofencing feature.

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/M_O_N_T_I πŸ“…οΈŽ︎ Mar 13 2022 πŸ—«︎ replies

Awesome,but I think it's great!

πŸ‘οΈŽ︎ 2 πŸ‘€οΈŽ︎ u/Famous-Forever7647 πŸ“…οΈŽ︎ Mar 28 2022 πŸ—«︎ replies

Thank you !

Chas

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/cthompgh πŸ“…οΈŽ︎ Mar 13 2022 πŸ—«︎ replies
Captions
hey everybody great to see you back in my last video i explained about presence detection and home assistant so that devices switch in your house based on if somebody is at home or not at home thank you for all the comments and likes on that video and i would like to thank richard van der pol especially for his suggestion for a new video which is about geo-fencing and home assistant that's actually a great idea so here you have it this video is about switching devices in your house if somebody enters or leaves a zone around your house [Music] [Applause] [Music] so here we are i'm going to show you how you can set up geofencing in home assistant you might be aware that there are some suppliers that deliver heating devices that switch if somebody leaves or enter a zone around the house and we are going to build this exactly the same in home assistant but first let me show you some use cases so this is your house and your house is situated somewhere in a city let's say the center of amsterdam around the house you're going to define an area and you want your house to switch based on if people enter or exit that area so let's go for the first use case nobody is within the area so the heating of your house is set to low now one person enters the area and you want to heat up your house already so the heating is set to high as soon as this person enters the area now another person is entering the area and the heating should stay high because that person is also a member of your family so they are both at home and it's really cozy at home because the temperature is high now one person is leaving the area but the temperatures should still be high in your house so the heating stays high and now the other person is leaving the area and then the heating should be set to low now let's go over to home assistant to see how you can set this up one of the things that you first have to do is to make sure that you have the home assistant companion app installed on your phone because the home assistant companion app can determine where you are exactly on the planet and that is needed to determine if you are in the area that you defined or that you are outside the area that you defined so make sure that you got that installed on your phone but i think you already got that because you use that to control your whole home assistant system next to installing the home assistant companion app on your phone you have to make sure that location services are enabled on your phone for the home assistant app because without that the phone cannot determine where you are on the planet so make sure you do that it's different for iphone or android but you might find it somewhere in settings privacy location services somewhere like that make sure that that works now you set up your phone correctly we're going to home assistant to set up the rest of the things first we go to people and you can find that by going to configuration people and zones and then you'll probably see the people in your house already here you can open every one of them and change things here like the picture and all that stuff but what the most important thing is that you have to make sure that your device trackers are being connected to that person and that is this space in the person entity so you can choose tracking devices here i already got my iphone chosen here so if i show you this and i'll open it and you see here there's a device tracker iphone x at make sure that this icon is in front of it because this icon shows you that it's about the device tracker of your phone i have other device trackers too for instance this device tracker is one that is in my router but for now we are going to focus on the device tracker on your phone because that actually sends the gps data that is needed to see whether you are entering a zone or that you are leaving a zone so make sure that for every person in your house you select the correct tracking device so what i did i did it for myself and i did it for my girlfriend i also had the tracking device of my girlfriend selected here here it is and that is also the phone of my girlfriend okay so now we got that set up it means that i have two persons now that i can track within a zone now i'm going to set up the zone around my house for that we have to edit the configuration.yaml and to edit the configuration.jaml you need a file editor there are several file editors in home assistant for instance you have the file editor and you have the studio code server if you didn't install those yet you can go to configuration add-ons backups and supervisor and within this add-on step you can go to add-on store and you can search here for the file editor or you can search for the studio code server both will work studio code server needs a bit of a stronger machine to run home assistant on but both work so make sure that you either install file editor or studio code server i prefer to use studio code server so i'm opening studio code server now and studio code server shows you all the files and folders of your home assistant installation and what we are going to edit now is the configuration.yaml file which is here i added these lines these are the lines you need to install or activate the proximity integration into home assistant so what is this saying you start with the name proximity which is the name of the integration then you give your area a name let's say in this case home and within home you are going to assign some devices to it and in this case it is person.add and person.ariet which are the two persons that i showed you in the step before this then you can enter a tolerance and the tolerance is in meters and then you can enter a unit of measurement in my case it's kilometers but you can also use other values there like mouse for example and this is basically everything what you have to do then you save the configuration.jaml and every time when you save a configuration.jaml you have to reboot home assistant so for that you go to configuration settings then you can click check configuration if you don't see all this by the way that means that you don't have the advanced mode enabled in home assistant you can enable the advanced mode in your profile now let's click check configuration see if configuration is valid and it's valid and then i click on restart and it restarts home assistant i already did that so i'm not going to reboot but you have to do that otherwise the proximity sensor will not be available for you okay let's check our proximity sensor if it works so for that i'm going to developer tools and i'm going to click set state entity and i'm going to type proximity and there it is proximity.home i'm opening this and you see the state is at this moment zero and that means that i am at home or at least somebody is at home basically the state shows the kilometers or miles or whatever that you are away from your home so you see that there of travel is arrived and that the nearest are me and my girlfriend and that is because we are home so that is okay what happens if we are leaving the home is that the state is going to change so if we are away for one kilometer from our home then the state will be set to one and if we are from two kilometers from our home the state will be set to two etc the other thing is that if one of us stays at home the state will stay zero so it can be that i am like five kilometers away from my home but my girlfriend is at home then the states will still be zero because there is somebody at home great the proximity sensor is working now we are going to set up the automations to switch the heating so for the automations we go to configuration automation and scenes and we are going to create a new automation by clicking on create automation we are not going to select a blueprint but we are going to start with an empty automation here and i'm going to give this automation a name let's say geofence switch heating and now we are going to set up the triggers for the trigger type i'm going to choose the numeric state trigger type and for entity i'm going to select our proximity sensor submit the sensor proximity home and i'm going to say if we are further away than let's say five kilometers then we have to do something i'm going to give this proximity sensor a trigger id so let's say leaving home that is the trigger id now i'm going to create another trigger which is about approaching home so i'm going to add another trigger here i'm going to select numeric state again entity proximity home and i'm going to say if we are below five kilometers and i'm giving it a trigger id approaching home so i have two triggers now one trigger that triggers if i'm further away than five kilometers around my home and i created another trigger that is going to trigger when i am within that area so when it's below five kilometers now we are going to actions for this first we are going to create a choose action and this is all about trigger ids if you don't know how trigger ids work i have a video about it and check that video first and you know how that works but i'm going to apply it here so i'm going to add a choose type and within the choose type i'm going to add the condition and the condition in this case is triggered by i'm going to say which trigger is that okay let's say leaving home this is the trigger id that i define it on top of this automation and then i'm going to say if we are leaving our home i'm going to add an action let's make it a service and the service is climate dot set temperature you can choose other surfaces if you like but i'm using this now i'm going to say choose entity let's say the climate of our living room you can also select every room in your house of course i'm going to say the temperature is going to be 15 degrees when i'm leaving home now i'm going to add another option and that within that option we have a condition again and the condition type is triggered by and now we are going to say approaching home so as soon as somebody enters the area of five kilometers around my home i'm going to add an action let's call the service again let's call that service climate dot set temperature choose entity again i'm going to choose the living room and i'm going to set the temperature to let's say 21 degrees save it and we go over it once again to explain it really clearly so what do we have here we have a title we have two triggers one trigger that triggers when you are away more than five kilometers from your home and another trigger that triggers when you are within five kilometers of your home and then action if the trigger leaving home is triggered then set the temperature to 15 degrees and if the trigger approaching home is triggered then set the temperature to 21 degrees what you can do to check it is add another thing so i'm going to add another action that sends a message to my phone that the temperature is set to 15 degrees here so i'm going to add action here and i'm going to say service notify let's say notify to my phone i want to have a message the temperature is set to 15 degrees celsius in our case title you left your house and for option two i'm also creating an other action again call service notify notification to my phone message is the temperature is set to 21 degrees and the title is you are approaching your house save it so now i will also get a message about what happens when i'm entering or leaving the zone that i defined and that is basically everything that you have to do to set this up so i hope it helped if so give the video a thumbs up subscribe to my channel tick the little bell and please leave a comment i really would like that thank you and bye bye [Music] [Applause] [Music] you
Info
Channel: Smart Home Junkie
Views: 21,300
Rating: undefined out of 5
Keywords: Develop in Home Assistant, Home Assistant, Home Assistant teacher, Howto, advanced automation, beginners guide, beginners guide to home assistant, home assistant automation, home assistant guide, home assistant setup, home automation, home automation ideas, homeassistant, how to, install, smart home, smart home automation, smart home tech, smarthome, tutorial, automations, Home Assistant for beginners, geofencing, proximity, somebody home, detect person, switch heating, presence
Id: pjAyRN5UiBg
Channel Id: undefined
Length: 16min 23sec (983 seconds)
Published: Sun Mar 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.