-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unifi Block Network Access for clients not working #73071
Comments
unifi documentation |
Hey there @Kane610, mind taking a look at this issue as it has been labeled with an integration ( |
Also experiencing this. For me, the problem is not only blocking network access for clients, but enabling / disabling DPI groups and controlling POE has also stopped working. If any of these are toggled in the unifi controller, the switch does seem to be updated in home assistant though. |
Yes, I found the same behaviour. |
+1. |
Appears to be a duplicate of #70910 |
As you stated that it stopped working after 2022.5 at 2022.6.2. Did you by chance upgrade anything in your unifi system? If not. What happens if you downgrade to previous working ha version |
I also upgraded to UniFi OS 1.12.22 at the same time. |
Having same issue the toggle buttons don't have any effect. I also upgraded my udmpro to 1.12.22 today, but i'm still on 2022.5. |
Following - my HA/unifi setup for blocking devices was working on 2022.5, then I upgraded to 2022.6 yesterday and it stopped working. Getting 'received 401 Unauthorized' on block/unblock calls. Seems to be authenticating fine to get device list, etc. when reviewing the config. |
I have the same issue since the last upgrade. the states of the user if have been blocked from unifi updates, but it's not working from HA. |
I'm having the same issue - I'm pretty sure it was due to an UNIFI upgrade, not the HA integration. I say this because I was on vacation last week. Yesterday I tried to block my son's devices and noticed this behavior. HA was still on 2022.0 - I hadn't upgraded it in awhile. My UDM Pro was configured for auto upgrades and I noticed a new version of Unifi OS came out 9 days ago (https://community.ui.com/releases/UniFi-OS-Dream-Machines-1-12-22/851bdc97-fc39-40ef-bd71-786766512c58). Unifi Network version was also not upgraded - not sure which version I was on, but I did upgrade it manually yesterday hoping the issue would be resolved. I also upgraded HA to 2022.6.4, but still no luck. I am going to attempt to downgrade Unifi OS next. I will provide an update soon. [[Update]] |
Same, I downgraded to the previous firmware, but couldn't get the unifi web interface to work, so had to upgrade again |
Has anyone tried removing the home assistant integration and adding it back? |
Yes i removed the integration twice with no luck, but there is one thing has been changed before the name of the entity was switch.name now i saw it switch.name_block |
Yes many times. |
I just upgraded to UDM 1.2.22 on my UDMP and can no longer toggle clients. I've also tried reinstalling the integration without luck. I tried to enable DEBUG logging but it didn't provide any useful info. |
I am getting a 403 back from the UDM
|
I am using an admin and I still always get this 403 error when I try to toggle internet for a device |
I see the same 403 forbidden error as well when I toggle a device on/off in HASS. I didn't see it before because aiounifi debug is a fire hose. configuration.yaml
|
Thank you @johntdyer and @stonith. I should have noticed you had aiounifi set to debug. I was only setting |
So I attached a debugger and got more data from the response , seems the response in the aiounif client when triggering the switch is a |
You are NOT seeing it or NOW seeing it? |
Sorry about that. I corrected it. I am NOW seeing it. |
I setup mitmproxy to inspect the requests. The POST request to toggle the switch uses the same x-csrf-token and cookie token header as all the successful GET requests home assistant makes for retrieving status. Looking for something to compare to that's still working. UPDATE: looks like home assistant isn't updated the x-csrf-token from the login request. If I take the x-csrf-token from the login response and replay the POST request with it, the request succeeds. Even after a restart of home assistant it seems to use an old x-csrf-token. |
I am experiencing the same thing. My HA has a section to control the kids internet. It stopped working, for about two weeks now. I tried removing/adding the integration, as well as resetting password in UniFi, etc. |
Same here. Upgraded to 2022.6.7 and the switches worked. After a few hours I received the 401 errors in my logs. |
Running 2022.6.7 as well and not able to even setup the integration (removed it after I started receiving the 401 errors as well). Running an updated UDMPro.
This log is from trying to re-setup the Unifi Network integration in HA. Receive this error in the UI while trying to re-setup the integration (after removing, rebooting). |
I got the same error everyone else got and it's permanent. The aiounifi version changed as well and there were some other changes. My manual change for 2022.6.6 seemed to have worked better. I'll try and debug this weekend. |
Make sure to update to the latest versions of unifi os and the controller |
Session expiry never gets retried because Manual workaround:
|
I've set this self.can_retry_login = True however i still get same error.
|
That's weird. Both my HA installs no longer have the error and I can see it retry properly. Are you sure you edited the right |
I'm seeing the same behavior as @zee-shany. I only changed the file above (cut and pasted the full path) and restarted HA. The integration will not start, 401 unauthorized. I have not tried removing and re-adding it, was trying to avoid that. |
Sorry all, I mistakenly removed the |
Haven't had any 401 errors since. Can anyone else confirm it's fixed for them with the latest fix? |
i can confirm, I've not had 401 errors too. |
I’m still getting them. Can you please confirm the fix on 2022.6.7 to ensure I have made the right modifications. |
See this comment: #73071 (comment) |
I'm still getting 401s as well. Even after removing the integration and
trying to add it back; no go.
Perhaps an unrelated data point, I added Protect permissions to my Unifi HA
user and added the protect integration with no issue. Also confirmed I can
login using the Unifi HA user from the web UI to the Network interface.
…On Mon, Jun 27, 2022 at 1:20 PM tux43 ***@***.***> wrote:
I’m still getting them. Can you please confirm the fix on 2022.6.7 to
ensure I have made the right modifications.
—
Reply to this email directly, view it on GitHub
<#73071 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABXHH2D4LVFAJFEAX7J32DVRHPGTANCNFSM5X46QSYA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
My HA is 2022.6.7, so far so good, devices are turning off and on as expected. |
I tried this again and second time lucky, it is operational now. I think I had a tab rather than a space on line 131 which was my issue. |
The final fix will be available with the 2022.7 release next week. Beta is coming out later today if you want to try it out |
It looks like this fixed the authentication, but it appears to introduce a race condition where toggling multiple Unifi devices to block or unblock at the same time fails. My scenario is I have a scene with multiple devices set to block (and another where they are unblocked). I've found that if I schedule this to run at a specific time, it runs, but only one of the devices toggles state. I suspect the problem is that the first device tries to toggle, but the token has expired, so gets a 401. It then re-authenticates, retries and succeeds. But the other devices must not retry and and fail to toggle. My work around for this for the time being is to trigger a single unifi toggle in the script, wait a few seconds, then trigger the scene change. To recreate, you'll need a scene with multiple unifi switches set to toggle either on or off. You should find this will work if you toggle manually. To get it to fail you'll need to leave it 12 hours (or whatever the token expiry is) and then toggle the scene. You should see that one of the devices defined toggles and the rest do not. |
@jamespeek the issue of toggling multiple unifi devices from block/unblock state has been there since the longest time in my experience, at least since an year back. Many users have reported that but no fix so far and mostly everyone is using the workaround i.e putting a delay of few seconds before automation blocks/unblocks a device. |
@zee-shany I wasn't seeing this before the api authentication issues associated with this ticket; previously using scenes to unblock/block devices in bulk was working pretty flawlessly for me. I guess the other solution would be to have a scheduled task that periodically pings something on the unifi api side, to keep the access token alive (or refresh it out of band, if need be). |
Same. Having to toggle on off repeatedly a few times with 5-6s pause in between has been there a long time. |
My experience was the same as @jamespeek. I had a group of devices and was turning on/off [block/unblock] the whole group without incident until the 2022.6 update. |
Thought I'd check here, my kids devices (iphones) are not getting unblock in the morning (blocks at 10:00pm and set to unblock at 5:30am through automation with delays of 5s). I've tried removing unifi integration and adding back. The toggle switch for their device works fine if the block is for short duration for e.g 5-10 mins. |
Sounds like WiFi privacy is still turned on for the devices.
Have to disable private addressing for your home network on each iOS device.
…On Tue, Aug 9, 2022, 2:31 AM zee-shany ***@***.***> wrote:
Thought I'd check here, my kids devices (iphones) are not getting unblock
in the morning (blocks at 10:00pm and set to unblock at 5:30am through
automation with delays of 5s). I've tried removing unifi integration and
adding back. The toggle switch for their device works fine if the block is
for short duration for e.g 5-10 mins.
Anyone facing similar issue?
Thanks
—
Reply to this email directly, view it on GitHub
<#73071 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABXHH7YFPFNKHLSTR4IMFDVYH3LZANCNFSM5X46QSYA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Hmm, I can confirm wifi privacy is turned off, their phone can't connect to network with a random mac address. |
This sounds like the same issue I had; my solution was to make my unblock script trigger an unblock event for one device first, wait 10 seconds, then trigger the unblock for all devices. Not directly related to home assistant, but with your kid's iPhones; don't you find that blocking wifi just means the devices switch to cellular data instead or are they purely wifi? I couldn't find anyway to schedule cell access via the parental controls other than just blocking access apps at certain times of the day. |
@jamespeek Thanks for your response. well, luckily for me, my kids aren't given data pakage as yet. so thats not the worry at the moment for me. however I've read about Circle having option to block access over cellular by installing a VPN profile on iphones. but that means you'll have to add another layer of control as compared to just playing with Unifi and HA. |
The problem
I was using Home Assistant to block/unblock an iphone by toggling the switch that comes with the Unifi integration. https://www.home-assistant.io/integrations/unifi#block-network-access-for-clients
I upgraded to Home Assistant 2022.6.2 and UniFi OS 1.12.22 and now although the switch is visible when I switch it off it switches back on again (or doesn't actually change state)
What version of Home Assistant Core has the issue?
2022.6.2
What was the last working version of Home Assistant Core?
2022.5.5
What type of installation are you running?
Home Assistant Container
Integration causing the issue
UniFi Network
Link to integration documentation on our website
https://www.home-assistant.io/integrations/unifi#block-network-access-for-clients
Diagnostics information
file:///home/bhales/Downloads/config_entry-unifi-20bd161d1ddb7b258529bb054e9f4aa0.json.txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: