ONVIF camera

Yes, tried all that already. I fear something may be missing in my home assistant because Not only do I access the steam from vlc but also from my iPhone. Only HA can’t access it neither from the standard HA with the configuration above, nor using Shinobi. In fact Shinobi does find the camera but it won’t reproduce the stream.

As I may be upgrading to the newest hassOS version soon, I have moderate hopes it will address this. I’m clueless at this point. When I suggested using the custom component is because I wanted to debug the ONVIF component, and it seemed suggested above, the custom component was the way to go.

Can anybody give me any hint on how to move forward?

Thanks

One weird thing that may help spot the source of this problem. When I use VLC for Windows, I can access the rtsp stream but when I use VLC on a Mac, it crashes complaining something is not right with the sound. Does this suggest anything to anybody?

As many others, I can’t get Onvif to work.
During troubleshooting I discovered at least one thing;
Don’t use an exclamation mark in your password, this will trip the ffmpeg command in bash. Hope this helps someone.

My current state;
Using hass in py venv on rasbian stretch.
The camera is a Hikvision DS-2CD2542FWD-IWS.
You have to enable Onvif in the settings and create a specific user for it.
I can get a stream on the commandline using ffmpeg.
I can also get a stream in VLC.

I can get a picture with the generic platform;
With a user specified in usermanagement (Not the Onvif user)

- platform: generic
  still_image_url: http://192.168.1.20/Streaming/channels/1/picture
  username: user
  password: foobar
  authentication: digest

Onvif is on port 8000, confirmed using desktop software (which also confirms onvif and the onvif user is working) Using other ports throws expected errors.

- platform: onvif
  host: 192.168.1.20
  name: Voordeur
  port: 8000
  username: onvif
  password: foobar
  # profile: 101 //tried with and without

Debug log:
2018-07-21 09:30:40 INFO (MainThread) [homeassistant.components.camera] Setting up camera.onvif
2018-07-21 09:30:40 DEBUG (MainThread) [custom_components.camera.onvif] Connecting with ONVIF Camera: 192.168.1.20 on port 8000
2018-07-21 09:30:50 ERROR (MainThread) [custom_components.camera.onvif] Unable to communicate with ONVIF Camera: Unknown error: [Errno 104] Connection reset by peer
2018-07-21 09:30:50 ERROR (MainThread)

Any idea why it would say connection reset by peer?

I too couldn’t get my onvif camera to work using the onvif platform, but it worked in VLC.

I tried just the ffmpeg platform calling the rtsp stream (same url VLC uses) and it works. See below for my config, note the first camera commented out is the hi-res stream. My RPi 2 can’t handle it.

ffmpeg:
  
camera:
#   - platform: ffmpeg
#     name: "Shed Camera Hi-Res"
#     input: rtsp://user:[email protected]:554/onvif1
#     extra_arguments: -r 3
   - platform: ffmpeg
     name: "Shed Camera Lo-Res"
     input: rtsp://user:[email protected]:554/onvif2
1 Like

I tried this but I was getting an invalid login on my router IP for some reason and hassio would not start. Had to do a power reset after changing my configuration.yaml back to this:

# Camera Support 1/21/18
ffmpeg:

# Cameras
camera:
  - platform: onvif
    host: 192.168.8.41
    port: 8080
    name: Cam-Kitchen
    username: admin
    password: cam1

I’m running HASSIO version 0.75.0 There have been some obvious improvements made as the error logs are quite a bit smaller. However, I’m still not able to get an image into HASSIO using ONVIF.

