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
73.43k stars 30.67k forks source link

Unifi Protect Integration does not yet support Protect 3.0.10 #112487

Closed sethkor closed 7 months ago

sethkor commented 8 months ago

The problem

Upgraded to Protect 3.0.10 this morning and the HA integration is broken.

Logger: homeassistant.config_entries Source: config_entries.py:444 First occurred: 7:23:23 PM (2 occurrences) Last logged: 7:23:56 PM

Error setting up entry UNVR for unifiprotect Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 444, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/unifiprotect/init.py", line 105, in async_setup_entry await _async_setup_entry(hass, entry, data_service) File "/usr/src/homeassistant/homeassistant/components/unifiprotect/init.py", line 137, in _async_setup_entry await data_service.async_setup() File "/usr/src/homeassistant/homeassistant/components/unifiprotect/data.py", line 114, in async_setup await self.async_refresh() File "/usr/src/homeassistant/homeassistant/components/unifiprotect/data.py", line 134, in async_refresh updates = await self.api.update(force=force) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/api.py", line 662, in update self._bootstrap = await self.get_bootstrap() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/api.py", line 998, in get_bootstrap return Bootstrap.from_unifi_dict(**data, api=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 120, in from_unifi_dict data = cls.unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/bootstrap.py", line 224, in unifi_dict_to_dict return super().unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 369, in unifi_dict_to_dict data[key] = cls._clean_protect_obj_dict( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 311, in _clean_protect_obj_dict items[key] = cls._clean_protect_obj(value, klass, api) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 289, in _clean_protect_obj return klass.unifi_dict_to_dict(data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/user.py", line 170, in unifi_dict_to_dict return super().unifi_dict_to_dict(data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 360, in unifi_dict_to_dict data[key] = cls._clean_protect_obj_list( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 300, in _clean_protect_obj_list items[index] = cls._clean_protect_obj(item, klass, api) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/base.py", line 289, in _clean_protect_obj return klass.unifi_dict_to_dict(data=data) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyunifiprotect/data/user.py", line 34, in unifi_dict_to_dict data["nodes"] = [PermissionNode(n) for n in parts[1].split(",")] ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: 'readlive' is not a valid PermissionNode

What version of Home Assistant Core has the issue?

core-2024.2.5

What was the last working version of Home Assistant Core?

core-2024.2.5

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/unifiprotec

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

clipse2004 commented 8 months ago

Hey, The guys have enough to do anyway, the topic has already been discussed several times. That's why HA also advises you not to use EA versions. (It concerns me too, though đź‘Ż ) Even if you do a downgrade, it won't work until the new version is released.

Unfortunately, we have no choice but to wait for the release.

See: https://github.com/home-assistant/core/issues/112298

clipse2004 commented 8 months ago

Quick info, it works again for me. I made the change myself ;)

alex-savin commented 8 months ago

@clipse2004 what did you change?

clipse2004 commented 8 months ago

Nothing special, basically only implemented the fix from AngellusMortis. See here https://github.com/AngellusMortis/pyunifiprotect/pull/354/files

However, this is only temporary until the final release and will be overwritten with every core update.

sethkor commented 8 months ago

I downgraded to 2.11.21 and presto it all worked again. Thanks for your quick replies.

Twilek-de commented 8 months ago

Nothing special, basically only implemented the fix from AngellusMortis. See here https://github.com/AngellusMortis/pyunifiprotect/pull/354/files

However, this is only temporary until the final release and will be overwritten with every core update.

As it seems there is only one line to add to make basic functionality working again, maybe this line could be added to the integration if it doesn´t break backward compatability.

Twilek-de commented 8 months ago

Nothing special, basically only implemented the fix from AngellusMortis. See here https://github.com/AngellusMortis/pyunifiprotect/pull/354/files

However, this is only temporary until the final release and will be overwritten with every core update.

Could you give a quick pointer to where to find the right file in the HA installation. I have been looking but I can´t find it.

Vladx71 commented 8 months ago

If you locate your docker container for core, open an interactive session in it, you'll find that file, so you can add this single line

L:

On Fri, Mar 8, 2024 at 11:34 AM Twilek-de @.***> wrote:

Nothing special, basically only implemented the fix from AngellusMortis. See here https://github.com/AngellusMortis/pyunifiprotect/pull/354/files

However, this is only temporary until the final release and will be overwritten with every core update.

Could you give a quick pointer to where to find the right file in the HA installation. I have been looking but I can´t find it.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/112487#issuecomment-1985449267, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3RO2WZHDEBM3RL7PIDWBLYXGH3LAVCNFSM6AAAAABEIV4R52VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBVGQ2DSMRWG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Twilek-de commented 8 months ago

Ok thank you. So that not everyone has to search. The file can be found at /usr/local/lib/python3.12/site-packages/pyunifiprotect/data/types.py in the homeassistant container.

image

plipof commented 8 months ago

Good morning. Any ability to modify this file in home assistant green? Thank you in advance for your time and help.

AngellusMortis commented 8 months ago

EA is not supported. if you do not want your HA to break, do not use them.

home-assistant[bot] commented 8 months ago

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

nevereverandy commented 8 months ago

I downgraded to 2.11.21 and presto it all worked again. Thanks for your quick replies.

How did you downgrade? I can't seem to figure out the process.

shane8750 commented 8 months ago

apt-get install --reinstall --allow-downgrades unifi-protect=2.11.21 -y

would be command, took me a bit to find, easy to revert if anything breaks UDR. Back up stuff to be safe ;)

AngellusMortis commented 8 months ago

Ubiquiti explictly does has stated they do not want users running apt to issue downgrades. Doing so may break your console.

nevereverandy commented 8 months ago

I guess I wait as well.. I'm running HA on a virtual machine on my Synology NAS, and I don't think I have access to that types.py file either... I didn't realize there was an issue with Early Releases. Switched to Official Channel but I guess will have to wait until a new official update comes along?

As a side note, thanks to everyone working on the integrations—I'm a benefactor and appreciate the efforts.

bdraco commented 8 months ago

Downgrading protect is very risky, because UI does not support it and upgrades may do a database migration.

If a database migration happens then you end up writing data in the old format after the downgrade, which can lead to and unrecoverable state or data that never gets cleaned up when you upgrade again because you have data in both old and new formats in the database.

madsci1016 commented 7 months ago

Ok thank you. So that not everyone has to search. The file can be found at /usr/local/lib/python3.12/site-packages/pyunifiprotect/data/types.py in the homeassistant container.

image

Thank you. I knew better. I saw "new Facial detection!" and forgot the rule, and ran to EA to try out that feature. Then wife's like "Why did our automations that use the cameras stop working?" and my heart sank. This got me going once i figured out how to bash into the right container.

plipof commented 7 months ago

Any way to get to /usr/local/lib/python3.12/site-packages/pyunifiprotect/data/types.py if you are running on home assistant green? I apologize for disturbing everyone; I am a new Home Assistant user and doing my very best to learn everything I can. I am extremely appreciative of those who work so hard to make these integrations work and I would happily donate to continued work. Thank you again for the time and help.

AngellusMortis commented 7 months ago

Helping you replace files are put of scope of this issue. EA is not supported. If you want assistance using a EA versions, try Discord or the community forums

plipof commented 7 months ago

Understood. Again, my apologies for bothering you. Thank you for the response and for developing a crucial integration used and depended on by so many in the HA community. Also, I am happy to donate if you would like as a show of appreciation and support.

krajani786 commented 7 months ago

Nothing special, basically only implemented the fix from AngellusMortis. See here https://github.com/AngellusMortis/pyunifiprotect/pull/354/files

However, this is only temporary until the final release and will be overwritten with every core update.

So Total noob... I have HAOS running in a proxmox VM. How do i get this added? is it done through proxmox console for that VM, or Terminal in HA? and then i have no idea what i am typing to even navigate.

andreifinski commented 7 months ago

looks like it's being wiped out or not even applied if you change it within docker container in HassOS, will be patiently waiting for the fix to be merged

CajuCLC commented 7 months ago

looks like it's being wiped out or not even applied if you change it within docker container in HassOS, will be patiently waiting for the fix to be merged

Yep. I am getting the same issue.

andvarga79 commented 7 months ago

Hi guys, I also made the mistake of upgrading protect to EA version and would not like to downgrade. I am running Home Assistant as VM in Proxmox, and it is fully updated, however for me the path /usr/local/lib/python3.12/site-packages/pyunifiprotect/data/types.py does not exist. Can one of you help and guide me? Thanks :)

andreifinski commented 7 months ago

I downgraded - didn't help, welcome to EA-limbo :)

AngellusMortis commented 7 months ago

Can one of you help and guide me?

No. Early Access is not supported. Stop using non-release update channels for HA unless you are okay with it breaking.

rjblake commented 7 months ago

@andreifinski @andvarga79 - this is what I did (do so at your own risk) to get it to work:

from Proxmox VM console:

login
docker exec -it homeassistant /bin/bash
vi /usr/local/lib/python3.12/site-packages/pyunifiprotect/data/types.py

add following below line 512 (DELETE_MEDIA = "deletemedia"): READ_LIVE = "readlive" save file with :wq

rm -r /usr/local/lib/python3.12/site-packages/pyunifiprotect/data/__pycache__
exit
exit

Restart Home Assistant

Notes that this will get overwritten with every core update until it is officially supported

bdraco commented 7 months ago

As this has turned into a support issue, I'm going to close it now as this isn't the right place for this discussion.

If you want help with a setup, you should try our Community Forum: Configuration.

If you have additional questions, feel free to join our Discord chat server.

Thanks! đź‘Ť