Onvif camera integration success but PT(Z) is not working?

Hello!

Today I had success ti integrate a Onvif camera into Home Assistant.
It is this camera: https://extrastar-led.de/elektronik-fuer-haushalt/81-960p-hd-wi-fi-ueberwachungskamera-ip-kamera-8432011627501.html
handled by Yoosee-App.

The configuration i used is the following:

configuration.yaml

  - platform: onvif
    host: IP-address
    port: 5000
    username: admin
    password: Strong password
    extra_arguments: -rtsp_flags none -rtsp_transport udp -q:v 2 
    name: Rundum

It is also possible to us it as an ffmpeg camer with this configuration.yaml entry:

  - platform: ffmpeg
    input: -rtsp_transport udp -i rtsp://admin:Stron password@IP-address:554/onvif1
    extra_arguments: -q:v 2 
    name: Rundum

I used the following in scripts.yaml:

ptz_tilt_up:
  sequence:
    - service: camera.onvif_ptz
      data:
        entity_id: 'camera.Rundum'
        tilt: 'UP'
ptz_tilt_down:
  sequence:
    - service: camera.onvif_ptz
      data:
        entity_id: 'camera.Rundum'
        tilt: 'DOWN'
ptz_pan_left:
  sequence:
    - service: camera.onvif_ptz
      data:
        entity_id: 'camera.Rundum'
        pan: 'LEFT'
ptz_pan_right:
  sequence:
    - service: camera.onvif_ptz
      data:
        entity_id: 'camera.Rundum'
        pan: 'RIGHT'

But in the log I only find:

2020-02-19 16:58:51 WARNING (MainThread) [homeassistant.components.onvif.camera] PTZ actions are not supported on camera 'Rundum'

Does someone know how I can use the pan and tilt functions of this camera? Is there any trick to use them?

Your camera doesn’t support onvif RelativeMove which is is currently the only supported mode in onvif integration.
I’ve made a PR to add more moving modes but i need to address some additional change request addressed by HA team.
You can also try that custom component which is an evolution of my original PR :

EDIT: I suggest you to try the AbsoluteMove ContinuousMove mode, it is the only mode that is mandatory mode in onvif specs for a camera that be able to say it is onvif ptz compatible.

1 Like

Thank you very much for your answer!

How can I use that?

Clone my onvif2 repository and put it in your config/custom_components folder(create it if it doesn’t exist yet)
Restart HA for the component to be load and exists before to configuring it.
Look at the sample config in the repo’s readme and adapt it for your need.

The ptz need to be controlled with services, you can play with it in HA developper tools.

Thank you for the explanation!

There is one thing I don’t understand. You are using “platform: onvif”, why it isn’t “platform: onvif2”. How does HA knows which onvif it should use? Or does yours exchange the HA onvif completely?

Ok, I will look how this should work. I will do my best…

You are maybe right about it, i don’t use custom component integration but in replacement of the official onvif component. As it is intended to be published in a HA release i prefer to bo closest/iso to the final HA release

So try onvif2 in plateform if my sample doesn’t load the component ( you can see in dev tool services if description/doc includes the new features of this component)

I used this configuration:

  - platform: onvif
    host: 192.168.178.32
    port: 5000
    username: admin
    password: password
    rtsp_transport: "UDP"
    extra_arguments: -rtsp_flags none -rtsp_transport udp -q:v 2 -pred 1
    continuous_timeout_compliance: False
    name: Rundum

And I tested with this data:
Bildschirmfoto 2020-02-21 um 17.59.13

But I am getting only an error.
Bildschirmfoto 2020-02-21 um 18.01.35

I tested all other move_mode values, but nothing happens.

Are there any updating about PTZ function for ONVIF integration?

1 Like

The PT-camera that I have doesn’t work together with the new ONVIF integration in Home Assistant. So the only possibility is to only show the stream via ffmpeg in Home Assistant and control it via the app. But inside the app I also have the stream, so Home Assistant is not necessary for the camera.

Did anyone managed to integrate PTZ YOOSEE cameras into HA using ONVIF?

yeah I have added yoosee camera over onvif integration to HA. But I dont get the PTZ controls to work…


If i visit the device under integrations, i can choose to download diagnostics under device info, but that text file tells me among other things, those:

    "device": {
      "info": {
        "manufacturer": "Technology",
        "model": "IPC",
        "fw_version": "22.00.00.20",
        "serial_number": "(redacted)",
        "mac": "(redacted)"
      },
      "capabilities": {
        "snapshot": false,
        "events": false,
        "ptz": true
      },
      "profiles": [
        {
          "index": 0,
          "token": "IPCProfilesToken0",
          "name": "MainStream",
          "video": {
            "encoding": "H264",
            "resolution": {
              "width": 1280,
              "height": 720
            }
          },
          "ptz": {
            "continuous": false,
            "relative": false,
            "absolute": false,
            "presets": []
          }
        },
        {
          "index": 1,
          "token": "IPCProfilesToken1",
          "name": "SubStream",
          "video": {
            "encoding": "H264",
            "resolution": {
              "width": 320,
              "height": 180
            }
          },
          "ptz": {
            "continuous": false,
            "relative": false,
            "absolute": false,
            "presets": []

I can turn it in the app but have not yet figured out what tricks should be done to successfully send it turning commands… if i try sending them under services, i get these things into the log:

RelativeMove not supported on device ‘hangcam’

8:01:12 PM – (WARNING) ONVIF - message first occurred at 7:54:10 PM and shows up 2 times

ContinuousMove not supported on device ‘hangcam’

8:00:57 PM – (WARNING) ONVIF - message first occurred at 7:55:00 PM and shows up 2 times

AbsoluteMove not supported on device ‘hangcam’

8:00:38 PM – (WARNING) ONVIF - message first occurred at 7:54:40 PM and shows up 2 times

So… someone who knows more things - what else could be attempted, to send moving commands?

I too managed to get my Yoosee camera to work using the Onvif integration, but I can’t get the PTZ controls to work. I can control the PTZ via the Onvif Device Manager software and selecting continuous move mode, so I’m pretty sure my camera supports PTZ. I just wish it worked via Home Assistant.

Hi, my camera currently does not present a PTZ profile entity: I added through the Onvif built-in integration. Thoughts?

it works for me

type: custom:webrtc-camera
url: http://onvif_rtsp
mode: webrtc
ui: true
muted: true
style: >-
  .mode {display: none} .pictureinpicture{display: none} .screenshot{display:
  none} .ptz{opacity: initial}
background: true
ptz:
  service: onvif.ptz
  data_up:
    tilt: UP
    entity_id: camera.ip_camera_profile_001
    speed: 1
    distance: 1
    move_mode: ContinuousMove
    continuous_duration: 0.6
  data_down:
    tilt: DOWN
    entity_id: camera.ip_camera_profile_001
    speed: 1
    distance: 1
    move_mode: ContinuousMove
    continuous_duration: 0.6
  data_left:
    pan: LEFT
    entity_id: camera.ip_camera_profile_001
    speed: 1
    distance: 1
    move_mode: ContinuousMove
    continuous_duration: 0.6
  data_right:
    pan: RIGHT
    entity_id: camera.ip_camera_profile_001
    speed: 1
    distance: 1
    move_mode: ContinuousMove
    continuous_duration: 0.6