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.21k stars 30.57k forks source link

Amcrest integration doesn't work on macOS #47472

Closed ahknight closed 3 years ago

ahknight commented 3 years ago

The problem

When I try to use the Amcrest integration on macOS, I get an error about undefined attributes.

What is version of Home Assistant Core has the issue?

core-2021.3.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Amcrest

Link to integration documentation on our website

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

Example YAML snippet

# Put your YAML below this line
amcrest:
  - host: garage-camera.lan
    username: !secret amcrest_user
    password: !secret amcrest_password

Anything in the logs that might be useful for us?

# Put your logs below this line
Logger: homeassistant.setup
Source: components/amcrest/__init__.py:7 
First occurred: 1:39:32 PM (1 occurrences) 
Last logged: 1:39:32 PM

Setup failed for amcrest: unknown error
Traceback (most recent call last):
  File "/Users/ahknight/.virtualenvs/hass/lib/python3.8/site-packages/homeassistant/setup.py", line 166, in _async_setup_component
    component = integration.get_component()
  File "/Users/ahknight/.virtualenvs/hass/lib/python3.8/site-packages/homeassistant/loader.py", line 491, in get_component
    cache[self.domain] = importlib.import_module(self.pkg_path)
  File "/usr/local/var/pyenv/versions/3.8.1/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/ahknight/.virtualenvs/hass/lib/python3.8/site-packages/homeassistant/components/amcrest/__init__.py", line 7, in <module>
    from amcrest import AmcrestError, Http, LoginError
  File "/Users/ahknight/.virtualenvs/hass/lib/python3.8/site-packages/amcrest/__init__.py", line 14, in <module>
    from .http import Http
  File "/Users/ahknight/.virtualenvs/hass/lib/python3.8/site-packages/amcrest/http.py", line 53, in <module>
    (socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, KEEPALIVE_IDLE),
AttributeError: module 'socket' has no attribute 'TCP_KEEPIDLE'

Works on Linux. I presume it's a porting issue and that support for that socket option just needs to be tested before being requested.

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

amcrest documentation amcrest source (message by IssueLinks)

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

Hey there @pnbruckner, mind taking a look at this issue as its been labeled with an integration (amcrest) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

ahknight commented 3 years ago

FWIW, I commented out that line and that's enough to let it work. Probably not the ideal solution, but that's the only issue.

pnbruckner commented 3 years ago

That was fixed in amcrest package release 1.7.1 back on April 19, 2020. Unfortunately the integration's manifest.json file was never updated to use that new version; it still specifies 1.7.0. I'd think it would be a simple change to resolve this issue. You might try changing the file temporarily yourself (I mean in your installation) to see if it resolves the issue for you.

ahknight commented 3 years ago

Yes, it does. So how do we go about updating that manifest file?

pnbruckner commented 3 years ago

I'll work on it.

pnbruckner commented 3 years ago

@ahknight, looks like the fix is in 2021.3.2.

ahknight commented 3 years ago

Thanks!