Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for C1C PIR #31

Closed
olekbruks opened this issue Feb 6, 2021 · 6 comments
Closed

Support for C1C PIR #31

olekbruks opened this issue Feb 6, 2021 · 6 comments

Comments

@olekbruks
Copy link

Hi,

I've installed HACS package ha-ezviz (v. 0.0.2.7, which uses pyezviz v. 0.1.6.1) in Home Assistant and noticed that attempting to connect to my Ezviz account with only one camera (C1C PIR) throws an exception.

It looks like that the library doesn't support this camera model or (any?) non-battery powered camera without sensibility adjustments. This option is not available in the official Ezviz app.

Home Assistant log:

2021-02-03 22:27:10 WARNING (MainThread) [homeassistant.config_entries] Config entry for ezviz_cloud not ready yet. Retrying in 80 seconds
2021-02-03 22:28:32 ERROR (MainThread) [custom_components.ezviz_cloud.coordinator] Unexpected error fetching ezviz_cloud data: 'support_sensibility_adjust'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 144, in async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/ezviz_cloud/coordinator.py", line 39, in _async_update_data
    return await self.hass.async_add_executor_job(self._update_data)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ezviz_cloud/coordinator.py", line 31, in _update_data
    cameras = self.EzvizClient.load_cameras()
  File "/usr/local/lib/python3.8/site-packages/pyezviz/client.py", line 270, in load_cameras
    camera.load()
  File "/usr/local/lib/python3.8/site-packages/pyezviz/camera.py", line 34, in load
    if self._device['supportExt']['support_sensibility_adjust']:
KeyError: 'support_sensibility_adjust'

BTW, great work!

@BaQs BaQs mentioned this issue Feb 7, 2021
Closed
@RenierM26
Copy link
Collaborator

Hi @olekbruks,

Would you mind testing the latest release of the pyezviz api? I haven't tested it on my ha-ezviz integration yet....will need to do that before bumping the version.

@olekbruks
Copy link
Author

Now it can connect and stream! I'll test other features in a few days.

@olekbruks
Copy link
Author

olekbruks commented Feb 10, 2021

Hi,

I've noticed similar issue when using Home Assistant feature: Picture Entity Lovelace card with camera selected as an entity and "auto" selected as a camera mode.

Callstack indicates that this is also a problem with detection sensibility: in camera.py#status -> camera.pydetection_sensibility -> client.py#get_detection_sensibility

Full log:

Logger: custom_components.ezviz_cloud.coordinator
Source: custom_components/ezviz_cloud/coordinator.py:31
Integration: Ezviz (documentation)
First occurred: 10 lutego 2021, 21:04:22 (6 occurrences)
Last logged: 10 lutego 2021, 23:08:53

Unexpected error fetching ezviz_cloud data: Could not access Ezviz' API: HTTPSConnectionPool(host='ieu.ezvizlife.com', port=443): Read timed out. (read timeout=15)
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 531, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 735, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 447, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 336, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='ieu.ezvizlife.com', port=443): Read timed out. (read timeout=15)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pyezviz/client.py", line 712, in get_detection_sensibility
    req = self._session.post(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='ieu.ezvizlife.com', port=443): Read timed out. (read timeout=15)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 144, in async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/ezviz_cloud/coordinator.py", line 39, in _async_update_data
    return await self.hass.async_add_executor_job(self._update_data)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ezviz_cloud/coordinator.py", line 31, in _update_data
    cameras = self.ezviz_client.load_cameras()
  File "/usr/local/lib/python3.8/site-packages/pyezviz/client.py", line 357, in load_cameras
    cameras.append(camera.status())
  File "/usr/local/lib/python3.8/site-packages/pyezviz/camera.py", line 137, in status
    "detection_sensibility": self.detection_sensibility(),
  File "/usr/local/lib/python3.8/site-packages/pyezviz/camera.py", line 56, in detection_sensibility
    result = self._client.get_detection_sensibility(self._serial)
  File "/usr/local/lib/python3.8/site-packages/pyezviz/client.py", line 724, in get_detection_sensibility
    raise PyEzvizError("Could not access Ezviz' API: " + str(err)) from err
pyezviz.client.PyEzvizError: Could not access Ezviz' API: HTTPSConnectionPool(host='ieu.ezvizlife.com', port=443): Read timed out. (read timeout=15)

V. 0.1.6.6 has the issue.

@RenierM26
Copy link
Collaborator

Hi @olekbruks ,

I have added a "timeout" setting to the integration with a default of 15 seconds. Could you please try increasing it to say 25 ? It's available under the integration options.

The "detection sensitivity" query is forwarded by the ezviz cloud servers to the device iteself and often times out within 15 seconds.

@olekbruks
Copy link
Author

Unfortunately this won't help, anyway the request/response ends in something about 2 seconds.

@olekbruks
Copy link
Author

OK, it looks like that the issue was resolved in version 0.1.7.4. Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants