Finally found a decent & cheap IP camera: Dericam

I also noticed that the second (not working with HA) camera was not working with Synology Surveliance station until I selected ‘streaming’ only, as below:

Ok the second camera is now online with HA…!

I can’t as with the ONVIF config that are in your initial post I have just a card with a broken page, nothing about UPnP status.
And the “streaming mode” is not applicable to HA, is it?

I don’t understand the ONVIF protocol or how streaming works in HA, I am just hacking away at the settings to find what works

What works for me:

      - platform: onvif
        name: [NAME]
        host: [IP on same subnet as HA]
        username: admin
        password: [My password]
        port: 8080
        profile: 1

Where port 8080 is the configured ONVIF-port

  • I have only letters and numbers in my password
  • My cameras http-port is configured to 80
  • I have unchecked Privilege and Time Zone Settings in the ONVIF-settings
  • I have disabled NTP and DST in “Time”-settings under “System”.

And ONVIF works for me now.

1 Like

I can confirm that my camera configured according to your instructions works as ONVIF one in this Lovelace card:

entity: dericam
type: picture-entity

I played with it a bit and can say that the only important thing is port as it’s 5000 by default, hence the camera won’t work without setting it in the component or in the camera settings.
My camera works just fine with NTP/DST enabled, Time Zone enabled and Privilege: Check (have no idea what it is).

The most interesting bit is profile: I presumed that 0 is first stream, 1 is second stream and 2 is mobile phone stream, but it says in the logs:

WARNING (MainThread) [homeassistant.components.onvif.camera] ONVIF Camera ‘dericam’ doesn’t provide profile 2. Using the last profile.

Any idea how to find out what video resolution does the component get to map profiles to streams?
If you run HA on a hardware that struggles to render hi-resolution video, try a stream with lower resolution (i.e profile 1, 2, etc).

The main reason of having ONVIF camera to me was in being able to call camera.onvif_ptz service, but it doesn’t work on 0.93.1 - if I try to tilt or pan, if says in the logs:

ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1862350864] Cannot be called from within the event loop
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py”, line 121, in handle_call_service
connection.context(msg))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1141, in async_call
self._execute_service(handler, service_call))
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1163, in execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/onvif/camera.py”, line 84, in async_handle_ptz
entity_ids = extract_entity_ids(hass, service)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 99, in extract_entity_ids
async_extract_entity_ids(hass, service_call, expand_group), hass.loop
File "/usr/local/lib/python3.7/site-packages/homeassistant/util/async
.py", line 138, in run_coroutine_threadsafe
raise RuntimeError(‘Cannot be called from within the event loop’)
RuntimeError: Cannot be called from within the event loop

And when HA starts, there is:

WARNING (MainThread) [homeassistant.components.onvif.camera] PTZ is not available on this camera

but we can PT if logging in via a browser.
Any ideas how to make that work in HA?

It cannot connect to my camera on Step 4 - “Disconnected”.
I also tried their Android app - doesn’t work, sees my camera but always says “Connect Failed” on Step 4. Manual setup fails as well.

On the other hand, Onvifer successfully connects to it and allows PT and transfers video-audio via LAN. G726 codec doesn’t work for me (G711 only).

I think so. You need this: http://ipcamcontrol.net/files/_DericamCGI-HD.pdf
You could test with this command: http://[your-ip]/cgi-bin/hi3510/ptzctrl.cgi?-step=1&-act=right&-speed=45 (taken from page 23)

And the use the command with this method: https://www.home-assistant.io/cookbook/foscam_away_mode_PTZ/

1 Like

Wow, it works in a browser, but how can we control our cameras in HA?
It’s onvif after all…

UPDATE: was excited about CGI functionality and forgot to check the second link… :
Looks promising, but why this camera cannot be controlled by camera.onvif_ptz?
I mean, anyone can adapt the Foscam method, but it every single Dericam’s user has to do the same, a huge waste of time, additional code etc… weird.

Read the post above yours.

ok both my Dericam are operating fine for the last couple of weeks. I have also enabled motion detection using the ffmpeg_motion integration and the RTSP stream from the Dericam. Config below (obviously you need to update the rtsp url to your own):

binary_sensor:
  - platform: ffmpeg_motion
    input: rtsp://admin:[email protected]:554/11
1 Like

Are you experiencing any lag on the rtsp stream? I bought the 1080p version and theres a 10 second delay in the video feed and motion sensor (thanks for posting that update!)

1 Like

You mean a delay when viewing through HA? Yes I think thats normal. However no noticeable lag on the official Dericam app

Fixed the lag in HA, in the camera web UI set Key Frames to 2, defaults to 50.

1 Like

ONVIF PTZ works with OnvifDeviceManager on Windows. Anything I can do to get the ONVIZ PTZ the camera has working with HA?

OK appears one of my dericams has broken after only a couple of months. Therefore I have to say that I no longer recommend this brand

So what’s wrong with it?
And it’s only one chinese cam, maybe it’s not that bad of it’s only one and you bought it from Amazon? :wink:

Would you guys still recommend this camera or is there something better?

Well the software issues appear to be resolved. I sent back one of the two, but the remaining one is going strong. For the money they are hard to beat IMO

I currently have both P1 and P2 but playing with P2 as it has better resolution.
It works via Dericam Android app, Onvifer and web interface.
However, its motion detection feature is pretty useless as I had to set sensitivity to 15 because it kept generating alerts during night time.
I also was unable to set up email settings, it just keep saying Failed without any reason so debugging is pretty tough :\

Do I get it right that it is possible to use abovementioned ffmpeg motion binary sensor instead of the camera’s one? How does that impact the system’s performance (I use it at RPi3)?

Hi. Did you manage to sort out the sensitivity on the Dericam? I’ve just installed one and even with the setting at 1 it seems to be set off by a cat sneezing(!)

The email problem is probably because it is a “less secure app” as far as your email provider is concerned. I have GMAIL and had the same issue. You can allow less secure apps to access your Google account (not recommended) or set up 2 factor authorisation and then set up an “app password” for the Dericam. It took a while to work that out.