domoticz-ipcc - Dahua/Hikvision Events via MQTT/Domoticz
Goal: Easily Integrate your IP Security Cameras into your Home Automation project as Motion Detectors, with Alarm IO.
Source: https://github.com/nayrnet/domoticz-ipcc
Issue Reporting: https://github.com/nayrnet/domoticz-ipcc/issues
WiKi: https://github.com/nayrnet/domoticz-ipcc/wiki
ok I hinted at this in my automation roll out thread, and I released a raw dahua API module yesterday, but I just wrapped up the first beta release of my IP Camera Controller. Only Dahua support right now, Hikvision support coming VERY soon, and I can help add support for any vendor that implements a similar http alarm stream.. I started off with multiple vendor support in mind so this project should extend very well.. If your interesting in helping with development/testing/hardware/documentation contact me through here or Github
This will probably work just fine on all Unixes without modification, windows users might have luck also but you may have trouble detecting a camera dropping off the network and reconnecting.. as I dont believe the module I used for modifying TCP sockets timeout works on windows, I tried to make it cross platform but that was required to quickly detect a camera suddenly disconnecting. if someone is willing to come up with a cross platform solution I'll be happy to take pull requests.. until then consider windows untested and unsupported.
Ok so what does this do? It connects to all your supported cameras's and monitors an alarm stream, when an alarm event is triggered on the camera the software INSTANTLY publishes the change via MQTT for your Automation Software to then read..
Whats MQTT? Well Basically its a Publish/Subscribe messaging system for IoT devices... in the simplest example:
You connect to the same MQTT Broker as IPCC (localhost usually), subscribe to ipcc/CameraName/VideoMotion, and now any time there is motion detected you will be pushed a value of true, and when motion subsides you will be pushed a value of false.. Many home automation controllers, sensors and devices are capable of communicating via MQTT and if yours is not its very easy to use external apps and scripts to retrieve the data you need.
standard MQTT Flow:
This is a very popular protocol for interfacing Arduino's and other little IoT (Internet of Things) devices so everything is using the same interfaces without constantly polling for updates and getting slow responses.. for example if you setup a bunch of wired motion sensors to an arduino on your network it would be a piece of cake to use existing MQTT libraries to publish PTZ presets to react to those changes, while also allowing your arduino to react to motion/inputs events from the camera for more advanced logic and control.. (like make sure its not looking at something more important before telling it to move)
And now about Domoticz, so you dont want to figure out MQTT and handling the raw data? Well its already setup to talk to Domoticz out of the box, and that is the development priority.. it is also Free Open Source software and supports ZWave/RfLink/Insteon/X10/Hue and many more, plus it has a ton of notification options like email/pushover/kodi/growl/nma/etc.. at the very least you can simply use Domoticz as the scripting and logic engine for your IPC's and nothing else. Domoticz comes with three very easy to use scripting languages, Python (Advanced), Lua (Simple) and Blocky (Graphical), provides easy to access SunRise/Set calculations, timers, etc.. You can download precooked images for the Raspberry Pi, that will get you going with full GPIO support right out of the gate.. I couldn't make this any easier for you guys if I tried, and I really am.. but be prepared for a ride if you not already versed in Linux... If this was windows oriented you'd be paying for it, so your welcome.
This is my NVR Philosophy, use my Home Automation system for all Notifications/Logic/Control and simply record 24/7/365 to a network share.. If you need to review any footage use standard viewers and inspect logs contained within the Home Automation software to locate the times of events... I've found blowing away the old idea of NVR software and going for the Automation Device strategy far more feature rich and extendable solution.. especially for us using linux, ZoneMinder is a total joke by modern standards.. IMHO Cameras make better TCP connected Motion Sensors for Home Automation than they do for triggering recordings.. Video Motion detection seems to work so much better at telling an automation system something is going on so real logic can be put around its reactions.. compared to stupidly firing off binary tasks with no other thought about how many times its been happening, or whats most important if it gets conflicting events.. and if you have a PTZ you'll definitely feel these pains.
Future Support:
Cheers,
-R
PS: A bit of Eyecandy
Domoticz Logs, the graph is dynamically zoomable, exportable as image or raw data, it was a very windy day and I had these set to go off with the slightest motion.. great for development
Domoticz Devices:
Goal: Easily Integrate your IP Security Cameras into your Home Automation project as Motion Detectors, with Alarm IO.
Source: https://github.com/nayrnet/domoticz-ipcc
Issue Reporting: https://github.com/nayrnet/domoticz-ipcc/issues
WiKi: https://github.com/nayrnet/domoticz-ipcc/wiki
ok I hinted at this in my automation roll out thread, and I released a raw dahua API module yesterday, but I just wrapped up the first beta release of my IP Camera Controller. Only Dahua support right now, Hikvision support coming VERY soon, and I can help add support for any vendor that implements a similar http alarm stream.. I started off with multiple vendor support in mind so this project should extend very well.. If your interesting in helping with development/testing/hardware/documentation contact me through here or Github
This will probably work just fine on all Unixes without modification, windows users might have luck also but you may have trouble detecting a camera dropping off the network and reconnecting.. as I dont believe the module I used for modifying TCP sockets timeout works on windows, I tried to make it cross platform but that was required to quickly detect a camera suddenly disconnecting. if someone is willing to come up with a cross platform solution I'll be happy to take pull requests.. until then consider windows untested and unsupported.
Ok so what does this do? It connects to all your supported cameras's and monitors an alarm stream, when an alarm event is triggered on the camera the software INSTANTLY publishes the change via MQTT for your Automation Software to then read..
Whats MQTT? Well Basically its a Publish/Subscribe messaging system for IoT devices... in the simplest example:
You connect to the same MQTT Broker as IPCC (localhost usually), subscribe to ipcc/CameraName/VideoMotion, and now any time there is motion detected you will be pushed a value of true, and when motion subsides you will be pushed a value of false.. Many home automation controllers, sensors and devices are capable of communicating via MQTT and if yours is not its very easy to use external apps and scripts to retrieve the data you need.
standard MQTT Flow:

