JurajNyiri / HomeAssistant-Tapo-Control

Control for Tapo cameras as a Home Assistant component
Apache License 2.0
1.1k stars 88 forks source link

Exception in motorMoveToPreset on Tapo C210 #481

Closed pbtsrc closed 10 months ago

pbtsrc commented 10 months ago

Description

Sometimes when I try to use "Move to Preset" the camera doesn't respond and then just does a full rotation (like after a reboot) and stops at the same position.

Reproduction Steps

Click on Move to Preset and select a Preset from the list

Expected behavior

Camera moves to selected preset

If applicable, add error logs.

Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/commands.py:230 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 09:43:33 (1 occurrences) Last logged: 09:43:33 [546060396736] Error: -60102, Response: {"method": "motorMoveToPreset", "result": {}, "error_code": -60102}

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 106, in async_select_option await entity.async_select_option(option) File "/config/custom_components/tapo_control/select.py", line 832, in async_select_option await self.hass.async_add_executor_job(self._controller.setPreset, foundKey) File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 1486, in setPreset return self.executeFunction( ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pytapo/init.py", line 510, in executeFunction raise Exception( Exception: Error: -60102, Response: {"method": "motorMoveToPreset", "result": {}, "error_code": -60102}

Device Firmware

1.3.9 Build 231019 Rel.13805n(4555)

Integration Version

5.4.12

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

Docker on Raspberry Pi 4 Model B

Search for similar issues

Yes

Additional information

No response

Veda82 commented 10 months ago

I have 2 C200 with the same firmware, and since updating to firmware 1.3.9 I'm seeing strange issues... Sometimes I am not able to move to a preset, restarting homeassistant seems to fix the issue temporarily.

Might be related to #472

JurajNyiri commented 10 months ago

From the integration side this is expected and nothing wrong, camera simply refuses the command, same would happen to the app as it uses the same command. It refused the command with error code -60102.

pbtsrc commented 8 months ago

I think I found the reason for this strange behavior. This only happened when I blocked internet access for the camera using my wifi router's built-in firewall. But by default it only blocks TCP, I added the same rules for UDP and now the camera works as expected.