question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't connect to ONVIF when camera is not in the same network

See original GitHub issue

Description

Hi, I’ve 2 TAPO cameras, one on the local network (of the home assistant instance) and one remote, the local one works perfectly, the remote one works 50%, stream works perfectly but the onvif (motion sensor) doesn’t.

I get this error logs:

2022-11-17 21:45:48.590 ERROR (MainThread) [custom_components.tapo_control] Unexpected error fetching Tapo resource status data: All connection attempts failed
Traceback (most recent call last):
  File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/anyio/_core/_sockets.py", line 164, in try_connect
    stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
  File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1691, in connect_tcp
    await get_running_loop().create_connection(
  File "/home/homeassistant/.pyenv/versions/3.9.15/lib/python3.9/asyncio/base_events.py", line 1065, in create_connection
    raise exceptions[0]
  File "/home/homeassistant/.pyenv/versions/3.9.15/lib/python3.9/asyncio/base_events.py", line 1050, in create_connection
    sock = await self._connect_sock(
  File "/home/homeassistant/.pyenv/versions/3.9.15/lib/python3.9/asyncio/base_events.py", line 961, in _connect_sock
    await self.sock_connect(sock, address)
  File "/home/homeassistant/.pyenv/versions/3.9.15/lib/python3.9/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
  File "/home/homeassistant/.pyenv/versions/3.9.15/lib/python3.9/asyncio/selector_events.py", line 535, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.1.131', 2020)

The thing is, that IP address (192.168.1.131) is wrong since it’s the remote camera (when setting it up I’m using a dyndns domain name) so it seems it’s trying to connect to the “local” address (in the remote network) which I never typed anywhere and I’ve no idea where it got it from.

If I check the open ports all of them seem to be working fine, example:

fab@MBP-Fab ~ [1]> nc -vz xxx.ddns.net 2020
Connection to xxx.ddns.net port 2020 [tcp/xinupageserver] succeeded!

Reproduction Steps

  1. setting up a camera which is not in the same network of the home assistant

Expected behavior

stream and onvif work

If applicable, add error logs.

No response

Device Firmware

latest available

Using stream component

Yes

Does camera work via official integrations?

Yes

Camera has all attributes filled out in developer tools

No

HASS Environment

HA core on dietPi

Search for similar issues

Yes

Additional information

No response

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
fballianocommented, Nov 18, 2022
0reactions
JurajNyiricommented, Nov 18, 2022

This integration reuses the functionality of Home Assistant onvif for events. In this case there is nothing I can do without reimplementing the whole thing.

I recommend opening issue with home assistant onvif integration.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ONVIF Camera troubleshooting guide - Network Optix
Try to find the camera using the ONVIF Device Manager. Click "Add" at bottom-left corner of GUI and enter the IP address or...
Read more >
IP Camera WiFi Not Working – 9 Tips to Fix IP Cam ... - Reolink
Your wireless security IP camera not working? The new IP camera not connecting to your router WiFi? Try the top 9 solutions to...
Read more >
How to configure and connect an ONVIF IP Security Camera
Connecting to the camera for the first time​​ Once you have configured Internet Explorer, the next step is to connect to the camera....
Read more >
ONVIF Profile S Network Camera can't be found
I got a Reolink RLC-410W (https://reolink.com/product/rlc-410w) that is supposedly ONVIF Profile S. I can't connect to the camera as ...
Read more >
ONVIF: can't use remote camera (not in same network) #82348
Ports 443, 554, 2020 are reachable without any problem, this is not a connection issue. When I try to configure the integration (the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found