2018-08-04 12:14:22 INFO (MainThread) [homeassistant.components.camera] Setting up camera.onvif
2018-08-04 12:14:32 WARNING (MainThread) [homeassistant.components.camera] Setup of platform onvif is taking over 10 seconds.
2018-08-04 12:14:36 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-08-04 12:15:17 DEBUG (SyncWorker_4) [homeassistant.components.camera.onvif] Connecting with ONVIF Camera: 192.168.8.41 on port 8080
2018-08-04 12:15:18 DEBUG (SyncWorker_4) [homeassistant.components.camera.onvif] ONVIF Camera Using the following URL for Cam-Kitchen: rtsp://<user>:<password>@192.168.8.41:554/11
2018-08-04 12:24:49 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-08-04 12:25:05 WARNING (MainThread) [haffmpeg.tools] Timeout reading image.
2018-08-04 12:25:06 WARNING (MainThread) [haffmpeg.core] Timeout while waiting of FFmpeg
2018-08-04 12:25:06 ERROR (MainThread) [aiohttp.server] Unhandled exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 398, in start
    await resp.prepare(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_response.py", line 300, in prepare
    return await self._start(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_response.py", line 605, in _start
    return await super()._start(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_response.py", line 367, in _start
    await writer.write_headers(status_line, headers)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http_writer.py", line 100, in write_headers
    self._write(buf)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/http_writer.py", line 57, in _write
    raise ConnectionResetError('Cannot write to closing transport')
ConnectionResetError: Cannot write to closing transport
2018-08-04 12:25:10 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-08-04 12:25:10 WARNING (MainThread) [haffmpeg.tools] Timeout reading image.
2018-08-04 12:25:10 WARNING (MainThread) [haffmpeg.tools] Timeout reading image.
2018-08-04 12:25:10 WARNING (MainThread) [haffmpeg.tools] Timeout reading image.
2018-08-04 12:25:10 WARNING (MainThread) [haffmpeg.tools] Timeout reading image.

I’ve been able to successfully use VLC to view the video stream on my browser using the following:
rtsp://admin:[email protected]:554/11 (For High Quality) or
rtsp://admin:[email protected]:554/12 (For Low Quality)

I don’t know if the user name or password is being passed just by looking at the log file since it only records: Using the following URL for Cam-Kitchen: rtsp://user:[email protected]:554/11.

And I don’t see how I can change to the :554/12 for the low-res stream which I would prefer to use for HASSIO reporting. The camera appears to be connecting on the correct ONVIF port defined in the camera setup setting of 8080. I’m still not getting any images in the dashboard. I’m using several FDT 7901 720p IP cameras and they are working with the VLC, my NVR using ONVIF, any mobile device, and any browser I choose on my LAN.

@daryl.sargent I was having a similar issue where connectivity was failing with 401. Since I don’t care about other controls, switching to ffmpeg to pull my RTSP feed seemed sufficient. The only thing I’d do is move input to the secret.yml file so you don’t expose your pass.

Hello,

I keep seeing this in my logfile

2018-08-22 11:58:18 INFO (MainThread) [homeassistant.components.http.view] Serving /api/camera_proxy_stream/camera.pir_camera_01 to 192.168.1.145 (auth: False)
2018-08-22 11:58:24 WARNING (MainThread) [haffmpeg.core] FFmpeg isn't running!
2018-08-22 11:58:24 INFO (MainThread) [homeassistant.components.http.view] Serving /api/camera_proxy_stream/camera.pir_camera_01 to 192.168.1.145 (auth: False)

do you happen to see that message about ffmpeg not running?

Thanks, I’m using a test system for this so I don’t care about the passwords at the moment. You are correct and I do use the secrets! for my production system.

Hello I’m trying to see my camera, in my Hassio, if I use VLC i can with this configuration:

rtsp://admin:[email protected]:554/onvif1

I wrote this in my configuration.yaml:

ffmpeg:

#per le telecamere
camera:

  • platform: onvif
    name: CameraOnvif
    host: 172.1.1.12
    port: 554
    username: admin
    password: 1234

But on the home page there is any item CameraOnvif

Any idea?

Are you using Lovelace? You need to create a card to show the camera.

Something like:

  - type: picture-entity
    title: Camera
    show_info: true
    show_state: false
    camera_image: camera.cameraonvif
    entity: camera.cameraonvif

No but i’'l add the configuration.

In the log i get

“## Log Details (ERROR)
Setup of platform onvif is taking longer than 60 seconds. Startup will proceed without waiting any longer.”

No success :frowning:

Are you sure you have the correct port? 554 is the rtsp port, you need to specify the ONVIF port.

I have scanned the camera and i have only open two ports 554 and 5000, should i try the 5000 port?

I tried port 5000 but

Mon Jun 10 2019 11:01:57 GMT+0200 (Ora legale dell’Europa centrale)
Error while setting up platform onvif
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 416, in wait_for
return fut.result()
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/onvif/camera.py”, line 101, in async_setup_platform
await hass_camera.async_initialize()
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/onvif/camera.py”, line 166, in async_initialize
device_time = await devicemgmt.GetSystemDateAndTime()
File “/usr/local/lib/python3.7/site-packages/zeep/asyncio/bindings.py”, line 15, in send
options[‘address’], envelope, http_headers)
File “/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py”, line 95, in post_xml
response = await self.post(address, message, headers)
File “/usr/local/lib/python3.7/site-packages/zeep/asyncio/transport.py”, line 87, in post
verify_ssl=self.verify_ssl, proxy=self.proxy)
File “/usr/local/lib/python3.7/site-packages/aiohttp/client.py”, line 497, in _request
await resp.start(conn)
File “/usr/local/lib/python3.7/site-packages/aiohttp/client_reqrep.py”, line 844, in start
message, payload = await self._protocol.read() # type: ignore # noqa
File “/usr/local/lib/python3.7/site-packages/aiohttp/streams.py”, line 588, in read
await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: None

In case this will help someone, I have managed to get an ESCAM G01 working in HASS.IO using the ONVIF platform configuration. See below sample configuration.yaml file entry. I haven’t got Pan Tilt Zoom (PTZ) functionality to work yet :(. It’s WIP.

FYI: I struggled to find the ONVIF port number for my camera but managed to find a link here.
Good luck.

stream:
camera:
    - platform: onvif
      host: 192.168.1.124
      port: 8080
      name: ESCAM01ONVIF
      username: redacted
      password: redacted

In my case port 80 is working.
Just make sure you add onvif userin the camera web admin and set him as Media consumer

camera:
  - platform: onvif
    name: Terasa jih
    host: 192.168.1.238
    port: 80
    username: hass
    password: xxxxx