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.68k forks source link

Cannot add Unifi Protect integration after updating to 2022.5.x #71422

Closed Dragonpark closed 2 years ago

Dragonpark commented 2 years ago

The problem

When attempting to add the built-in Unifi Protect integration in Home Assistant 2022.5.x (occurs in both .0 and .1), I am seeing the following error: image This error message displays immediately after selecting the integration from the list of integrations, no configuration screen is shown.

What version of Home Assistant Core has the issue?

Core 2022.5.1

What was the last working version of Home Assistant Core?

Core 2022.4.7

What type of installation are you running?

Home Assistant Core

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?

Logger: homeassistant.config_entries
Source: config_entries.py:745
First occurred: 9:15:35 AM (11 occurrences)
Last logged: 9:15:35 AM

Error occurred loading configuration flow for integration unifiprotect: cannot import name 'get_terminal_size' from 'click.termui' (/usr/lib/python3.9/site-packages/click/termui.py)

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

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)


unifiprotect documentation unifiprotect source (message by IssueLinks)

AngellusMortis commented 2 years ago

It is an issue because HA does not fully pin all deps for an integration and there was a breaking change in dep that is used for the CLI interface for pyunifiprotect. I will make a PR to add a constraint to fix it, but as a workaround, you can do inside of your docker container and run the following:

pip install typer>=0.4.1
hazyitsm commented 2 years ago

I'm seeing the same issue, but with a previously working version of Unifi Protect integration (pre 2022.5). Should I go into my HA docker console and run the pip command? I'm running Home Assistant Core 2022.5.1 as a docker container in Unraid. When I run the command as a root user in my container console, I get:

root@UnraidServer:/# pip install typer>=0.4.1 WARNING: The directory '/config/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.

wixoff commented 2 years ago

The upgrade to typer 0.4.1 didn't seem to help me. This is from inside the HA container:

bash-5.1# pip show typer
Name: typer
Version: 0.4.1
Summary: Typer, build great CLIs. Easy to code. Based on Python type hints.
Home-page: https://github.com/tiangolo/typer
Author: Sebastián Ramírez
Author-email: tiangolo@gmail.com
License: 
Location: /usr/local/lib/python3.9/site-packages
Requires: click
Required-by: pyunifiprotect

bash-5.1# pip show click
Name: click
Version: 8.1.3
Summary: Composable command line interface toolkit
Home-page: https://palletsprojects.com/p/click/
Author: Armin Ronacher
Author-email: armin.ronacher@active-4.com
License: BSD-3-Clause
Location: /usr/local/lib/python3.9/site-packages
Requires: 
Required-by: aioazuredevops, aiovlc, apprise, bellows, click-log, click-plugins, Flask, gTTS, mcstatus, micloud, openwrt-luci-rpc, ovoenergy, pyicloud, pykulersky, pymysensors, pyprosegur, pyps4-2ndscreen, python-miio, python-mystrom, python-songpal, pyvizio, pywizlight, pyzerproc, satel-integra, shodan, sucks, surepy, typer, waterfurnace, WSDiscovery

Then after restarting home-assistant, the log:

Logger: homeassistant.setup
Source: setup.py:162
First occurred: 8:22:51 PM (1 occurrences)
Last logged: 8:22:51 PM

Setup failed for unifiprotect: Unable to import component: cannot import name 'get_terminal_size' from 'click.termui' (/usr/local/lib/python3.9/site-packages/click/termui.py)
onedr0p commented 2 years ago

I wanted to chime in and mention I have this problem too and the workaround pip install typer>=0.4.1 did not work. This started happening on Home Assistant 2022.5.0 and it broken the integration I already had set up. I will wait for an update. Thanks!