I thought it would be a good idea to start a dedicated thread for this camera and compile all the info related to using it in openHAB.
The camera is sold under these names (the hardware is identical):
HIKVISION DS-HD1 (has Onvif in its supplied firmware, use the older 200321-2020-03-31 firmware)
RCA HSDB2A
EZVIZ DB1
LAVIEW LV-PDB1630-U (has Onvif in its supplied firmware)
NELLY’S NSC-DB2 (has Onvif in its supplied firmware)
LTS LTH-7132-WIFI
If you buy a brand that is not marked as having Onvif, you can install the firmware from one of the ones that do to gain the ONVIF support, but you run the risk of bricking the camera. Details on that and much more is found here:
https://ipcamtalk.com/threads/new-rca-hsdb2a-3mp-doorbell-ip-camera.31601/page-101#post-412577
Pros for the camera:
- Low purchase price.
- Cloud is optional, so no ongoing monthly fees to pay after you purchase.
- Works behind a strict firewall/subnet (after setup is done) with some limitations listed below.
- Easy to setup.
- ONVIF motion events are sent which use a PIR sensor to keep false positives low.
- Night vision that does not sleep, so you can monitor a stream all night long.
- No batteries and only 2 wires. Can be powered by existing 8 to 24 volt AC or DC transformers. I’m using an old 12volt AC halogen lighting transformer for downlights that electricians throw in the bin every week.
Limitations to be aware of:
- Snapshot url does not work in the latest firmwares, use Hikvision 200321-2020-03-31 firmware to get working ONVIF and snapshots at http://ip:80/onvif/snapshot
- Camera is 2K resolution so can not be cast to a Chromecast or Nest Home Hub unless you switch the ULTRA mode off and use the camera in HD mode. Chromecasts that support 4k will probably work with ULTRA turned on.
- Getting access to the on board uSD card recordings needs the app ( requires giving the camera internet access for the app to work) or a Hikvision utility program may possibly work on your local network. You can use a NVR or openHAB to make the recordings instead.
- Changing some camera settings require giving the camera and app access to the internet or using a utility program.
- Mainstream RTSP is limited to only 2 open streams. The IpCamera binding can easily feed 6 tablets all at once for you and only use 1 open stream leaving one spare. The binding can use them all up if you go crazy on using multiple features at the same time or if you use an NVR which will take a stream away.
- Substream RTSP (lower resolution) is limited to only 1 stream open and can work when the mainstream is in use.
- No Hikvision API support, so this needs to be setup as ONVIF and will get auto found and setup by the binding.
- Aspect ratio is 4:3 and is a fish eye lens. May not match with other cameras you own but this can be a feature as it allows you to see a parcel on the ground under the camera.
- Doorbell button does not get sent as an event. You can use Zwave reed door sensors mounted near a magnetic bell, or a simple relay instead of bell unit can be used to short a door sensor out and inform openHAB. Another solution to detect the button press is found here:
Alternatives to look at if this model does not suit:
- Dahua AD-110 and the newer AD-410 have the Dahua API included in these doorbells, so will have lots of features that work out of the box with the IpCamera binding.
- Any Bullet or Dome style camera that has an API from Amcrest, Dahua, Hikvision and Instar as these brands have models that support alarm input terminals that can be wired up to any doorbell button. Their APIs will send the pushes back to openHAB and also can directly trigger recordings even if openHAB is down (redundancy built in).
- Doorbird make a big range of cameras designed for doorbell and gate access.
- Dahua VTO2202F-P is a POE doorbell with ONVIF but the night vision only turns on after the button is pushed. You can install external IR floods which has the plus of keeping bugs away from the camera.
Example of how to get this camera working:
things
Thing ipcamera:onvif:Doorbell "Doorbell" @ "Cameras"
[
ipAddress="192.168.1.174", password="ABC123", username="admin", serverPort=54321,
alarmInputUrl="rtsp://192.168.1.174:554/Streaming/Channels/102",
ffmpegOutput="/etc/openhab2/html/Doorbell/"
]
items
Number Doorbell_recordingGif "Update GIF" { channel="ipcamera:onvif:Doorbell:recordingGif" }
String Doorbell_gifHistory "GIF History" { channel="ipcamera:onvif:Doorbell:gifHistory" }
Number Doorbell_gifHistoryLength "GIF History Length" { channel="ipcamera:onvif:Doorbell:gifHistoryLength" }
Number Doorbell_RecordingMP4 "MP4 Record" { channel="ipcamera:onvif:Doorbell:recordingMp4" }
String Doorbell_MP4History "MP4 History" { channel="ipcamera:onvif:Doorbell:mp4History" }
Number Doorbell_MP4HistoryLength "MP4 History Length" { channel="ipcamera:onvif:Doorbell:mp4HistoryLength" }
Dimmer Doorbell_ffmpegMotionControl "Motion Threshold [%d]" { channel="ipcamera:onvif:Doorbell:ffmpegMotionControl" }
Switch Doorbell_ffmpegMotionAlarm "FFmpeg Motion" { channel="ipcamera:onvif:Doorbell:ffmpegMotionAlarm" }
Switch Doorbell_externalMotion "External trigger for Motion" { channel="ipcamera:onvif:Doorbell:externalMotion" }
Switch Doorbell_motionAlarm "Video Motion" { channel="ipcamera:onvif:Doorbell:motionAlarm" }
Switch Doorbell_PIRAlarm "PIR Motion" { channel="ipcamera:onvif:Doorbell:cellMotionAlarm" }
String Doorbell_lastMotionType "Last Motion Type" { channel="ipcamera:onvif:Doorbell:lastMotionType" }
Dimmer Doorbell_audioThreshold "Audio Threshold [%d]" { channel="ipcamera:onvif:Doorbell:thresholdAudioAlarm" }
Switch Doorbell_audioAlarm "Audio Detected" { channel="ipcamera:onvif:Doorbell:audioAlarm" }
Switch Doorbell_startStreamingHLS "Start TestCams HLS" { channel="ipcamera:onvif:Doorbell:startStream" }
String Doorbell_mjpegStreamUrl "Mjpeg Url" { channel="ipcamera:onvif:Doorbell:streamUrl" }
String Doorbell_rtspUrl "RTSP Url" { channel="ipcamera:onvif:Doorbell:rtspUrl" }
String Doorbell_HLS "Front Door" { channel="ipcamera:onvif:Doorbell:hlsUrl", synonyms="door bell, front camera", ga="Camera" [ protocols="hls" ] }
sitemap
Text label="FrontDoor Camera" icon="camera"{
Slider item=Doorbell_ffmpegMotionControl
Switch item=Doorbell_ffmpegMotionAlarm
Slider item=Doorbell_audioThreshold
Switch item=Doorbell_audioAlarm
Switch item=Doorbell_motionAlarm
Switch item=Doorbell_PIRAlarm
Text item=Doorbell_lastMotionType
Video url="http://192.168.1.2:54321/autofps.mjpeg" encoding="mjpeg"
Text label="Mjpeg Stream" icon="camera"{Video url="http://192.168.1.2:54321/ipcamera.mjpeg" encoding="mjpeg"}
Text label="HLS Stream" icon="camera"{Webview url="http://192.168.1.2:54321/ipcamera.m3u8" height=15}
}
rules
rule "Auto Front Doorbell"
when
Item Doorbell_PIRAlarm changed to ON
then
//KitchenHomeHubPlayURI.sendCommand("http://192.168.1.2:54321/ipcamera.jpg") //can send jpg whilst GIF is recorded.
if(Doorbell_RecordingMP4.state == 0 || Doorbell_RecordingMP4.state == NULL){
var DoorbellMp4TimeStamp = new DateTimeType().format("%1$ty-%1$tm-%1$td_%1$tH-%1$tM-%1$tS").toString
//may run out of streams if recording to 2 formats and watching unless you use gifPreroll.
getActions("ipcamera", "ipcamera:onvif:Doorbell").recordGIF("ipcamera",5)
getActions("ipcamera", "ipcamera:onvif:Doorbell").recordMP4(DoorbellMp4TimeStamp,5)
}
if(BabyMonitor.state==ON){
KitchenHomeHubVolume.sendCommand(30)
sendBroadcastNotification("Someone is at the door and baby is alseep.")
} else{
KitchenHomeHubVolume.sendCommand(70)
}
KitchenHomeHubPlayURI.sendCommand("http://192.168.1.2:8080/static/doorbell.mp3")
end
rule "Send doorbell GIF to HomeHub and Pushover"
when
Item Doorbell_recordingGif changed to 0
then
KitchenHomeHubPlayURI.sendCommand("http://192.168.1.2:54321/ipcamera.gif")
sendPushoverMessage(pushoverBuilder("GIF from Doorbell").withApiKey("xxxxxxxxxx").withUser("xxxxxxxxxxx").withDevice("MattPhone").withAttachment("/etc/openhab2/html/Doorbell/ipcamera.gif"))
end
Advanced options worth looking at:
-
How to display a history of the visitors to your house. Custom Widget: Camera History and Live Popup
-
This line added to your things file will CROP the fisheye into a 16:9 aspect ratio GIF so that it fits without black bars onto screens you cast it onto. Looks scary but since FFmpeg is widely used it is easy to find an article like this one https://www.linuxuprising.com/2020/01/ffmpeg-how-to-crop-videos-with-examples.html
gifOutOptions="-r 2 -filter_complex crop=iw:0.44*ih:0:1/3*ih,scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse"
- If you get false positives from the PIR or perhaps have a cat that sets it off during the night, you may like to play with the CROP to create a Line crossing style alarm. Use the
motionOptions
in the thing file and enter a Crop that allows FFmpeg to look for motion in a much smaller area, or in a narrow rectangle. You can also use this to block out trees that move or people that walk past on a footpath. I’m guessing the syntax would be the following, so if you get it working please post what you found was good and also how much CPU it uses to have that running.
motionOptions="-vf crop=iw:0.44*ih:0:1/3*ih"