Home Assistant UniFi Integration (HOW-TO)

rootF IMG 60efe1148449e

As an Amazon Associate I earn from qualifying purchases.

Woodworking Plans Banner

after you finish watching this home assistant ubiquity unifi video you'll be able to do presence detection block network access for any clients check bandwidth and uptime sensors and more everything that you will need is home assistant and unified network equipment coming up hello kino fiasco is here let's clear this before we move forward if you have ubiquity unifi equipment but you don't have home assistant check this video and if you have home assistant but you don't have any unifi equipment you can check this video about the unified dream machine which is all in one product if you have both things then we can continue the home assistant unifi integration is rated as platinum that means best of the best possible integration and it also means that it should be super fast and with excellent user experience we are going to verify that by trying to control the unified clients and by doing presence detection from home assistant later in the video we will also create some home assistant unify automations but let's start with the integration first go to configuration integrations it is possible the unified integration to be auto discovered by home assistant in that case you just have to click on configure button of the integration otherwise you should add the unify integration manually which is also super easy add integration and search for unify ubiquity unify and click on it enter the ip of your unified controller in my case it's this one the username or the email that you're using to login the user that you're entering here needs to have administrator privileges in your unified controller for best results and your unified password leave everything else as it is and click submit success click on finish and here it is i have 41 devices and 42 entities click on the options button and here you can fine tune your unifi integration by selecting or deselecting these options keep in mind that some options are only available when advanced mode is enabled on your user profile page i will leave everything as it is i'll only change this from 300 seconds to 30 seconds this is the time that devices will be considered a way now click submit to control network access for clients connected to unify from home assistant you have to add them in the integration here is how you can do it on the next page you can select on which clients you wish to control their network access i want apple tv for example and i'll click submit again and i'll select both of these sensors bandwidth and uptime sensors and i'll click submit again finish as you can see the entities are now a lot more than before we can now add a home assistant cart with a switch to block network access to whatever client we want as well as bandwidth and uptime sensors i can now click on the devices and i'll search for apple tv and i'll click on it and i'll add all of these sensors to my home assistant lovelace i'll move this a bit at and i'm ready i can go to overview and this is my new cart apple tv is currently at home i can block the apple tv network access from this switch the rx and tx that's received and sent megabytes and the current uptime unfortunately the uptime sensor is not working out of the box actually it is working but you have to create another template sensor from it this is how you can do it to fix the apple tv uptime sensor i have to edit my configuration.yaml file a bit this is where the home assistant configuration is stored and i'll add this yellow file actually a new sensor from the platform template with this friendly name this will be the entity name and it will get the current apple tv uptime this this one and it will add several splits to this uptime sensor right here that's it it's not very complicated the important part here if you have a center section you have to paste only the last five rows if you don't have a sensor section add the whole section like i just did and save the file okay go to configuration server controls and restart your home assistant after home assistant is restarted i can edit the cart and i can add the new template sensor i'll search for apple tv uptime here it is and from what you can see here hey if you're new here consider subscribing now let's continue i have a real uptime 13 hours and 36 minutes instead of thousands of weeks from the native uptime sensor i'll just hit save and here it is the uptime sensor is working i can now remove the old one because it brings no value perfect let's create a home assistant person and track this person using the device tracker functionality i'll go to configuration and i'll search for people section i can add a lot of person from this button but i'll edit my current username which is automatically added as a person and i'll click on it and i'll just pick a device to track when this device is at home i'll consider this person at home as well if the device is away this person it will be also away i can add also a picture if i wish and i'll search for my phone here it is i can also add another device trackers like gps trackers that the companion app is having but i'll leave it like that for now and i'll click update beware that presence detection depends on accurate time synchronization between home assistant and unifi controller if time differs you can expect issues so set your clocks right from now on when my phone is at home that means connected to my wifi person kitty will also be at home pretty simple but pretty useful we have presence detection we can control network access and we have sensors in home assistant thanks to the unifi integration the only thing that is missing is smashing the like button for the youtube algorithm if you haven't done that already when you are done with this easy but important task for which i will be thankful forever we can continue further and we can put everything together in an automation i'll go to configuration automations and now add an automation empty automation the name will be if apple tv uptime is 10 seconds and kirio is away you can type whatever you wish the trigger will be state and the entity will be the template uptime sensor that we added before this is the correct one this is the native uptime which is not useful for this automation and the time will be 0 hours 0 minutes and 10 seconds our other condition the condition will be device the device will be my phone and kiryu is not home and the action will be call service switch turn off and the entity will be apple tv switch this switch will be turned off so again if the uptime of the apple tv is 10 seconds and if kirio is not home turn off the apple tv network access switch that's it i'll click save that way you can make any sort of nasty i mean useful automations that blocks internet access of any devices of your choice when something happens at your smart home i'll go to the overview section of home assistant to see what's going on better and i'll disable actually i'll block the apple tv network access from this switch in order to reset my uptime counter and i'll disable the wi-fi on my phone to simulate that person kirito is not at home and after 30 seconds kitty will go away because i said that in the beginning when i configured the unifi integration i'll fast forward this okay person kilo is now away and if i enable the apple tv network access from this switch the uptime counter will be reset from 0 and when it reached 10 seconds this switch will be turned off again so let's see that the counter is started 10 seconds and it's working all conditions of the automation are now met and everything is fine exactly as we wanted great and with that being said make sure that you hit the subscribe like and bell buttons if you enjoyed this video also feel free to add me on twitter by searching for this username i'm trying to post there frequently you can also find me on my discord server as well stay safe and don't forget home smart but not hard thank you for watching and i'll see you next time [Applause] [Music]

pexels photo 106399

As an Amazon Associate I earn from qualifying purchases.

You May Also Like