Motion and Noise detection for D-Link DCS-930L Camera

It’s not about configuration, and not about integration, so probably it’s about hardware support.


D-Link DCS-930LB1 is super cheap and reasonably usable out-of-the-box camera. I’ve bought one long time ago and mounted it outside, screwed it to a window frame in a flat on 19 floor to monitor parking spaces. This camera survived 3 russian winters, but then I moved to London, and start using it as home security camera, mostly to look after my pet cat.

This camera (and I believe many other D-Link cameras as well) has neat cloud service to stream video, which is also push motion and noise alerts.


When I started playing with HASS, this camera was first one I wanted to intergate. l googled some forums quickly and found that camera has no consistent API, just bunch of random endpoints. Tutorials are only contains streams URLs and control handlers from UI.

I’ve also tried to mitmproxy camera’s traffic in both directions, and found that folks from D-Link employed Certificate Pinning, so it didn’t happen.

Sadly, IFTTT is also not working for this camera for some reason.

I’ve tried to debug cloud app for this, where I found that MJPEG stream seems containing some data in Date header, but it didn’t really correlate with motion.

Date: 07-01-2018 11:00:43 PM IO_00000000_PT_005_000
Date: 07-01-2018 11:00:43 PM IO_00010000_PT_005_000

Yet I desperately wanted to hack it, so I started googling any API endpoint for all D-LInk cameras from same price bracket. There I found some mentions about NIPCA-API, Network IP Camera Application Programming Interface.


I found that most of endpoints I’ve found before are in that manual. Particularly, it contained two endpoints, /config/motion.cgi, /config/notify.cgi and /config/notify_stream.cgi, which has motion detection config, statuses of all events, and feed of notification information (long-polled) respectively

For some reason, some of handlers from /config returns 403 Forbidden (probably not implemented), and easiest one, /config/notify.cgi was one of them (motion config is inaccessible for me too).

I accidentally found that /motion.cgi contains needed info, even in another format. Also, long-poll version of notification stream is also working.





I’ve used upnp component/sensor as a source (because I patched it before), and overloaded standard MjpegCamera.

Sadly, my camera contains no specific UPNP services or devices, so I’m trying to poll ‘magic’ URL /common/info.cgi using presentationURL, until I find properly responding device.

I still not figured out how to use discovery framework to ask the password interactively, so I’m storing it in config.

Please test! Originally posted on my website.

1 Like

Hi - this looks promising!

I have followed instructions, but I do not see anything loaded in Home Assistant. What is the domain and format of the component that should load (if successful) e.g. hass_nipca. ?

It should be camera.${camera_name} and binary_sensor.${sensor_name}. I’m now refactoring the code to properly upstream it.

1 Like

I update this code for new home assistant versions:

I now not need this code and i not upgrade it, but you can use it


Thankies for this! I need this code again, so I’ll try to make it upstream

I noticed you are using custom mjpeg_url and still_image_url. Could you please send me with the sensor info so I could look if autodetection is possible?

It is available if you click on the motion sensor, like this one:

So with my camera:

version: 2.01
build: 03
hw_version: A
nipca: 1.9.7

Running on:
version: 0.112.4

I am able to get a sensor working with the code from
@Fernando_Castro dave-code-ruiz

@yottatsa (thanks also) I can see you had updated yours more recently.
Probably to address …

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for nipca doing I/O at custom_components/nipca/, line 177: req = requests.get(url, auth=self._auth, timeout=10)


But with yours, I don’t get any sensors or entity’s
Are you able to help?

The only hint I can see even with

  default: info
    homeassistant.components.nipca: debug

Is the below.

ERROR (MainThread) [custom_components.nipca] Invalid URL '//common/info.cgi': No schema supplied. Perhaps you meant http:////common/info.cgi?

I would assume the above error is also the reason my sensor stops working after an undetermined amount of time.

The camera is still on the network.
Postman calls return valid current info
It just seems to the component freezes with @Fernando_Castro dave-code-ruiz’s code

Thanks for any assistance.

1 Like