Closed koldogut closed 2 years ago
unifiprotect documentation unifiprotect source (message by IssueLinks)
Hey there @briis, @angellusmortis, @bdraco, mind taking a look at this issue as it has been labeled with an integration (unifiprotect
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
Might be a dupe of https://github.com/home-assistant/core/issues/65542
If you are seeing am auto discovered instance, try ignoring it and setting back up the integration. Otherwise, we need debug logs.
Nope, I don't know how but after some testing managed to make it work. Unfortunately after rebooting found the same situation again
When trying to configure same authentication error. Double (or triple) checked username and password and is ok
Considering your UniFi Network integration is also giving a 401, I am going to go out on a limb and say you messed up your user somehow. Did you upgrade your UDM Pro or install/setup UID?
I've upgraded my UDM Pro to ver 7.0.20 before upgrading HA
Nevertheless, just after waiting some time (while googling and googling for a similar issue) it finally worked with this message
I've rebooted and seems to continue working, it's like after reseting password it takes some time to persist changes (10 minutes or more) ... weird.
I'll be monitoring the integration behaviour and will come back in case of new errors
2022.2.1 has been released. I'm not sure it will make a difference in this case though, but its worth a shot.
I'm having the same issues even on 2022.2.1, with the latest release of protect (1.21.0), before I went to 2022.2.1 it was working (even on the latest protect 1.21.0) so it really seems like a bug with 2022.2.1.
Please paste in the config entry in .storage/core.config_entries
without the password.
Thanks
Please paste in the config entry in
.storage/core.config_entries
without the password.Thanks
Not sure what you're asking here? Also just so you know I double checked and my authentications are correct.
2022-02-03 20:57:33 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Kirkland' for unifiprotect integration could not authenticate: Request failed: /proxy/protect/api/nvr - Status: 401 - Reason: Unauthorized
so it really seems like a bug with 2022.2.1.
That seems unlikely since the only change was to not auto update the host from discovery when a hostname is configured between 2022.2.0 and 2022.2.1
% git diff -w 2022.2.0..2022.2.1 -- .
diff --git a/homeassistant/components/unifiprotect/config_flow.py b/homeassistant/components/unifiprotect/config_flow.py
index 0890a962e5..39e255bb71 100644
--- a/homeassistant/components/unifiprotect/config_flow.py
+++ b/homeassistant/components/unifiprotect/config_flow.py
@@ -24,6 +24,7 @@ from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.aiohttp_client import async_create_clientsession
from homeassistant.helpers.typing import DiscoveryInfoType
from homeassistant.loader import async_get_integration
+from homeassistant.util.network import is_ip_address
from .const import (
CONF_ALL_UPDATES,
@@ -105,7 +106,11 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
and entry_host != direct_connect_domain
):
new_host = direct_connect_domain
- elif not entry_has_direct_connect and entry_host != source_ip:
+ elif (
+ not entry_has_direct_connect
+ and is_ip_address(entry_host)
+ and entry_host != source_ip
+ ):
new_host = source_ip
if new_host:
self.hass.config_entries.async_update_entry(
so it really seems like a bug with 2022.2.1.
That seems unlikely since the only change was to not auto update the host from discovery when a hostname is configured between 2022.2.0 and 2022.2.1
% git diff -w 2022.2.0..2022.2.1 -- . diff --git a/homeassistant/components/unifiprotect/config_flow.py b/homeassistant/components/unifiprotect/config_flow.py index 0890a962e5..39e255bb71 100644 --- a/homeassistant/components/unifiprotect/config_flow.py +++ b/homeassistant/components/unifiprotect/config_flow.py @@ -24,6 +24,7 @@ from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers.aiohttp_client import async_create_clientsession from homeassistant.helpers.typing import DiscoveryInfoType from homeassistant.loader import async_get_integration +from homeassistant.util.network import is_ip_address from .const import ( CONF_ALL_UPDATES, @@ -105,7 +106,11 @@ class ProtectFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): and entry_host != direct_connect_domain ): new_host = direct_connect_domain - elif not entry_has_direct_connect and entry_host != source_ip: + elif ( + not entry_has_direct_connect + and is_ip_address(entry_host) + and entry_host != source_ip + ): new_host = source_ip if new_host: self.hass.config_entries.async_update_entry(
Not doubting you, just saying that my setup worked fine on the latest protect fine 1.21.0 until I upgraded to 2022.2.1 and stupidly I didnt make a backup so I can't easily roll back. I have tried deleting the integration and adding back in but still no dice.
Not sure what you're asking here? Also just so you know I double checked and my authentications are correct.
2022-02-03 20:57:33 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Kirkland' for unifiprotect integration could not authenticate: Request failed: /proxy/protect/api/nvr - Status: 401 - Reason: Unauthorized
Its in /config/.storage/core.config_entries
It looks like this:
{
"entry_id": "dc657f7eda50345a91592b607a449f20",
"version": 2,
"domain": "unifiprotect",
"title": "Alex UNVR",
"data": {
"id": "Alex UNVR",
"host": "192.168.210.83",
"port": 443,
"username": "homeassistant",
"password": "[SNIP]",
"disable_rtsp": false,
"snapshot_direct": false,
"ir_on": "auto",
"ir_off": "always_off",
"scan_interval": 2,
"verify_ssl": false
},
"options": {
"disable_rtsp": false,
"all_updates": false
},
"pref_disable_new_entities": false,
"pref_disable_polling": false,
"source": "user",
"unique_id": "245A4C546572",
"disabled_by": null
},
that doesnt exist for me (guessing because i deleted the integration and tried to add back in but getting the auth error so it's not in there :( ) Hopefully someone else can who hasn't yet.
Just to confirm, are you using a local user account (https://www.home-assistant.io/integrations/unifiprotect/#local-user) ?
Just to confirm, are you using a local user account (https://www.home-assistant.io/integrations/unifiprotect/#local-user) ?
100%, here's the odd thing, I have my local admin password saved that I use for home assistant to connect to protect, matter of fact, the password works when I log into the UDMP with it. On a random thing, I reset the password for that account on the UDMP and now HA takes it fine (as well as UDMP), not a clue as to why.
I experienced the same behavior today. Updated the 2022.02 when it was released and to this official integration, no issues. Yesterday I updated the Network and Protect apps on my UDMP and things were still good. This morning I restarted Home Assistant and then I was greeted with the same issue as the others here. Updating to 2022.02.1 did not help. I reset the password for my local user, no help. After that I restarted the UDMP completely, as well as Home Assistant, and now it's working fine. I'll be watching it closely over the next couple of days.
Same issue. With 2022.2.2, I was able to get it working by disabling the integration and then enable again. Working for now even after an HA restart.
Please post the contents of the config entry before and after it stops working from /config/.storage/core.config_entries without the password
Please post the contents of the config entry before and after it stops working from /config/.storage/core.config_entries without the password
I am also getting this error. It started around the time migration needed to happen, as 2022.2 was dropping. I had originally held off with the upgrade, but then accidentally clicked the core upgrade BEFORE removing the protect integration from HACS. I subsequently downgraded, followed all steps from upgrading and still had this issue. I then waited a couple hours and decided to try again, upon reboot the integration was working by itself. However, out of nowhere the issue is back. I can say that it seems it's for some reason pulling the wrong IP for my UDM-Pro. I run multiple vlans and it's pulling the one for my IoT vlan (10.100.3.1), even though I set it up with my default gateway IP (10.100.1.1), no idea how it's changing it.
Working after removing the integration, rebooting HA, multiple attempts to re-add integration with the same failure above it finally went through.
That sounds like traffic is leaking from the other vlan so its somehow discovering it.
Can you try cloning this repo https://github.com/bdraco/unifi-discovery , installing with pip3 install --upgrade .
and running aioscanner.py
to see what comes back?
That sounds like traffic is leaking from the other vlan so its somehow discovering it.
Can you try cloning this repo https://github.com/bdraco/unifi-discovery , installing with
pip3 install --upgrade .
and runningaioscanner.py
to see what comes back?
Will do. It just failed again and has auto-changed the gateway again to 10.100.3.1. It not discovering it, just fails.
It not discovering it, just fails.
What does it output?
I'm assuming it has to be working in the integration or it wouldn't be getting updated.
Please enable debug logging (https://www.home-assistant.io/integrations/logger/) for unifi_discovery
and post a log?
I experienced the same behavior today. Updated the 2022.02 when it was released and to this official integration, no issues. Yesterday I updated the Network and Protect apps on my UDMP and things were still good. This morning I restarted Home Assistant and then I was greeted with the same issue as the others here. Updating to 2022.02.1 did not help. I reset the password for my local user, no help. After that I restarted the UDMP completely, as well as Home Assistant, and now it's working fine. I'll be watching it closely over the next couple of days.
Same here, I rarely touch any HA config, except for updating. Updated UDM yesterday and HA, and now I am also getting Unauthorized. Reset the password in UDM but still getting it. Will try rebooting both next.
Rebooting both fixed the problem...
In my case I had to fix permission on local account it was deleted to none .
I'm assuming it has to be working in the integration or it wouldn't be getting updated. Please enable debug logging (https://www.home-assistant.io/integrations/logger/) for
unifi_discovery
and post a log?
Sorry it's been so long since my last reply, I was unexpectedly out of town for several weeks. Absolutely nothing I did worked, if I tried to add it multiple times, it would sometimes add, but then fall off. It was saying my UDM-p was not accepting the login. I started to have some other issues and was able to update to the newest firmware for UDM-P (1.12.13) and I now can use this again with no issues. This had nothing to do with your integration, it was all on my side.
Cheers, john
I'm going to close this now as there are so many unrelated issues encapsulated here, and the original discovery related issue has already been fixed in https://github.com/home-assistant/home-assistant.io/issues/21471
The problem
After upgrading to HA ver 2022.2.0 Unifi Protect integration stoped working and reconfiguration keeps saying invalid authentication. I've tried to change once and again the username and password in Unifi but no luck. No logs or further error information is provided.
I'm running HA core as a docker container and Unifi protect ver 7.0.20 in a UDM-Pro
What version of Home Assistant Core has the issue?
2022.2.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Unifi Protect
Link to integration documentation on our website
https://www.home-assistant.io/integrations/unifiprotect/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response