Hello @RenierM26,
I am trying some new services now and noticed an issue while enabling / disabling the motion detection on one camera (model C4s). This issue does not occur for others.
Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/ezviz_cloud/camera.py:294
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 16:33:27 (4 occurrences)
Last logged: 18:27:05
[1728320008] Error handling message: Unknown error
[1724931688] Incorrect IV length (it must be 16 bytes long)
[1724931688] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 527, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 571, in async_disable_motion_detection
await self.hass.async_add_executor_job(self.disable_motion_detection)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, *self.kwargs)
File "/config/custom_components/ezviz_cloud/camera.py", line 294, in disable_motion_detection
self.coordinator.ezviz_client.set_camera_defence(self._serial, 0)
File "/usr/local/lib/python3.9/site-packages/pyezviz/client.py", line 739, in set_camera_defence
cas_client.set_camera_defence_state(serial, enable)
File "/usr/local/lib/python3.9/site-packages/pyezviz/cas.py", line 148, in set_camera_defence_state
cipher = AES.new(aes_key, AES.MODE_CBC, iv_value)
File "/usr/local/lib/python3.9/site-packages/Crypto/Cipher/AES.py", line 232, in new
return _create_cipher(sys.modules[name], key, mode, args, kwargs)
File "/usr/local/lib/python3.9/site-packages/Crypto/Cipher/init.py", line 79, in _create_cipher
return modes[mode](factory, kwargs)
File "/usr/local/lib/python3.9/site-packages/Crypto/Cipher/_mode_cbc.py", line 287, in _create_cbc_cipher
raise ValueError("Incorrect IV length (it must be %d bytes long)" %
ValueError: Incorrect IV length (it must be 16 bytes long)
Same on BC1C CAMERA with HA and Ezviz integration:
When calling service to disable motion detection, error message ValueError: Incorrect IV length (it must be 16 bytes long)
Hello @RenierM26, I am trying some new services now and noticed an issue while enabling / disabling the motion detection on one camera (model C4s). This issue does not occur for others.
Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/ezviz_cloud/camera.py:294 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 16:33:27 (4 occurrences) Last logged: 18:27:05
[1728320008] Error handling message: Unknown error [1724931688] Incorrect IV length (it must be 16 bytes long) [1724931688] Error handling message: Unknown error Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 527, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1260, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 363, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 381, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 584, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1495, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1530, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 209, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 663, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 896, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 700, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/camera/init.py", line 571, in async_disable_motion_detection await self.hass.async_add_executor_job(self.disable_motion_detection) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, *self.kwargs) File "/config/custom_components/ezviz_cloud/camera.py", line 294, in disable_motion_detection self.coordinator.ezviz_client.set_camera_defence(self._serial, 0) File "/usr/local/lib/python3.9/site-packages/pyezviz/client.py", line 739, in set_camera_defence cas_client.set_camera_defence_state(serial, enable) File "/usr/local/lib/python3.9/site-packages/pyezviz/cas.py", line 148, in set_camera_defence_state cipher = AES.new(aes_key, AES.MODE_CBC, iv_value) File "/usr/local/lib/python3.9/site-packages/Crypto/Cipher/AES.py", line 232, in new return _create_cipher(sys.modules[name], key, mode, args, kwargs) File "/usr/local/lib/python3.9/site-packages/Crypto/Cipher/init.py", line 79, in _create_cipher return modes[mode](factory, kwargs) File "/usr/local/lib/python3.9/site-packages/Crypto/Cipher/_mode_cbc.py", line 287, in _create_cbc_cipher raise ValueError("Incorrect IV length (it must be %d bytes long)" % ValueError: Incorrect IV length (it must be 16 bytes long)