Automate your Internet with Home Assistant and Unifi
Vložit
- čas přidán 4. 07. 2024
- Automating your internet and network devices has never been easier than with the Home Assistant and Unifi Integration, in this video we go through and show you how to configure the Home Assistant Unifi integration so that you can automatically control any of your network devices connected to your Unifi switch or wireless access points. We also create a basic automation to show you how it works in practice!
If you'd like to support me and future projects:
Patreon:
/ everythingsmarthome
Hardware to run Home Assistant:
Raspberry Pi 4: amzn.to/2Dviwyh
Raspberry Pi 4 Bundle: bit.ly/31TpS6Z
Micro SD Card: amzn.to/3lqBk2v
Micro SD to USB Adapter: amzn.to/2GcAk1P
SSD's: amzn.to/2Pyq5dw
Home Assistant Blue: bit.ly/31RZM4s
Buy Me a Coffee:
www.buymeacoffee.com/EverySma...
Written Article:
everythingsmarthome.co.uk/how...
EVERYWHERE YOU CAN FIND ME:
Everything Smart Home Community Discord:
discord.everythingsmarthome.c...
Twitter: / everysmarthome (@EverySmartHome)
Instagram: / everythingsmarthome
Facebook: / everythingsmarthomeoff...
#homeassistant #smarthome #homeautomation
________________________
Some of the links above are affiliate links, where I earn a small commission if you click on the link and purchase an item. You are not obligated to do so, but it does help fund these videos in hopes of bringing value to you!
0:00 - Intro
0:30 - What you will need
1:24 - Adding a Home Assistant user
2:02 - Adding the Unifi Integration to Home Assistant
3:02 - Configuring Unifi integration for network control
4:19 - Controlling devices through Home Assistant
5:18 - Automation example for Internet scheduling - Věda a technologie
What are you automating on your network? 😎
I also have a switch for turning 5Ghz on/off on my router, which can be very helpful when connecting 2.4Ghz only devices...
im gonne make it to when my phone is on wifi my lights turn on outside for some time and inside
Looking to attch my Unifi G4 Doorbell to Home Assistant, primarily so I can improve how I am alerted wehn it is pressed, the unifi app is very lacking in options to make the event noticeable on the device. Note: Home Assistant may be the way, or may not be, that's why I am here looking!
Exactly what I've been wanting to do. It's like you're reading my mind when you post these tutorials. Thanks!
Haha maybe I am 👀🔮
Fantastic, just what I needed, when I needed it. As always, concise and to the point, with clear instructions. Thanks!!
Thanks Peter!
Thanks for this I was confused on best way to integrate unifi as I've got it running in docker on my NAS, this helped enormously.
The automation example was great. I was able to combine a ton of my automations. An idea for a future video could be automation tips and examples to simplify a person’s current HA automation list.
You're too lovely,
Good and (very) quick review of the most important things.
Then it's just for the rest of us to rewind and learn.
Repetition is the mother of learning :-)
Very good!
Your too kind Hans!
Awesome tutorial! Easy to follow as usual... you make these chores look so easy!! Now I only need someone to sponsor a mini Unify setup... 😅
I switched I think a good year (maybe 2) to Unifi and till this day I never regret. Yes it's expensive but in my opinion more than worth. The options you can do is just unlimited. In the meantime, I already switched from my security gateway to UDM pro (which I use now for camera's around the house and networking)
That’s what I’m looking for!!! Thanks!!
Very impressive. That was a lot of information, clearly explained, in only 8 minutes. Well done!
Thanks my friend!
Great video Lewis...thank you...I have Reolink cameras, and I hate getting alarms from them when we are home, so I got into my cameras and turn off all alarms, and turn them back on when I leave...(a real pain)...I use Unifi with a Unifi POE switch, and Unifi access points...now I will just turn the port on or off with HA...Jame
I am using home presence detection and internet access control for my kids 😁. Many thanks for tips on using options in automations 👍.
Thanks Dragan!!
This is perfect timing, my kids wanted Alexa's in their rooms for Christmas and was hoping to do just this so they wouldn't stay up late listening to music!
Haha now you can! Cheers
Great video mate. Straight to the point, clear and concise!
Thanks buddy!
I will look over my automatations. Have a lot off on/off stuff...... Many thanks for the video!!
Thanks for watching!
Brilliant, I've been leaning towards building an UniFi network instead of my consumer Netgear stuff which has become frustrating at times. With this great video I stopped leaning towards and will dive in as soon as my wife's company can afford it 😁
Haha good luck!
unifi is terrible, stay away, they're getting worse and worse. 2 years ago they completely abandoned their old camera software and now you're required to buy dedicated hardware for nvr. This is like the 5th time they've done similar to that in the past 15 years. They'll do it again. (netgear has always been terrible so makes sense you're looking for stuff)
@@gg-gn3re I’m looking at options now. What alternatives are there that offer the same home assistant integration capabilities, while at the same time being comparable in price and functionality? I’m looking at Omada, but the HA integration seems to be quite behind unifi. Not sure how actively it’s being worked on. I found the snmp integration, which might give similar HA possibilities for almost any gear, but I’m not sure, and would like to be sure before throwing 1000$ at equipment
@@cjrivo pfsense
Thanks Lewis for showing the switch in automation. I didn’t know that. I’m going to rewrite few duplicate automation.
Would you mind creating a walk-throught video about options in automations? I don’t understand like half of them. Thanks!
Thanks Pavol! Sure I'll add it to the list!
Love your videos! Please keep them up. Very tempted to get your new presence sensors to add a whole new level of automation just waiting a little longer to get a decent amount for every room. I was wondering if you may be able to shed some light on a problem of mine. I have a similar unfi setup and i would like to make a button in lovelace to hide/unhide a IOT wifi network. Reason being, some devices need to see the hidden network on first connect and it would be easier to have a lovelace switch than have to go into the unfi controller every time.
Interesting. I didn't know you could control a Unifi network from home assistant. If my numbers ever come up (hopefully today) I'll build a house with a home automation system, and I'll definitely use home assistant and that plugin to control everything, including my network.
Nice, hope your numbers come up!
@@EverythingSmartHome
so do i!
I have a hard time giving anything IoT direct access to my router. But I think the functionality of it is great
How would you go about writing an automation to cut access after a certain time online? Say give the kids 1 hour / day on the internet and add some time if they complete chores, etc.
A much more flexible approach is to create a template binary sensor which switches on and off depending on a condition and then tie an automation to it.
Would you mind elaborating a little?
Hey, thanks for the video. Do you mind to do a video on POE on/off ?
Good walkthrough!
I’ve been using it for a while. The “block device” part always work, but unblock kinda work only when the blocked devices are active.
A powered-off pc, being unblocked by an automation, has no network when powered on.
Anyone else seen this / got a fix for it?
Yeah that's a nasty unifi bug, there are more
Thanks! Hmm I haven't experienced that issue at the moment but will double check it
Access to the settings for the device are only valid when the device is connected to the network, it's not really a bug in Unifi. A PC should remain connected even when shut down (Power needs to be on of course) as the NIC card in most PC's remain active listening for WOL (Wake on lan) commands. Perhaps look at your BIOS to enable WOL, this should keep your PC 'connected' to the network, even when it's shut down.
I did just this to disable the kids fire sticks over night. However it sadly didn’t work very well as the firesticks didn’t seem to want to reconnect again after. Great vid though really useful
Swap their vlan?
can you make a video about all the sensors and automations you have in your house? i already know about one thing that i would never have thought about, the weight sensors in your bed. what else do you have?
I love your office colour did you do a video of it?
I need to set my Wi-Fi to schedule on and off to make sure the kids aren’t up late on devices. I have two ac pros but no controller and I am wondering if should go down this route or get a tp-link with homecare built in. Any advice would be appreciated.
Had an issue with my unif integrations since 2fa ! On my todo list to fix
The ever growing Todo list 😅
I saw a few Kasa products, Can you use the unifi platform to switch on/off the Kasa products? or is this strictly for network manipulation (internet access, poe switching)
I would really love a way to set a counter for my son's tablet. So he can have say, one hour a day, but not having the counter counting if he's not using it. Haven't quite figured out how to do that. I think there's some counter functions in node red, but if his tablet is always connected to the wifi it could get tricky I think.
The HA app on the tablet would tell you screen on status; I'd use that to increment a counter, then at 6am a simple process to reset the counter. I'd do all this in NodeRed. Add in that if the app is not reporting, then no internet (It'll make sure he keeps the HA app installed)
HI Lewis, I have this strange problem using the Unify integration. It pulls in all the sensors but all off them are switching home/not-home every 5 seconds. I can't seem to find what I did wrong or find others with the same issue I have. Any pointers from your side perhaps?
So weird that now I've got Unifi wifi, I needed something like this - have you been looking at my search history or something? 😁👍
Haha nooooo....👀
@@EverythingSmartHome Eek lol! My only task next is to install it on a Pi or something - the TrueNAS version just isn't very up to date at all.
Only an update, installed on Pi now and see more options in HA. Doing a test ban as I type! Thanks again 👍
Hi, thanks for the excellent video.
I am using an old Sysco poe switch and router, works great but does not have the nice features you mentioned. I am thinking of stepping into the Unify world but first have to inform myself how to setup, etc. It would be so excellent if you would like to put the Unify solutions under the magnifying glass.
(I know there is a lot out there but i am very interested in your opinion.)
It's a though question you are asking, there are just too many things to cover. Plus you need to have a decent knowledge of networking. As unifi is really professional material, I would have a look at this guy czcams.com/video/f_-iuY_xxFY/video.html Hopefully it helps you to start, depending what you wanna do but if you staying basic go for the unifi security gateway, you also need a unifi cloud key (this is where unifi stores the network configuration, you can use a rasp pi or your computer, just keep in mind that this device always need to be on otherwise unifi don't know how your network is configurated.
@@elvisv.3170 Thanks. To be able to create the "ideal" setup requires gathering knowledge. There is some good stuff out there but still, it is a lot of learning and testing.
Is it possible to schedule this script to run Mon-Fri and then have different curfew settings for Weekend?
Is there a what to shutdown or reboot the UDM Pro from home assistant within the official addon? I would like to do so based on when my UPS turns on. I tried using the RPC shutdown add-on but it says connection refused to the IP address but the credentials match the new super user I created
Is it possible to automate the unifi backup? And if yes, is it also possible to store the backupfile on a NAS in stead of the cloudkey of UDM drives?
Dude your channel is gold!!!, any chances that I can activate "guest mode" by detecting if there are wifi connections to my guest network?
Can I do that using a unifi access point?.
Planning on upgrade my network but I wanted the main firewall to be pfsense
Thank you sir! Sure you could do that!
How different would a ddwrt custom integration be?
Great Video Lewis. I followed along and was able to expose the network and POE switches. However when I toggle them off in HomeAssistant they automatically toggle on again after 1 second. Any ideas whats wrong here? Possibly a permissions isssue?
Cheers Dave! It's just UI bug, if you check in the Unifi console you'll see that they are turning off (or at least should be) and the state in Lovelace will update after a little while
How do you get the controller’s hostname?
Is it possible to turn the guest wifi on and off in Unifi like in AVM integration?
Do you have an option to do DND on Unifi Talk?
Hi - wow amazing things that you do with HA and Uni... I just found your channel and I subscribed. QUESTION: Have you done anything on notification on your guest network? I am looking for a way to get notified when there is a guest on my guest network. Hope you have some suggestions /Johnny
Everyday's a school day... :-) Thanks useful as always.... so whens the follow up video titled "how to clear up the extra 400 entities you've just added whilst not paying attention"
That's next week's video 😂
Liking the videos. You delved into Node Red yet?
Thanks buddy! I have indeed, I'm not a NodeRed person personally I prefer Home Assistant automations, but I'd recommend The Hookups videos if your looking for some resources on NodeRed, he does a great job.
whats the best way to approach implementing on the dashboard the ability to toggle extra time for a group of devices? say 30/60mins, I have a mind blank lol
Has the switch feature been turned off? I can get sensors and trackers to show but no switches for unifi devices.
Hello, not sure if this has changed, I don't the Ubiquiti Unifi integration it's called Unifi Network. I only get a default configuration where all the devices have RX, TX, and uptime data. Basically useless. Any idea what happened?
Seems like the POE option doesn't come on anymore? I have a couple of G4's and one G5. Everything is on POE, but no option in hass. Everything is up to date on today's latest versions. Any help?
if possibe pls make a video on external watchdog for home assistant
Just watch out for a bug in the Unifi controller that results in some blocked devices occasionally not being able to be unblocked (the appear to be unblocked but cannot pass traffic) - you then need to do a controller reboot to remove these orphaned blocks. I have tried explaining this problem to Ubiquity but they just could not understand the issue.
Thanks for the heads-up...that sounds about right!
Why haven't I thought of this? Perfect for disabling my Google Home speakers when no one's home so they can't be hacked by lasers to unlock my front door 🙂
Great idea!!
I would like to be able to turn off notifications from a Unifi Protect camera whenever my phone is connected to the same Wifi AP as the camera, and then turn it back on again when I leave.
Would that be possible to achieve? I don't want to turn the camera completely off or stop recording, just stop bugging me that it detects a movement when that movement is from me :)
im stuck in "host" section now... Do you have any updated vid? thanks
Great video as always! Is there a way to name a group of devices (example "kids devices") and be able to turn their internet connection off/on at the same time? Also, what would the steps be to be able to have Alexa/Google turn on/off "kids devices" with a voice command? Thanks!
To do that I would suggest using Node-Red. Much easier to map out and call the different actions.
You could simply create a group of the switches, search the home assistant integration site for "group".
Then if you check out the Google home and/or Alexa video then you will see how to add them and use scripts 😅
What kind of automation do you have in the kitchen and bed room?
Lights, sensors, motion just all the usual really!
Creating a new user has changed in UniFi OS since your video, and I am unsure how to progress?
Hi, what you need to do is the following. Change the UI to the old legacy mode. Then in the old UI go to settings -> admins. There you can create a local user without email etc. When done change back to the new UI. You now have a user you can use for the integration.
I have a question I can't seem to find an answer. The question is: can you set Amazon devices on a VLAN that can't touch the internet but is still accessible to home assistant? The main focus of this would be to have smart speakers that only respond to home assistant commands locally. Amazon echo devices are relatively inexpensive and I'd love to utilize them.
Currently I don't have a way to test this. But would love to find out so I can convince my wife that we need a Unifi network.
Thanks All!
I had a look around, but it seems pretty much any other router system has a way more basic any less featured integration so is Unifi the only way to go for access control and similar features to implement some form of parental control with home assistant? I'm pretty disappointed by the super barebones support of openwrt..
Failed to connect. Should unifi controller and HA be on the same network? I have unifi on main and HA on my IOT VLAN.
Ok I have made a firewall role but now I get "Invalid authentication"
Can't seem to get it to work, not HomeAssistants fault though. Anyone got wired blocking working with Flex Mini switches? It says blocked in the Unifi Controller and it disappears from the client list but traffic is still flowing.
Perhaps worth noting: I didn't see the steps 1, 2, 3 when configuring the Unifi options. In order to get those I had to turn on the "advanced mode" in my user's profile in home assistant.
Which version of the controller are you using, is it an older version?
@@EverythingSmartHome Kind of. I am using v6.1.71 for the Unifi controller and core-2021.10.6 for the home assistant. But I don't think it's a problem with the version. I guess you just had home assistant configured in advanced mode for yourself. And since I am a home assistant newbie and the default configuration doesn't use the advanced mode setting, I didn't get these options when setting up the unifi integration.
Advanced mode no longer exists in the newer version of controller so that's why it wasn't mentioned (at least as far as I'm aware)
Is it possible to activate or deactivite Wifis in Unifi Controller with a button in HOme Assistant?
So i mean guest wifi that i have, than i can deactivate it with home assistant when no guests here and activate it when guests coming
No, not at the moment. The integration controls client device connection, not the entire WiFi network. If you had two AP's you could make one the Guest only, then you could POE port disable that only using the integration perhaps.
We ended up exchanging this model for the slimmer version czcams.com/users/postUgkx0jZ_lGlDVJhDnmagEU8gn47cmfPNlLQU because it was too wide for the only door trim area that made sense to mount it on. However, we should have just noted the dimensions prior to purchasing. Otherwise, we love the doorbell. It works perfectly, and the video is very clear, even at night.
Makes me wish I bought a Unifi system rather than my Netgear router I purchased a month ago.
It's possible they have a similar functionality I guess?
@@EverythingSmartHome this router kind of sucks. Lol. I was using one with DD-WRT which was great for control. But I didn't have it on a surge protector and we had a surge, so it fried. Bought the new router in a panic and didn't do enough research. I can't use custom firewall rules or anything which is the biggest let down
I love my Unify Switches, AP's and Pfsense Router!
Brilliant Video, I have the UDM and on my hosted home assistant instance when I put the IP address of my UDM in it fails to connect. Is there something I’m missing?
Thanks! Did you double check which port you are using?
@@EverythingSmartHome Its actually Invalid Authentication error I am getting. I created the Homeassistant local account and its showing as active in my portal.
@@smokie365 I just got it to work on my UDMP - use port 443. 8443 gives the error you describe.
@@EverythingSmartHome FYI, UDMP needs to use port 443 (not 8443), otherwise you see the error in the thread below: Invalid Authentication
Any ideas why I'm having the issue of "Error retrieving data from Unifi Protect." I can log in to the URL with the usernamne I've provided
Permissions possibly?
Hey, so there was a unify controller integration for HA at some point, but it didn't work. afaik it had something to do with CPUs architecture(?), but i've heard that some can use it in a docker? how can this be or am i totally lost in the track :D it'd be so cool to have controller running on HA, but seems like it's not happening anytime soon if using RPI as HA server HW...
The Unifi controller is a Linux based application, It can run on Windows because it's installed in a wrapper. If you are running HA on a Window's machine, the ingress version will not run. I run the Unifi controller in a docker container on my Synology NAS, it's works really well with no issues (We no issues that are installation based, but Unifi does have a lot of bugs.....)
@@dougle03 whoop, forgot to mention some crucisl info 😅 but i have my HA running on RPI 4, no docker or any of that. Straight forward HA installation
@@44jese Then the ingress add-on should work. Perhaps raise a ticket?
@@dougle03 i'll look into it. HA had an integration for unifi controller but afaik it was canceled since it was not compatible with RPIs CPU architecture (afaik).
I would like to start the UniFi camera recording when I am not home, but unfortunately that’s impossible. The cameras are not Poe, so I can’t cut their power supply, the only thing I can do it would be disconnect them from wifi when I am home, and re enable the connection when I’m out. Don’t know if this is ok for my goal.
Yeah that is a good workaround IMO!
I’d like to do this but set my internal cameras to record on motion when we are away. Is this possible yet?
Is there a simple way to turn the guest network on and off in unifi from home assistant yet?
A year later - but still looking for this! Have you found any way?
@@ThisIsAitch Nope. Sorry.
Has anyone managed to control the PoE for Unifi APs via the home assistant? Because I am able to switch on/off PoE for a third party device, but for my three Unifi access points I don't get the options to control network and PoE 😞
I even updated to the Unifi controller software 6.4.54 and my USW-Pro-24-POE and the three nanoHD access points run with the latest firmware.
Oh, what a pitty, I just read this note in the documentation of the Unifi integration at home assistant: "Note: UniFi infrastructure devices such as access points and other switches are not (yet) supported, even if they are powered over ethernet themselves." This is so sad. I had hoped for a solution like this (or an integrated one in the switch) in order to turn off the APs at night and save some energy.
How do you add a local account to a cloud key? The options dont seem to be there. It is insisting I invite the user via email. When I set up the integration to HA with my existing Admin credentials (without adding a homeassistant account) , I toggle the switches from on to off they just go back on thus not blocking the device.
The device I used in this video was on a cloud key so if you follow the steps there you should get it
@@EverythingSmartHome - yeah so is mine. I even upgraded to the lastest fw and unifi on the cloud key just to make sure that there wasn't something in a new release or something. I've got the HA integration working with my admin account and setup a wifi device with a switch but for some reason every time I turn the switch from on to off it switches back and doesn't ban the device.
Can you block unifi from accessing the internet and sending data to its home?
Sure depending which firewall you have should be a straight forward process
Has anybody had any success with this using the non-Pro UDM? I follow all the steps but never get to see the extra switch to control access.
I don't have a UDM at all, this is just a regular AP and standalone switch
Why home assistant use huge wifi data(2gb per hour) .how can I reduce it. I run home assistant in windows
Depends on what you have connected to it. Do you have cameras?
Hello Lewis,
This is awesome, since last week I bought a Unifi system (USG+USW+U6), I already did some testing with presence detection.
My question is related with UniFi Controller that is running on my PC, if I close it I also close UniFi Controler, do you have UniFi Controler running 24/7, or eventually on a RPi? what are you doing to maintain UniFi Controler always on?
Tks
Run the controller on a machine that's always on. A Ras Pi is a good option for this. I run my controller on my NAS which is always on.
Right after I buy an omada switch...
Haha timing! I'm sure there is probably a similar way to do it!
@@EverythingSmartHome the omada SDN controller doesn't have an official integration for HA, and the only unofficial one I could find supports getting data of wireless clients only.
I suppose it would be interesting to form the unifi integration for omada since the hi are so similar, however I am caught up in other projects.
Hopefully as they get more popular an official integration will happen!
@@EverythingSmartHome I hope you are right!
Cutting the power from a unifi device just calls for a bricked unit.
Where did we cut the power to a Unifi device?
@@EverythingSmartHome maybe he means cutting POE power from a Unifi camera, for example?
Yeah, but that is absolutely fine and it's the only way really to shut them down...not sure what he's referring to 😅
A power outage to the house will cut the power anyway, unless there is a UPS. All devices (at the very least the embedded ones) should be designed to handle an unexpected power loss gracefully.
I don't get why he's always closing his eyes... kind of creepy.
Hard to believe but he is a human being who needs to blink. Also a few extra bright lights shining right into your face don't help.
It's kind of annoying that he breathes regularly too... 🤣
Never noticed
@@RokyBalboa7 No way! I think he is adding it in post-production.
Sub 💪
🙌
@@EverythingSmartHome love your videos , very informative and converting me ! Would you set up a ring bell for a family member, like a future bro inlaw
Thanks for the support! Appreciate it! I don't have or use ring sorry, not a fan
@@EverythingSmartHome spoken like a true tech 👏! Would guess you have a VW if you are into technology and efficency?