Support for ONVIF (standard for IP cameras etc)

Dear Matt:

thank you for writing the component.

I have a silly question: what do you mean by “onvif camera support?”

I briefly went through onvif specification, it contains many parts. The most important part is so-called “Profile S” which dictates the video streaming.

My question for you are:

  1. Since onvif CAN use rtsp for video streaming, what is the differences, in the home-assistant context, between your onvif component and ffmpeg component?

  2. exactly how to use onvif component in conjunction with ffmpeg component?

I just got this cheap German/Chinese camera claim to support onvif/rtsp with h.264 high. here is my current setup:

camera:
  # Security Camera: hikam S06
  - platform: ffmpeg
    input: -rtsp_transport tcp -i rtsp://192.168.34.134:554/stream=0
    name: cameraDinning

in your onvif component context, I am having problem where to input the /stream=0 part of the rtsp uri

thanks in advance

The idea of the component was to make it easier for users, you don’t need to worry about the stream when using the onvif platfrom.

the reason why I am “worrying” about it is because my suppose onvif camera is not working out of box.

On my synology, i set up this camera (hikam S6) as a “generic onvif” with port 8090, it worked fine.

but when i try to connect it to my home assistant using onvif, i got this strange error:

onvif.exceptions.ONVIFError: The requested profile token ProfileToken does not exist

I am not even sure the issue is on your side!

I got the still image working which refreshes now and than.
However clicking the image should open a live stream but nothing seems to happen.
It seems to do some camera_proxy calls which result in 200 response codes but nothing shows.

CONFIG
camera:

  • platform: onvif
    name: kitchen_camera
    host: 192.168.x.x
    username: admin
    password: verysecret
    port: 8080

ffmpeg:
ffmpeg_bin: /usr/local/bin/ffmpeg

Any ideas?

[UPDATE]
capturing rtsp stream via ffmpeg to avi works in command prompt.

[UPDATE]
tried the exact command from the logging for rstp and in a command prompt that works, however no stream in frontend.
ffmpeg -i rtsp://admin:[email protected]:554/11 -an -frames:v 1 -c:v mjpeg -q:v 2 -f image2pipe -

[UPDATE]
I get {“message”: “Entry not found”} on an attempt from the frontend to access the entity registry for my camera. It is just not in the entity registry.
https://x.x.x.x/api/config/entity_registry/camera.kitchen_camera 404 (Not Found)

I have similar problems using current component. We need to add timestamp ajustment: Onvif error

For that I modify default component using latest library’s because onvif-py3 doesn’t have this patch. If you want to try.
onvif custom_component

Create a custom_component

@matt2005:

latest home assistant update, streaming worked with set up like this:
- platform: onvif
host: 192.168.5.132
port: 8090
name: hikamS6onvif
username: user
password: password

You’ve must done some magic that I wasn’t aware of. thank you so much

Have you figure out how to use onvif camera as motion sensor yet?

my other camera use proprietary amcrest platform, has a amcrest component which can configure it as a motion sensor easily.

i know that onvif suppose to support it. i am just wondering have you managed to figure out how to configure it in home assistance, if it is implemented, that is.

I haven’t looked at it at all. that is far above my skill level. I was hoping someone else who knows how to do it might have a crack

Hi All,

Mayby someone will be looking for configuration on how to get Sricam 360 camera to work, along with PTZ.
My camera is Sricam SP012, cheap 360 nigt vision camera.
But be aware that there is some backdoor on it … Once it started to get a look around my appartment by itself … So I suggest to lock down outside communication :wink:

Here is my config:

  - platform: onvif
    host: ip_of_camera
    username: admin
    password: password
    extra_arguments: -rtsp_transport udp

default password was 888888

tricky part for me was setting udp transport

After above setup I was able to use scipts to get control buttons:

  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'
2 Likes

I’ve removed/denied internet access from every camera through my router, mostly because the security on these things and the amount they get updated is particularly poor, so they can suffer from all sorts of vulnerabilities that can give someone a route in if they went looking, so your suggestion is one I’d agree wholly with on all these P2P based IP cameras!

Hello everyone,

I’m also struggling to have my Revotech PIR ip camera recognized and properly configured in Hassio. I’ve tried lots of combinations with unsuccessful results. I’ve also used ONVIF Device Manager for spotting the right URL and not even then have I managed to integrate the stream into Hassio. If I run VLC on a Windows machine I do access the stream. If I access the camera ip address, I can access the stream as well in the embedded website.

Any tip would be most appreciated.

Thanks

this worked for me in the end, not with same camera but maybe it could help
the port was the issue, my camera was not using standard one.

  • platform: onvif
    host: 10.0.0.4
    port: 80
    profile: 1
    name: front_door
    user: xxxxxxxx
    password: xxxxxxxxxxxxx

Thanks for your answer. My problem is that if I access the stream from VLC I do see what is being shot by the camera m. If I use that very same steam configuration and replicate it in HASSIO, nothing happens; I don’t even see any information in the log file.

Yesterday I also tired with my iOS and an app specific for RTSP, and I too accessed the stream even from an iOS device very quickly.

There is this thing above with the custom component, and it seems to be tied to increasing the log verbosity. Could anybody clarify what needs to be done if one wants to see in the logs what is going on with the camera?

I suspect there is something going on with my HASSIO as I’ve even tried with the Shinibi add on, and that won’t work either.

Hi MrUkleja

Can you give more info on how you get the PTZ working and possibly a screen shot etc

I have my Sricam sp005 and sp008 cameras in hassio no problem, but just cannot get them to do PTZ

You have full configuration above. I don’t know what I can add …
Simply configure your cams using ONVIF platform.
Then use camera.onvif_ptz service to get PTZ functionality.
That’s all …

Hi MrUkleja
I tried your setting and it worked, just one quick question: Can you stream the video on your hassio web interface?
I have picture refreshed every 10 seconds.

That is correct. But if you tap on video, you will see pop-up with live stream.
On my Sricam it takes few seconds to show onvif live stream. I use Shinobi CCTV solution on second raspberry and I’m downsizing video to make it work faster when I’m on mobile network.

running into problems with onvif camera component also.
VLC works fine with this URL : rtsp://192.168.XXX.YYY:554/stream1

this is the config :

  - platform: onvif
    host: 192.168.11.15
    name: Street

Hass.io webif shows a card saying Street (Image not available)

Any ideas?

Check my config above, maybe your camera need extra arguments for UDP transport type for RTSP or any other …

you might want to specify the port number
port: 554

i don’t know rather u need to specify the stream number. the default is 0, but your is one
so

profile: 1

give them a try?