This is a very popular protocol for interfacing Arduino's and other little IoT (Internet of Things) devices so everything is using the same interfaces without constantly polling for updates and getting slow responses.. for example if you setup a bunch of wired motion sensors to an arduino on your network it would be a piece of cake to use existing MQTT libraries to publish PTZ presets to react to those changes, while also allowing your arduino to react to motion/inputs events from the camera for more advanced logic and control.. (like make sure its not looking at something more important before telling it to move)
And now about Domoticz, so you dont want to figure out MQTT and handling the raw data? Well its already setup to talk to Domoticz out of the box, and that is the development priority.. it is also Free Open Source software and supports ZWave/RfLink/Insteon/X10/Hue and many more, plus it has a ton of notification options like email/pushover/kodi/growl/nma/etc.. at the very least you can simply use Domoticz as the scripting and logic engine for your IPC's and nothing else. Domoticz comes with three very easy to use scripting languages, Python (Advanced), Lua (Simple) and Blocky (Graphical), provides easy to access SunRise/Set calculations, timers, etc.. You can download precooked images for the Raspberry Pi, that will get you going with full GPIO support right out of the gate.. I couldn't make this any easier for you guys if I tried, and I really am.. but be prepared for a ride if you not already versed in Linux... If this was windows oriented you'd be paying for it, so your welcome.
This is my NVR Philosophy, use my Home Automation system for all Notifications/Logic/Control and simply record 24/7/365 to a network share.. If you need to review any footage use standard viewers and inspect logs contained within the Home Automation software to locate the times of events... I've found blowing away the old idea of NVR software and going for the Automation Device strategy far more feature rich and extendable solution.. especially for us using linux, ZoneMinder is a total joke by modern standards.. IMHO Cameras make better TCP connected Motion Sensors for Home Automation than they do for triggering recordings.. Video Motion detection seems to work so much better at telling an automation system something is going on so real logic can be put around its reactions.. compared to stupidly firing off binary tasks with no other thought about how many times its been happening, or whats most important if it gets conflicting events.. and if you have a PTZ you'll definitely feel these pains.
Future Support:
- Switching Day/Night Mode via Domoticz & MQTT, because your Home Automation system knows best
- Sending Basic PTZ Commands in via Domoticz & MQTT (AutoTracking with limitless Sensors!)
- Controlling Camera IO Outputs, you can never have too many outputs in Home Automation.
Cheers,
-R
PS: A bit of Eyecandy
Domoticz Logs, the graph is dynamically zoomable, exportable as image or raw data, it was a very windy day and I had these set to go off with the slightest motion.. great for development


Domoticz Devices:

Last edited by a moderator: