core: 107.1 "PTZ actions are not supported on camera"

The problem

After updating to 0.107.1 I cannot zoom anymore with Reolink RLC-511. The script below runs till the end, just it doesn’t zoom in or out.

Environment

  • Home Assistant release with the issue: 0.107.1
  • Last working Home Assistant release (if known): 0.106.5
  • Operating environment (Hass.io/Docker/Windows/etc.): Docker on Ubuntu powered Nuc. Camera is Reolink RLC-511
  • Integration causing this issue: Onvif
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/onvif/

Problem-relevant configuration.yaml


camera:
  - platform: onvif
    host: 192.168.2.100
    name: giardino_onvif
    port: 8000
    profile: 1
    username: !secret giardino_user
    password: !secret giardino_pwd


# script.yaml file:
doorbell_routine:
  alias: 'Routine campanello'
  sequence:
    - service: camera.snapshot
      data:
        entity_id: camera.giardino_onvif
        filename: "/config/www/camera_snapshot/campanello_{{ now ().year }}_{{ now ().month }}_{{ now ().day }}_{{ now ().hour }}_{{ now ().minute }}.jpg"
    - service: onvif.ptz
      data:
        entity_id: camera.giardino_onvif
        zoom: ZOOM_IN
        distance: 1
        move_mode: AbsoluteMove
#[more script services...]
    - wait_template: "{{ is_state('input_boolean.doorbell', 'off') }}"
    - service: onvif.ptz
      data:
        entity_id: camera.giardino_onvif
        zoom: ZOOM_OUT
        distance: 1
        move_mode: AbsoluteMove
    - service: browser_mod.close_popup

Traceback/Error logs

Logger: homeassistant.components.onvif.camera
Source: components/onvif/camera.py:132 
Integration: onvif (documentation, issues) 
First occurred: 6:55:14 PM (4 occurrences) 
Last logged: 7:00:36 PM

PTZ actions are not supported on camera 'giardino_onvif'

Additional information

It worked smoothly with service camera.onvif_ptz in 0.106.5 before updating.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (7 by maintainers)

Most upvoted comments

@GeertvanHorrik Thank you for reporting.

@paparapapapapa I’ve not tried the zoom yet.


I’ve looked at the code of python-onvif-zeep-async and I think if a camera does not support PTZ an ONVIFError is raised. So I think now the fix should be something like this:

    try:
        self._ptz_service = self._camera.create_ptz_service()
    except exceptions.ONVIFError:
        _LOGGER.debug("PTZ is not available")

camera.py already contains from onvif import ONVIFCamera, exceptions so we can refer to the ONVIFError exception as exceptions.ONVIFError.

(Note that I’ve not tested the code above.)