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.69k stars 30.44k forks source link

ONVIF GoToPreset: Unknown Exception #73996

Closed Maxcodesthings closed 1 year ago

Maxcodesthings commented 2 years ago

The problem

Using a GoToPreset on onvif.ptz service returns an unknown exception:

2022-06-25 21:21:39 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140442037400624] Unknown Error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1704, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 697, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 205, in async_perform_ptz
    await self.device.async_perform_ptz(
  File "/usr/src/homeassistant/homeassistant/components/onvif/device.py", line 438, in async_perform_ptz
    await ptz_service.GotoPreset(req)
  File "/usr/local/lib/python3.9/site-packages/zeep/proxy.py", line 64, in __call__
    return await self._proxy._binding.send_async(
  File "/usr/local/lib/python3.9/site-packages/zeep/wsdl/bindings/soap.py", line 164, in send_async
    return self.process_reply(client, operation_obj, response)
  File "/usr/local/lib/python3.9/site-packages/zeep/wsdl/bindings/soap.py", line 229, in process_reply
    return self.process_error(doc, operation)
  File "/usr/local/lib/python3.9/site-packages/zeep/wsdl/bindings/soap.py", line 391, in process_error
    raise Fault(
zeep.exceptions.Fault: Unknown Error

All other PTZ actions work, just not GoToPreset.

What version of Home Assistant Core has the issue?

2022.6.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

onvif

Link to integration documentation on our website

https://www.home-assistant.io/integrations/onvif/

Diagnostics information

config_entry-onvif-a8bab2046ab4fa87c69dc39ca04c0383.json.txt

Example YAML snippet

- type: picture-glance
    camera_view: live
    camera_image: camera.family_room
    entities:
      - entity: camera.family_room
        name: Preset 1
        show_state: false
        icon: 'mdi:numeric-1-box'
        show_icon: true
        tap_action:
          action: call-service
          service: onvif.ptz
          service_data:
            entity_id: camera.family_room
            preset: '1'
            speed: 0.5
            distance: 0.5
            move_mode: GotoPreset
      - entity: camera.family_room
        name: Preset 2
        show_state: false
        icon: 'mdi:numeric-2-box'
        show_icon: true
        tap_action:
          action: call-service
          service: onvif.ptz
          service_data:
            entity_id: camera.family_room
            preset: '2'
            speed: 0.5
            distance: 0.5
            move_mode: GotoPreset

Anything in the logs that might be useful for us?

No response

Additional information

No response

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

onvif documentation onvif source (message by IssueLinks)

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

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! (message by CodeOwnersMention)

Mosibi commented 2 years ago

I have the same problem. This is my automation, and it fails on the last service call, where the camera is set to preset '2'. So in this case, when somebody rings the doorbell, the camera is set to position 1 (works), the notification image is sent (works), wait 1 minute (works) and then set the camera back to position 2 (does not work)

When I later call the exact same service to set it to position 2, it works

alias: "Doorbell Notifications"
trigger:
  platform: state
  entity_id: binary_sensor.deurbel
  to: 'on'
condition:
  - condition: template
    value_template: >
      {{ (as_timestamp(now()) - as_timestamp(trigger.from_state.last_changed)) > 10 }}
action:
  - service: onvif.ptz
    target:
      device_id: a8774c441091d271c266d7e511ad9928
    data:
      preset: '1'
      move_mode: GotoPreset
  - service: camera.snapshot
    data:
     entity_id: camera.dahua_mediaprofile_channel1_substream1
     filename: '/tmp/snapshot_camera_voordeur.jpg'
  - service: notify.pushover
    data:
      message: "Ding dong! Er drukt iemand op de deurbel"
      title: "Deurbel"
      data:
        attachment: '/tmp/snapshot_camera_voordeur.jpg'
  - delay: 00:01:00
  - service: onvif.ptz
    target:
      device_id: a8774c441091d271c266d7e511ad9928
    data:
      preset: '2'
      move_mode: GotoPreset
Sesshoumaru-sama commented 2 years ago

I also noticed that movement commands with pre-set does not work anymore.

Logger: homeassistant.components.onvif Source: components/onvif/event.py:134 Integration: ONVIF (documentation, issues) First occurred: 19:39:42 (1 occurrences) Last logged: 19:39:42

Failed to restart ONVIF PullPoint subscription for '24:28:fd:d3:91:8e'. Retrying

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.