home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.67k stars 30.42k forks source link

ONVIF integration doesn't create any entities - Device doesn't support service: ptz #36734

Closed InToSSH closed 4 years ago

InToSSH commented 4 years ago

The problem

No entities are created for 3 out of my 4 Milesight cameras (MS-C5373-PB don't work, only MS-C5372-FPB with motorized zoom works) none of them have PTZ. When I was on 0.109.0, configured via yaml they were working fine. Now only one of them actually creates entities with the stream and motion detection.

Environment

Problem-relevant configuration.yaml

Traceback/Error logs

2020-06-12 23:33:48 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Camera - 1cc3162442bb for onvif
  File "/usr/src/homeassistant/homeassistant/components/onvif/__init__.py", line 73, in async_setup_entry
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 98, in async_setup
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 298, in async_get_profiles
  File "/usr/local/lib/python3.7/site-packages/onvif/client.py", line 362, in create_ptz_service
    return self.create_onvif_service("ptz")
  File "/usr/local/lib/python3.7/site-packages/onvif/client.py", line 330, in create_onvif_service
  File "/usr/local/lib/python3.7/site-packages/onvif/client.py", line 322, in get_definition
    raise ONVIFError("Device doesn`t support service: %s" % name)
onvif.exceptions.ONVIFError: Unknown error: Device doesn`t support service: ptz

Additional information

probot-home-assistant[bot] commented 4 years ago

Hey there @hunterjm, mind taking a look at this issue as its been labeled with a integration (onvif) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

djpremier commented 4 years ago

Hi @InToSSH, are you trying to configure through config flow?

I will make a correction and pass it here for you to test, will you?

InToSSH commented 4 years ago

Hi @djpremier, thanks for looking into this. Yes, I am configuring it through Integrations page, I add a new ONVIF (hope that what config flow is), it searches the network for cameras (which are all found), then I just simply put in the credentials, the camera is added, but no entities. Even when I originally had them in configuration.yaml, and after upgrade they were converted to the Integrations entry, they didn't work.

Sure, I will be more than happy to test it. Thank you

marcin77 commented 4 years ago

I have probably the same problem since version 0.111, camera without PTZ, previously configured by yaml worked fine. :(

ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Kamera2 for onvif
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 217, in async_setup
    hass, self
  File "/usr/src/homeassistant/homeassistant/components/onvif/__init__.py", line 73, in async_setup_entry
    if not await device.async_setup():
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 98, in async_setup
    self.profiles = await self.async_get_profiles()
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 298, in async_get_profiles
    ptz_service = self.device.create_ptz_service()
  File "/usr/local/lib/python3.7/site-packages/onvif/client.py", line 362, in create_ptz_service
    return self.create_onvif_service("ptz")
  File "/usr/local/lib/python3.7/site-packages/onvif/client.py", line 330, in create_onvif_service
    xaddr, wsdl_file, binding_name = self.get_definition(name, port_type)
  File "/usr/local/lib/python3.7/site-packages/onvif/client.py", line 322, in get_definition
    raise ONVIFError("Device doesn`t support service: %s" % name)
onvif.exceptions.ONVIFError: Unknown error: Device doesn`t support service: ptz
InToSSH commented 4 years ago

@marcin77 yea, it's the same error as mine. Just out of curiosity, what camera do you have?

marcin77 commented 4 years ago

@InToSSH Zxtech Cloudmini MCI36C3B

InToSSH commented 4 years ago

@djpremier May I please ask if there is any progress with this issue?

djpremier commented 4 years ago

Hi @InToSSH, sorry this week I'm very busy, but this weekend I make the changes and send you to test.

djpremier commented 4 years ago

Hi @InToSSH, I just sent the change that should fix your problem, could you confirm if it works and give feedback, thanks 😁. https://github.com/home-assistant/core/pull/37176

InToSSH commented 4 years ago

Hi @djpremier I tried your fix and I can confirm that everything is working now. Thank you very much for the fix 😄