BaQs / pyEzviz

Python package for ezviz cameras
Apache License 2.0
103 stars 45 forks source link

add support for python 3.10 required by home assistant 2022.7.0 #86

Closed regevbr closed 2 years ago

regevbr commented 2 years ago

HA 2022.7.0 was just released, and they started using python 3.10. It seems that some of the integration works (like RTSP) but I do get errors about SSL that didn't exist in 2022.6.7:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 930, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 652, in async_disable_motion_detection
    await self.hass.async_add_executor_job(self.disable_motion_detection)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/ezviz/camera.py", line 233, in disable_motion_detection
    self.coordinator.ezviz_client.set_camera_defence(self._serial, 0)
  File "/usr/local/lib/python3.10/site-packages/pyezviz/client.py", line 743, in set_camera_defence
    cas_client.set_camera_defence_state(serial, enable)
  File "/usr/local/lib/python3.10/site-packages/pyezviz/cas.py", line 134, in set_camera_defence_state
    my_socket = context.wrap_socket(
  File "/usr/local/lib/python3.10/ssl.py", line 513, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/local/lib/python3.10/ssl.py", line 1071, in _create
    self.do_handshake()
  File "/usr/local/lib/python3.10/ssl.py", line 1342, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:997)

This limits my ability to control the camera (like turning it on/off)

I would appreciate your help on the matter :-)