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

CamHipro Wireless WiFi 5MP 240X ZOOM Camera cannot parse XML or respond to GetCapabilities with 2023.5.x and later #92308

Closed
criticallimit opened this issue Apr 30, 2023 · 96 comments · Fixed by #92711
Assignees
Labels
integration: onvif problem in device Issue lies within the device, such firmware, software, or user customization/config

Comments

@criticallimit
Copy link

criticallimit commented Apr 30, 2023

The problem

next onvif problem here

What version of Home Assistant Core has the issue?

2023.5.0b5

What was the last working version of Home Assistant Core?

2023.4.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

onvif

Link to integration documentation on our website

No response

Diagnostics information

Logger: homeassistant.config_entries
Source: components/onvif/device.py:309
First occurred: 22:12:07 (1 occurrences)
Last logged: 22:12:07

Error setting up entry Cam Zoom 3 - C4:3C:B0:EA:72:5A for onvif
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/onvif/__init__.py", line 38, in async_setup_entry
    await device.async_setup()
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 112, in async_setup
    self.profiles = await self.async_get_profiles()
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 309, in async_get_profiles
    result = await media_service.GetProfiles()
  File "/usr/local/lib/python3.10/site-packages/zeep/proxy.py", line 64, in __call__
    return await self._proxy._binding.send_async(
  File "/usr/local/lib/python3.10/site-packages/zeep/wsdl/bindings/soap.py", line 156, in send_async
    response = await client.transport.post_xml(
  File "/usr/local/lib/python3.10/site-packages/zeep/transports.py", line 235, in post_xml
    response = await self.post(address, message, headers)
  File "/usr/local/lib/python3.10/site-packages/zeep/transports.py", line 220, in post
    response = await self.client.post(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1845, in post
    return await self.request(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 116, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 95, in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 159, in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 195, in _receive_event
    data = await self._network_stream.read(
  File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 34, in read
    return await self._stream.receive(max_bytes=max_bytes)
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1265, in receive
    await self._protocol.read_event.wait()
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 214, in wait
    await fut
asyncio.exceptions.CancelledError
@frenck frenck added this to the 2023.5.0 milestone Apr 30, 2023
@frenck frenck changed the title 2023.5.0b5: ONVIF another problem ONVIF another problem Apr 30, 2023
@home-assistant
Copy link

Hey there @hunterjm, mind taking a look at this issue as it has been labeled with an integration (onvif) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of onvif can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign onvif Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


onvif documentation
onvif source
(message by IssueLinks)

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

Looks like the anyio bug that I had been biting us in other issues.

agronholm/anyio#374

There are no workarounds at this time

@bdraco bdraco changed the title ONVIF another problem ONVIF raises CancelledError during setup from anyio Apr 30, 2023
@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

If you reload the config entry a few times in the UI, can you eventually get it to setup?

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

We can't resume on cancel as we have to raise to avoid blocking cancelation but we could retry the whole setup process by rasing ConfigEntryNotReady instead

@criticallimit
Copy link
Author

If you reload the config entry a few times in the UI, can you eventually get it to setup?

nope

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

Can you post a link to the camera and where to purchase it ?

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

Great. I ordered that one.

I added retries for now. I'll see if I can improve compatibility when it shows up.

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

I'm assuming it uses https://play.google.com/store/apps/details?id=com.hichip.campro&hl=en_US&gl=US as those firmwares have been particularly difficult to keep working as they are pretty finicky

@criticallimit
Copy link
Author

thanx a lot!

@criticallimit
Copy link
Author

CAMHI Camera http CGI manual (2022-04-15).pdf

maybe this cgi doc helps?

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

Its usually something subtle with the camera's onvif implementation. I've seen one where it only failed when it it received more than 10 requests per minute but worked fine until the 9th request. Any small change can have unintended consequences with these brittle onvif implementations so its always a bit a trial and error to figure out how to get it to work which is why I just order the camera now.

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

I have this one that I just got that I'm working through now https://www.amazon.com/dp/B092V7BW7C?psc=1&ref=ppx_yo2ov_dt_b_product_details. I'm pretty sure it uses similar firmware. It works fine with ethernet but fails on wifi. Unfortunately it doesn't look like the same issue

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

Thats a thought. Do you have it connected via ethernet or wifi?

@criticallimit
Copy link
Author

criticallimit commented Apr 30, 2023

Thats a thought. Do you have it connected via ethernet or wifi?

On wifi
And it worked before on 2023.4.4

No matter if on Wi-Fi or Ethernet. Same behavior since 2023.5.betas

@bdraco
Copy link
Member

bdraco commented Apr 30, 2023

I'll be sure to setup the test unit on wifi when it arrives. If you can test with ethernet in the mean that that would be a helpful datapoint

@criticallimit
Copy link
Author

I'll be sure to setup the test unit on wifi when it arrives. If you can test with ethernet in the mean that that would be a helpful datapoint

Will check tomorrow with 5.0b5 again on ethernet

@balloob balloob closed this as completed in 30dd8b9 May 1, 2023
@bdraco bdraco reopened this May 1, 2023
@criticallimit
Copy link
Author

ok. Checked with cam connected via ethernet.
Same Faults in the log.

@bdraco
Copy link
Member

bdraco commented May 1, 2023

Thanks for checking. I’ll report back when the test unit arrives

@bdraco bdraco changed the title ONVIF raises CancelledError during setup from anyio ONVIF raises CancelledError during setup from anyio with CamHipro Wireless WiFi 5MP 240X ZOOM Humanoid SONY IMX 335 IP Camera DV Recorder Support SD MIC Speaker May 1, 2023
@bdraco
Copy link
Member

bdraco commented May 6, 2023

We don't know if the camera has gone away or its just failing to respond because it does nothing when it gets a request with WSAs

@pbvdven
Copy link

pbvdven commented May 6, 2023

i get it. is there maybe a option you can make one custom without the wsa's that i can use as a custom onvif integration? or can i use the last version from the onvif integration shipped with 2023.4 that one worked fine for all my 3 onvif devices the hikvision ds-hd1, dahua cube 4mp and my cheap ptz.

@bdraco
Copy link
Member

bdraco commented May 6, 2023

I'm trying to work up an alternate solution. Give me ~30m

@pbvdven
Copy link

pbvdven commented May 6, 2023

take all the time you need. thanks for looking in to it.

@pbvdven
Copy link

pbvdven commented May 6, 2023

Idk if it could help but these onvif settings can be set in the camera.
image

NVC type has also the option uniview

@bdraco
Copy link
Member

bdraco commented May 6, 2023

I pushed onvif-zeep-async==2.1.4

cd /config
curl -o- -sSL https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d onvif -p 92700
cat /config/custom_components/onvif/manifest.json

Verify that the version displayed above is "onvif-zeep-async==2.1.4" and NOT 2.1.1

Restart HA

Test

Delete /config/custom_components/onvif and restart after testing is completed to restore the core version

@pbvdven
Copy link

pbvdven commented May 6, 2023

i do get other labels
image

@pbvdven
Copy link

pbvdven commented May 6, 2023

same result new log in your mail

@bdraco
Copy link
Member

bdraco commented May 6, 2023

no ReadError in the log so definitely making progress

@bdraco
Copy link
Member

bdraco commented May 6, 2023

Can you try power cycling the device before setting it up again with the 2.1.4 version?

@bdraco
Copy link
Member

bdraco commented May 6, 2023

Also the labels are missing because its a custom component and the translation files aren't there (this is normal)

@pbvdven
Copy link

pbvdven commented May 6, 2023

now its added but still
image

also new log

@bdraco
Copy link
Member

bdraco commented May 6, 2023

I didn't get a new log via email. Not sure if it got stuck going out ?

@pbvdven
Copy link

pbvdven commented May 6, 2023

said send here but i send it again

my bad send it through icloud.com and your verification email got into spam

@bdraco
Copy link
Member

bdraco commented May 6, 2023

got it.

Its getting a lot further.

2023-05-07 00:02:51.389 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/device_service:
2023-05-07 00:02:51.400 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/device_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.401 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/device_service (status: 200):
2023-05-07 00:02:51.403 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/device_service:
2023-05-07 00:02:51.413 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/device_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.415 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/device_service (status: 200):
2023-05-07 00:02:51.416 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/device_service:
2023-05-07 00:02:51.425 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/device_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.426 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/device_service (status: 200):
2023-05-07 00:02:51.427 DEBUG (MainThread) [onvif] Creating service ('media', None) with http://192.168.2.189:8080/onvif/media_service
2023-05-07 00:02:51.429 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/media_service:
2023-05-07 00:02:51.434 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/media_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.435 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/media_service (status: 200):
2023-05-07 00:02:51.436 DEBUG (MainThread) [onvif] Creating service ('imaging', None) with http://192.168.2.189:8080/onvif/image_service
2023-05-07 00:02:51.436 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/media_service:
2023-05-07 00:02:51.473 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/media_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.475 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/media_service (status: 200):
2023-05-07 00:02:51.479 DEBUG (MainThread) [onvif] Creating service ('ptz', None) with http://192.168.2.189:8080/onvif/ptz_service
2023-05-07 00:02:51.607 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/ptz_service:
2023-05-07 00:02:51.624 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/ptz_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.631 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/ptz_service (status: 200):
2023-05-07 00:02:51.679 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/ptz_service:
2023-05-07 00:02:51.693 DEBUG (MainThread) [httpx] HTTP Request: POST http://192.168.2.189:8080/onvif/ptz_service "HTTP/1.1 200 OK"
2023-05-07 00:02:51.701 DEBUG (MainThread) [zeep.transports] HTTP Response from http://192.168.2.189:8080/onvif/ptz_service (status: 200):
2023-05-07 00:02:51.738 DEBUG (MainThread) [onvif] Creating service ('notification', None) with http://192.168.2.189:8080/onvif/event_service
2023-05-07 00:02:51.740 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/event_service:
2023-05-07 00:03:26.249 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/event_service:
2023-05-07 00:03:56.253 DEBUG (MainThread) [zeep.transports] HTTP Post to http://192.168.2.189:8080/onvif/media_service:
2023-05-07 00:04:26.258 WARNING (MainThread) [homeassistant.config_entries] Config entry 'PTZ - 00:0A:24:33:32:D2' for onvif integration not ready yet: Could not connect to camera 192.168.2.189:8080: ; Retrying in background

@bdraco
Copy link
Member

bdraco commented May 6, 2023

Can you adjust the loggers so we can pick up the custom component and try again

# Example configuration.yaml entry
logger:
  default: info
  logs:
    homeassistant.components.onvif: debug
    custom_components.onvif: debug
    httpx: debug
    onvif: debug
    zeep: debug

@bdraco
Copy link
Member

bdraco commented May 6, 2023

Also please power cycle the device before trying again as I think once it gets into a bad state it won't recover on its own

@bdraco
Copy link
Member

bdraco commented May 6, 2023

The last one you just sent the camera didn't respond at all to the request. I'm not sure it was booted yet or was still in a the stuck state

@pbvdven
Copy link

pbvdven commented May 6, 2023

new log now its added again.

@bdraco
Copy link
Member

bdraco commented May 6, 2023

Thanks. Its back to completely not responding again. This could take a few days of iterations to figure out the root cause

@bdraco
Copy link
Member

bdraco commented May 6, 2023

It might be better to wait until the test camera shows up

@pbvdven
Copy link

pbvdven commented May 7, 2023

thanks for your time. Ive i can do anything else to help just let me know

@bdraco
Copy link
Member

bdraco commented May 7, 2023

I’ll follow up when the hardware arrives

@bdraco
Copy link
Member

bdraco commented May 7, 2023

Original camera I ordered shows in the US now so hopefully have it by next weekend

@bdraco
Copy link
Member

bdraco commented May 14, 2023

Camera showed up. Turns out its likely the same issue as #91678

@bdraco
Copy link
Member

bdraco commented May 14, 2023

Please try 2023.5.4 when it is released

@pbvdven
Copy link

pbvdven commented May 24, 2023

Please try 2023.5.4 when it is released

Thanks with 2023.5.4 the 5mp ptz works again.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
integration: onvif problem in device Issue lies within the device, such firmware, software, or user customization/config
Projects
None yet
5 participants