Support for ONVIF (standard for IP cameras etc)

Hi,

First of all, I must thank you for your response, it worked with a chinese Sricam SP012.

But, I think you should improve your response, because I’am a newbie in HA and sometimes I lost a bunch of time finding simple issues, but I’am starting to get into this.

In this case, I needed to add a name in the camera configuration to get the PTZ (Pan Tilt and Zoom) to work.

So I suggest, to improve your response you should add name: sricam_360 in your config.

configuration.yaml

camera:
  - platform: onvif
    name: 'sricam_360'
    host: ip_of_camera
    username: admin
    password: password
    extra_arguments: -rtsp_transport udp

scripts.yaml

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

Besides this configuration, I also installed ffmpeg in my hassbian with the following command:

$ sudo apt install ffmpeg

Once again, thank you so much.

1 Like

Hi,

yes you are right. I didn’t include camera name in config because I did set it up via web interface - entities customization in configuration tab

Regarding FFMPEG, I think it is already included in Hassio, that I use.

At the moment I changed all my cameras to Xiaomi Dafang and Xiaomi Fang … but they need to be hacked (custom firmware) to be able to integrate with Hassio. But they offer much better image quality.

@matt2005:

My generic, onvif camera worked for a while, until version 0.74.

The set up was the following:

# Security Camera: hikam S06 onvif setup
  - platform: onvif
    host: 192.168.5.132
    port: 8090
    name: hikamS6onvif
    username: user
    password: password

Since the upgrade, this setup no longer works. I got a very cryptic error message:

[homeassistant.components.camera.onvif] Couldn't setup camera 'hikamS6onvif'. Error: Specification of StreamType or Transport part in StreamSetup

I am afraid it is something the onvif component evolved and broke my configuration.

my onvif port is 8090, as I use it for my synology and it worked perfectly fine.

My question for you all is: what should I do now to accommodate the newly updated onvif component?

Harv
ps:
the camera does have a couple rtsp streams, using different port and use the following syntax:
rtsp://Camera_IP_address:554/stream=0
rtsp://Camera_IP_address:554/stream=1
rtsp://Camera_IP_address:554/onvif1
is this info even relevant?

My Configuration below if it assists anyone, fine with Sricam SP009

camera 3:
  input: rtsp://192.168.1.xxx:554/onvif1
  platform: ffmpeg
  name: xxx

ffmpeg installed and running on raspbian lite with python 3.6 Virtual Environment, latest Home assistant, config worked fine through all the versions I’ve had, Hassbian and upgrades

My camera is also using this type ONVIF, but I can only get a image each 10 seconds, it cannot stream.

Me too, only ever updates every few seconds not a live stream, I use app if I ever want that but am mainly using for snapshot and email/push bullet now, unless its changed generic cams are image every 10 seconds in the interface. I bought IP Camera Pro years ago on Google Play, not much to buy and it stays with your account when you sign in on new phones, its great, I’ve connected to all cams so far (various makes/models inc. Pi Cam) its live with this app, allows audio/ptz and use in conjunction with HA.

Are you guys talking about the HA homepage ? This does indeed refresh the stream about every 10 seconds, but when you click on the image you get a live stream.

Hello I have an OBA X31 onvif camera and I’m able to see it in dashboard and also in live stream, but I’m not be able to have a ptz control. This is my configuration:

configuration.yaml
#ffmpeg
ffmpeg:
ffmpeg_bin: /usr/bin/ffmpeg

#camera
camera:
rtsp://192.168.1.101:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream

  • platform: onvif
    name: ‘Camera cucina’
    host: 192.168.1.101
    port: 8899
    username: “admin”
    password: “”
    extra_arguments: -rtsp_transport udp

script.yaml
#camera ptz
ptz_tilt_up:
sequence:
- service: camera.onvif_ptz
data:
entity_id: ‘camera.camera_cucina’
tilt: ‘UP’
ptz_tilt_down:
sequence:
- service: camera.onvif_ptz
data:
entity_id: ‘camera.camera_cucina’
tilt: ‘DOWN’
ptz_pan_left:
sequence:
- service: camera.onvif_ptz
data:
entity_id: ‘camera.camera_cucina’
pan: ‘LEFT’
ptz_pan_right:
sequence:
- service: camera.onvif_ptz
data:
entity_id: ‘camera.camera_cucina’
pan: ‘RIGHT’

Where am I wrong?

thanks in advance

hello. no one was able?

I, do you have ptz commands working?

H,
Same code here, PTZ not working. Did you eventually find a solution?
Thanks!

I tested my PT-camera (no Zoom) with this new version of HA. It has to use continuous mode to work which I tested with the ONVIF device manager and it is working there.

With HA it is not working. :frowning: I also get “PTZ is not available…” message.

This is implemented