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

Pan/Tile and Preset control not working for C210 in an offline env #432

Closed
t0ny-peng opened this issue Oct 29, 2023 · 11 comments
Closed

Pan/Tile and Preset control not working for C210 in an offline env #432

t0ny-peng opened this issue Oct 29, 2023 · 11 comments
Labels
Invalid Bug/Enhancement not related to integration or already available.

Comments

@t0ny-peng
Copy link

t0ny-peng commented Oct 29, 2023

Description

I'm using the Tapo C210 camera in an offline environment, where the access to the Internet is blocked for the camera to protect privacy. However, while video streaming feature works perfectly fine, I'm not able to control the camera using the following buttons. To use these buttons, I have to disable the firewall deny rule on my router.

However, I tried installing pytapo locally and the pan/tile control as well as the preset works just fine

In [10]: tapo.getPresets()
Out[10]: {'1': 'Entrance', '2': 'Sliding Door', '3': 'Backyard'}

In [11]: tapo.setPreset("1")
Out[11]: {}

In [12]: tapo.setPreset("2")
Out[12]: {}

Buttons that don't work in HA

image

Reproduction Steps

  1. Block the internet access of one camera
  2. Try to click the buttons in the integration page
  3. Nothing happens
  4. Restore the Internet access
  5. Then the buttons work

Expected behavior

I'd like to control the cameras even in an offline environment.

If applicable, add error logs.

No response

Device Firmware

1.3.7 Build 230823

Using stream component

No

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

Yes

HASS Environment

HAOS

Search for similar issues

Yes

Additional information

The attributes:

access_token: XXXXXXXX
model_name: C210
brand: TP-Link
motion_detection: on
ffs: false
device_type: SMART.IPCAMERA
device_model: C210
device_name: C210 2.0
device_info: C210 2.0 IPC
hw_version: 2.0
sw_version: 1.3.7 Build 230823 Rel.55314n(5553)
device_alias: Backyard 1
avatar: camera c212
longitude: 0
latitude: 0
has_set_location_info: 0
features: 3
barcode: 
mac: 78-8C-B5-XX-XX-XX
dev_id: XXXXX
oem_id: XXXXX
hw_desc: 00000000000000000000000000000000
is_cal: true
alarm: off
user: admin
presets: 
'1': Entrance
'2': Sliding Door
'3': Backyard

record_plan: 
sunday: '["0000-2400:2"]'
monday: '["0000-2400:2"]'
tuesday: '["0000-2400:2"]'
wednesday: '["0000-2400:2"]'
thursday: '["0000-2400:2"]'
friday: '["0000-2400:2"]'
saturday: '["0000-2400:2"]'

entity_picture: /api/camera_proxy/camera.backyard_1_hd_stream?token=XXXXXXXXXX
icon: mdi:cctv
friendly_name: Backyard 1 HD Stream
supported_features: 1
@t0ny-peng
Copy link
Author

possible related error log:

2023-10-29 12:40:40.953 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140410061519808] 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 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2049, 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 828, 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 1031, in setPreset
    return self.executeFunction(
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 161, in executeFunction
    raise Exception(
Exception: Error: -60102, Response: {"method": "motorMoveToPreset", "result": {}, "error_code": -60102}

@t0ny-peng t0ny-peng changed the title Access to Internet is required for Pan/Tile control Preset control not working for C210 in an offline env Oct 29, 2023
@t0ny-peng t0ny-peng changed the title Preset control not working for C210 in an offline env Pan/Tile and Preset control not working for C210 in an offline env Oct 29, 2023
@t0ny-peng
Copy link
Author

Possible error log related to the "Move Up" button

2023-10-29 12:48:54.408 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140410100196800] Error: -60102, Response: {"error_code": -60102}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2012, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2049, 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/button/__init__.py", line 124, in _async_press_action
    await self.async_press()
  File "/config/custom_components/tapo_control/button.py", line 162, in async_press
    await self._hass.async_add_executor_job(self._controller.moveMotor, 0, degrees)
  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 663, in moveMotor
    return self.performRequest(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pytapo/__init__.py", line 213, in performRequest
    raise Exception(
Exception: Error: -60102, Response: {"error_code": -60102}

@JurajNyiri
Copy link
Owner

This integration works fully locally, there are no internet requests. Check your network setup.

@JurajNyiri JurajNyiri added the Invalid Bug/Enhancement not related to integration or already available. label Oct 29, 2023
@reaperthc
Copy link

reaperthc commented Feb 1, 2024

Hi, I have the same issue that is described here and the same setup. I am using an Asus router to disable the internet connection for the camera. when I do this the camera works ok for a couple of hours and then it starts to randomly recalibrate, and from time to time refuses movement commands or presets the command with error code -60102. If I provide Internet access back to the camera it will function normally.

I tried to use TCP, UDP, or UDP multicast as a transport protocol the issue remains.

Usually if I reload the integration that it will work for some time, and error out again which will trigger the camera to go off and on and recalibrate on its own

@JurajNyiri
Copy link
Owner

The communication of this plugin is and always will be local. Does it work via the app when offline?

@sd65
Copy link

sd65 commented Mar 8, 2024

I'm having the exact same problem. Furthermore the camera reboots if I send too many commands in this fixed-hang state.

@BugAholic
Copy link

Same issue with Tapo C200 and Tapo C210: blocking all internet traffic from the cameras, error -60102 is raised and they reboots and recalibrate randomly

@sd65
Copy link

sd65 commented Mar 17, 2024

To everyone experiencing this issue, do you know when it started occurring? Do you believe it is related to the firmware?

I believe it used to work with the latest firmware available in November 2023...

@Sigfrodr
Copy link

Same problem here. Camera used to work fine before so this is not related to network.

@nanoandrew4
Copy link

nanoandrew4 commented Jul 24, 2024

I am having the same issue, my Tapo C200 frequently returns a 60102 error when I do anything on it, which causes it to reboot by itself. I have it blocked off the internet, but accessible through the LAN, as was specified in the workaround for authenticating when using newer firmware. Trying to pan in the Tapo app has the same problem, it does nothing and after a bit the camera reboots. Maybe the workaround for newer firmware versions does not work well with the C200, and it needs to be connected to the internet to work properly?

To clarify, sometimes panning does work, but more times than not it does not and causes a reboot.

Edit: It seems that if you block all internet connection it results in what I described above. If you just block the two domains, as explained in the new Readme file, the camera seems to work fine.

@BugAholic
Copy link

BugAholic commented Jul 24, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Bug/Enhancement not related to integration or already available.
Projects
None yet
Development

No branches or pull requests

7 participants