Hi Hubitat Community! This is my first public release of code of any kind. I'm a HW engineer so my coding skills are very limited. I tried to make this extremely flexible to maximize the number of use cases. I hope this is helpful to someone and I welcome any suggestions to improve/fix the code -- I'm new to Hubitat & Groovy development, so I might be making a lot of rookie mistakes or have inefficient code.
Description
Driver to receive alarms from Hikvision cameras with the "HTTP Listening"/"HTTP Data Transmission"/"Alarm Server" feature. This feature may only be available on cameras with FW newer than ~v5.5.xx
Hikvision Camera Setup
- Configuration -> Network -> Advanced Settings -> HTTP Listening (or Alarm Server):
- DestinationIP = [HubitatHubIP]
- URL = "/"
- Port = 39501
- Enable "Notify Surveillance Center" under Linkage Method for each event
Device Driver Setup
- Install driver on hub
- Add Virtual Device and Select this Driver
- Enter Camera IP Address and click "Save Preferences"
- Optionally, configure the sensors and buttons (see notes below)
Notes
- Three independent sensor capabilities: Motion, Presence, & Contact
- Each sensor has the following independent settings:
- Event Type Filter
- Inclusive vs Exclusive Filter Setting
- Sensor State Inversion Setting
- Alert Reset Time
- By default, the filters are empty and exclusive, so all event types will trigger all three sensors.
- To disable a sensor, leave the filter empty and make it inclusive
- Each sensor has the following independent settings:
- Six independent buttons
- Each button has the following independent settings:
- Event Type Filter
- Reset Time (for preventing multiple triggers in quick succession)
- By default, the buttons filters are empty, so nothing will trigger any of them
- Each button has the following independent settings:
Version History
2021-02-07: v1.0.0 - Initial Release
2021-02-08: v1.0.1 - Updated Instructions to include the renamed "Alarm Server" feature. Moved preferences{} inside metadata{}.
2021-02-15: v1.1.0 - Significant update to add 6 customizable buttons in addition to existing 3 sensors.
Example Use Cases
- Integrate your camera as a sensor suite to your home automation system:
- Set the Hikvision Camera to send alarms for the following events:
- Motion Detection
- Face Detection
- Intrusion Detection
- Line Crossing
- Unattended Baggage Detection
- All Network/HDD faults
- Configure driver to:
- Trigger the Motion Sensor in response to Motion Detection alarms
- Select "VMD" in the Event Type Filter
- Disable Exclusive Filter (to make it inclusive)
- Trigger the Presence Sensor in response to Face and Intrusion alarms
- Select "fielddetection" & "facedetection" in the Event Type Filter (Use Ctrl & Shift)
- Disable Exclusive Filter (to make it inclusive)
- Set the Presence Alert Reset Time to 30 sec
- Trigger the Contact Sensor in response to everything else
- Select "VMD", "fielddetection", & "facedetection" in the Event Type Filter
- Leave the Exclusive Filter setting enabled (to exclude the events already handled by the motion & presence sensor), but respond to everything else
- Trigger the Motion Sensor in response to Motion Detection alarms
- Set the Hikvision Camera to send alarms for the following events:
- Problems with package theft? Monitor the front porch for packages.
- Set the Hikvision Camera to send alarms for the following events:
- Unattended Baggage Detection
- Object Removal Detection.
- Configure the driver to:
- Button 1: Select "unattendedBaggage" in the Event Type Filter
- Button 2: Select "attendedBaggage" in the Event Type Filter
- Create a rule in Rule Machine (Example below)
- Trigger on Button 1, Button 2
- Check which button was "pushed" and send the appropriate message
- Set the Hikvision Camera to send alarms for the following events: