Announcement

Collapse
No announcement yet.

MQTT for ONVIF Hikvision Video Doorbell

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MQTT for ONVIF Hikvision Video Doorbell

    An addon has been created to read the PIR sensor via ONVIF on the HikVision OEM doorbell.

    Note that the plugin doesn't read a doorbell press at this time.

    Been testing it to work great with HA and Homeseer running it in Docker on the micro Intel combo box.

    Will add the documentation here in pieces / baby steps.

    BTW it is on sale on Amazon as an EZViz Doorbell Camera for $89.99. I purchased my OEM Hikvision Doorbell for around $130 USD a few months ago.

    The Video doorbell doesn't depend on the cloud, does RTSP, ONVIF and JPG captures. It is working fine with HS4 Video camera stuff.

    Note the assumption is that you are familiar with Docker and have it installed.

    Have a read here

    Docker Hub
    GitHub onvif2mqtt

    1 - docker pull dfarkov/onvif2mqtt:latest

    2 - cd /opt

    3 - git clone hxxps://github.com/dmitrif/onvif2mqtt

    4 - cd /opt/onvif2mqtt

    5 - nano config.dev.yml

    6 - cp config.dev.yml /opt/onvif2mqtt/config.yml

    7 -
    docker run -d --name="onvif2mqtt" -v /opt/onvif2mqtt:/config -v /etc/localtime:/etc/localtime:ro --net=host --restart always dfarkov/onvif2mqtt

    8 - docker ps will show when you started it and it running.

    9 - MQTT Explorer shows it running. Here you can install use mcsMQTT in Homeseer or in Home Assistant MQTT Notes

    By default this package publishes events to an topic onvif2mqtt/$ONVIF_DEVICE/$EVENT_TYPE/ with a value of on | off for each captured event type. Templating / Custom Topics

    However, by using the api.templates option in configuration, one can define a custom subtopic and specify a custom template. The following tokens will be interpolated in both the subtopic and the template values:
    • ${onvifDeviceId} - name of the ONVIF device (e.g. doorbell)
    • ${eventType} - type of event captured (e.g. motion)
    • ${eventState} - boolean state of the event (if applicable)

    The messages will be sent to a topic of the following format: onvif2mqtt/$ONVIF_DEVICE/$SUBTOPIC.

    Edit the config.yml file
    # MQTT Broker configuration, # required due to nature of project. mqtt: host: 192.168.0.57 port: 1883 username: user password: password # All of your ONVIF devices onvif: # Name for the device (used in MQTT topic) - name: doorbell hostname: localhost port: 80 username: admin password: admin Define custom binary_sensor in HomeAssistant's configuration.yaml:

    binary_sensor doorbell_motion: - platform: mqtt name: doorbell_motion state_topic: "onvif2mqtt/doorbell/motion" Next to document is to integrate a doorbell auto pop up on the Amazon Show using Monocle and Amazon addon (used for TTS or HA sending commands to Alexa).


    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
    HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
    HS4 Lite -

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

    #2
    Teaser !

    THIS is something I'm very interested in, hoping it'll work with other Hikvision cameras as well.

    Comment


      #3
      Nice one! Pete ,

      I hope they role it (firmware) out on their cameras as well. The big ones also have smart tracking (PTZ Tracking)!
      Now not so first! Check this out : https://wiki.instar.com/Advanced_User/INSTAR_MQTT_Broker/ They cost a tonne of money (£200) They are not on Amazon US yet but.......... For more information look here : https://www.instar.com/outdoor-ip-cams.html
      Was looking at them then you posted this. So if if HikVison roles mqtt across the range it's worth waiting.




      Eman.
      TinkerLand : Life's Choices,"No One Size Fits All"

      Comment


        #4
        hoping it'll work with other Hikvision cameras as well.

        It should work fine if the camera does ONVIF and motion detection.
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
        HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
        HS4 Lite -

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

        Comment


          #5
          GitHub notes indicate it does not support Hikvidion DB2. What it does support is motion event for the doorbell and the author indicates other events could be done easily. Seems like the doorbell button push would seem like a natural event for a doorbell.

          This get me thinking that a good hack would be in the router to notify when certain URLs are routed. This could be used for any cloud device without a bridge needed for each specific client.

          Comment


            #6
            Yes it supports my new OEM Hikvision doorbell just relating to the motion PIR.

            Looks like this one and is sold relabeled by EZViz, RCA, et al.

            Click image for larger version

Name:	HikvisionOEM.jpg
Views:	539
Size:	20.5 KB
ID:	1373512

            It does not support first generation Hikvision Doorbell.

            That said he continues to work on the doorbell press ONVIF messages. So far only the PIR motion is working.

            Well too upgraded yesterday from version 1.0.1 to 1.0.3 and now it doesn't work. Waiting for update.

            Another user downgraded to version 1.0.2 and that one is working. Personally here only watching it with the MQTT Explorer. Waiting on connecting it to mcsMQTT.

            - Pete

            Auto mator
            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
            HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
            HS4 Lite -

            X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

            Comment


              #7
              Does the doorbell / OEM version have a setting for enabling Hikvision CGI ?

              If so, then an alternative to ONVIF>>mqtt would be to pick up the alertStream directly from the camera.
              https://www.hikvision.com/content/da...20Protocol.pdf





              Click image for larger version

Name:	Capture.PNG
Views:	537
Size:	22.0 KB
ID:	1373552

              Comment


                #8
                Does the doorbell / OEM version have a setting for enabling Hikvision CGI ?

                No. Other's have stated that Hikvision removed that in the firmware. That said I have two Hikvision openboard cameras that I am tinkering with and those include the HikVision CGI.

                Here is a Hikvision Doorbell 101 with much information on it.

                - Pete

                Auto mator
                Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
                Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
                HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
                HS4 Lite -

                X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                Comment


                  #9
                  Pete,

                  Can you test this one : https://github.com/eusfelix/hikvision-to-mqtt I installed it and PM2 seems to run the script without error but I can't get the events out of the camera I don't know what am doing wrong!

                  The instructions of how to here : https://www.iotwithus.com/getting-ev...vision-camera/



                  Eman.
                  TinkerLand : Life's Choices,"No One Size Fits All"

                  Comment


                    #10
                    Will do.
                    - Pete

                    Auto mator
                    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
                    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
                    HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
                    HS4 Lite -

                    X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                    Comment


                      #11
                      I would like to replace my Ring doorbell since it does not interface with Homeseer (Zee 2). I do not want to get an NVR, pay for cloud storage (a la Ring), or leave a computer running 24/7.

                      Is there a doorbell that does the following:
                      1. Runs off the power from my existing doorbell.
                      2. Has internal storage (and preferably works kind of like an internal NVR)..
                      3. Rings the chime when the doorbell is pressed.
                      4. Will send a notification to my phone when the doorbell is pressed (I don't think the Hikvision does this).
                      5. Will send a notification to my phone when it senses motion (like the Ring does, although it is sometimes laggy).
                      6. Will allow me to view video and communicate from my phone from the Homeseer Mobile App.
                      7. Will trigger Homeseer events when it senses motion or the doorbell is pressed (like turning on the front door light).
                      8. (Optional) integrates with Apple Homekit.

                      It would be nice it is had less lag than the Ring. Often by the time the video opens, whoever was at the door is already gone.

                      It would also be nice if all this could happen in the Homeseer Mobile app without a separate doorbell app, but that is probably asking too much.

                      Does this exist? The Hikvision or one of its clones seems to come closest.

                      Comment


                        #12
                        The HikVision or similar DB2:

                        1. Runs off the power from my existing doorbell.

                        Yes.

                        2. Has internal storage (and preferably works kind of like an internal NVR)..

                        Yes tested up to a 256Mb SD card.

                        3. Rings the chime when the doorbell is pressed.

                        Yes.

                        4. Will send a notification to my phone when the doorbell is pressed (I don't think the Hikvision does this).
                        5. Will send a notification to my phone when it senses motion (like the Ring does, although it is sometimes laggy).


                        Yes. This configuration is the Doorbell App which runs on iOS or Android.

                        6. Will allow me to view video and communicate from my phone from the Homeseer Mobile App.

                        Yes and no. Yes you will be able to see video via the Homeseer Mobile App (RTSP). No you will not be able to communicate with DB with the Homeseer Mobile App.

                        7. Will trigger Homeseer events when it senses motion or the doorbell is pressed (like turning on the front door light).

                        Yes and Yes. Use a hard contact switch (reed switch) in the doorbell chime or here mine is connected to the Security panel. Motion is triggered via MQTT and an MQTT ONVIF plugin.


                        8. (Optional) integrates with Apple Homekit.

                        I do not know.

                        ======================================

                        The neighbors here are still using the Ring doorbell I installed for them when I initially installed my Ring. They do not automate.

                        I am installing a RIng Alarm system for a family member and have it set up and working fine with Alexa today. Comes with built in failover to celluar.

                        Here not utilizing any Apps with my Hikvision doorbell and utilize VPN to get home and it works well with RTSP, ONVIF and JPG captures.
                        - Pete

                        Auto mator
                        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
                        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
                        HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
                        HS4 Lite -

                        X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                        Comment


                          #13
                          Thanks. I followed all of that except #7. I understand the idea of a reed switch in the chime box, but what does the reed switch trigger to send a signal to the Zee2? And as for motion, does the doorbell send MQTT? I assume there is an MQTT plugin for the Zee2?

                          Also, does the answer to 7 also take care of 4? For example, when the doorbell is pressed the Zee2 could send a text?

                          Comment


                            #14
                            Thanks. I followed all of that except #7. I understand the idea of a reed switch in the chime box, but what does the reed switch trigger to send a signal to the Zee2? And as for motion,

                            The reed switch is an alternative to my hard wired to alarm panel zone via the Elk 960 debounce board and Elk 930 doorbell board. It uses the magnetic generation of the door bell chime to trigger a switch.

                            You could connect the analog reed switch to a wireless Zigbee or ZWave contact or alarm wired zone switch if you wanted to. This will give you a sensor for the doorbell ring.

                            does the doorbell send MQTT? I assume there is an MQTT plugin for the Zee2?

                            Not natively. You would have to install a plugin which is doing ONVIF to MQTT for just the PIR sensor of the doorbell. Then install the mcsMQTT plugin to Homeseer. The plugin is not made for Homeseer. It is a generic MQTT plugin which runs in Docker. I am using it here for Home Assistant and Homeseer.

                            when the doorbell is pressed the Zee2 could send a text?

                            Yes and also when the motion sensor is triggered if you want. I have adjusted my motion sensor to trigger only when you are right up to the doorbell. That said I have noticed lately that Amazon, FedEx, UPS and USPS rarely trigger the doorbell these days. The motion sensor though triggers recordings any how. IE: when pressing the button for the doorbell it also triggers the motion sensor.
                            - Pete

                            Auto mator
                            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb- Mono 6.12.X
                            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro - Mono 6.12.X
                            HS4 Pro - V4.1.7.0 - Ubuntu 18.04/VB W7e 64 bit Intel Kaby Lake CPU - 32Gb - Mono 6.12.x
                            HS4 Lite -

                            X10, UPB, Zigbee, ZWave and Wifi MQTT automation. OmniPro 2, Russound zoned audio, Smartthings hub, Hubitat Hub, and Home Assistant

                            Comment


                              #15
                              [QUOTE=Pete;n1393979][I][B]

                              does the doorbell send MQTT? I assume there is an MQTT plugin for the Zee2?

                              Not natively. You would have to install a plugin which is doing ONVIF to MQTT for just the PIR sensor of the doorbell. Then install the mcsMQTT plugin to Homeseer. The plugin is not made for Homeseer. It is a generic MQTT plugin which runs in Docker. I am using it here for Home Assistant and Homeseer.

                              Thanks once again. I understand installing the mcsMQTT plugin on the Zee 2, but beyond that you lost me. I know nothing about Docker (I googled it and it said something about running applications in containers, which meant nothing to me.) Would Docker install on the Zee 2 and then the ONVIF to MQTT plugin on top of that, or would it have to be done on another machine. Again, I don't want to have to have a computer running 24/7 and the Zee can only handle 5 plugins total (I think I am at 3 now).

                              Sorry for my lack of technical knowledge. Just assume you are talking to a philosophy major (or maybe a third grader).

                              Comment

                              Working...
                              X