home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.57k stars 29.91k forks source link

Unifi Protect integration discovers my UDMP that no longer has Unifi Protect running on it #111031

Closed alexruffell closed 2 months ago

alexruffell commented 7 months ago

The problem

I am not sure how the integration discovers instances of Unifi Protect on the network, whether it is by compatible hardware or an instance of the application running on the network. I've had Unifi Protect integrated into HA for quite a while and up until last week Protect was running on my UDMP. I now have a Unifi NVR and I have therefore removed Protect from the UDMP as it now runs on the UNVR.

While I can easily click "Ignore" and forget about this, I wanted to report it in case it was a bug. I would expect the integration to detect the Protect application running, and offer to integrate it pointing to the hardware it is running on (UNVR in my case, not the UDMP). Given the UDMP no longer runs Protect, I am not sure why it wants to integrate Protect on my UDMP even after rebooting (when conditions for the integration offer go away, the integration offer also goes away after a reboot. When I first got this offer Protect was only stopped, but then I uninstalled it too, so I wonder why the integration offer remains).

image image

What version of Home Assistant Core has the issue?

core-2024.2.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Unifi Protect

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifiprotect/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 7 months ago

Hey there @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!

Code owner commands Code owners of `unifiprotect` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign unifiprotect` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


unifiprotect documentation unifiprotect source (message by IssueLinks)

adeathe85 commented 4 months ago

Yep, I'm seeing the same thing. No issues either.

bdraco commented 3 months ago

If I recall correctly the detection works by checking https://github.com/uilibs/unifi-discovery/blob/a539b751c8e343fe50c61a471381599d7c5ea37e/unifi_discovery/__init__.py#L61 to see if it will error, and once protect has ever been installed, the protect proxy url will not error anymore because uninstalling protect still leaves the proxy url in place and unifios never fully cleans up to return it to the original state.

bdraco commented 3 months ago

It looks like newer unifi os always returns a 401 so it always gets detected as available.

I'm not sure there is a way to tell if protect is installed or not anymore

alexruffell commented 3 months ago

@bdraco Unfortunately I cannot remember what I did, however my UDMP is no longer being discovered as a Protect device, only my UNVR. Let me know if you need me to do any test to see why. There is a chance I went into the registry files and removed it there...

bdraco commented 3 months ago

No worries. I think the result here is that the current implementation is the best we can do currently and there isn't a path to improve it based on what we can discover without authentication