Hikvision Doorbell Camera – Chime and Motion Sensor

Purchased the Hikvision Doorbell with an independent power supply unit, as I’ve read mixed reviews on powering it from the mechanical chime.

Whilst the camera run out of the box without issues, it left a gap in terms of a chime!

So this was my solution, which as serendipity goes also lead me to a way to pull the motion sensor state.

Requirements:

• Hikvision doorbell
HIk-Connect (Hikvision camera application)
• Media_player (chromecast, sonos, bose, whatever)
Tasker
Autonotification
Mqtt Client
• Download an mp3 bell chime and place in www/doorbell (one site)

Basic concept is autonotification intercepts the push-messages from Hik-Connect and fires an action (mqtt message) via Tasker.

Doorbell Chime

  1. In tasker add profile > event > plugin > autonotification
    In autonotification > intercept >configuration > Apps (select Hik-Connect) > Notification Text (type – You have a call request from a visitor.) and select/checkmark exact.

  2. Back, back
    New task > plugin > mqttclient > publish mqtt message.
    Add the state topic (for example homeassistant/sensor/doorbell
    Add payload (for example 1)
    Back, back save.

binary_sensor:

  • platform:
    name: “Doorbell Chime”
    state_topic: “homeassistant/sensor/doorbell”
    device_class: sound
    payload_on: “1”
    payload_off: “0”

automation:

  • id: doorbell_chime
    alias: Doorbell chime
    initial_state: on
    hide_entity: true
    trigger:
    • platform: state
      entity_id: binary_sensor.doorbell_chime
      from: ‘off’
      to: ‘on’

action:

  • service: media_player.volume_set
    data:
    entity_id: media_player.chromecastaudio
    volume_level: 0.9
  • service: media_player.play_media
    data_template:
    entity_id: media_player.chromecastaudio
    media_content_id: ‘http://192.168.1.XXX:8123/local/doorbell/doorbell-2.mp3
    media_content_type: audio/mp4

Doorbell Motion Sensor

  1. In tasker add profile > event > plugin > autonotification
    In autonotification > intercept>configuration > Apps (select Hik-Connect) > Notification Text (type – DoorBell Motion Detection Alarm) and select/checkmark exact.

  2. Back, back
    New task > plugin > mqttclient > publish mqtt message.
    Add the state topic (for example homeassistant/sensor/bellsensor
    Add payload (for example 1)
    Back, back save.

binary_sensor:

  • platform: mqtt
    name: “Doorbell Motion”
    state_topic: “homeassistant/sensor/bellsensor”
    device_class: motion
    payload_on: “1”
    payload_off: “0”

Sensor Reset Automation

Since the sensors only trigger to “on”, we have to create an automation to reset the payload to off after afew seconds.

  • id: reset_doorbell_sensor
    alias: Reset doorbell sensor
    initial_state: ‘on’
    trigger:

    • platform: homeassistant
      event: start
    • platform: state
      entity_id:
      • binary_sensor.doorbell_chime
      • binary_sensor.doorbell_motion
        to: ‘on’
        for:
        seconds: 10

    action:

    • service: mqtt.publish
      data:
      topic: ‘homeassistant/sensor/doorbell’
      payload: ‘0’
    • service: mqtt.publish
      data:
      topic: ‘homeassistant/sensor/bellsensor’
      payload: ‘0’

Apologies for the block quotes, but I still dont know how to use this. See below link to hastebin for clarity

https://hastebin.com/dutufawafo.bash

8 Likes

So this could work for the button press as well probably, not just motion. Great work! I’ll have to look into this.

@jschwalbe.
yes, it works with the button press. That was my main motivation; getting the sensor state was an after-thought.

@juan11perez: It seems it is linked to the Android App on your phone, do you get also notifications when you are not at home (and your phone is with you)?

Other question: Should this work for iPhone too?

1 Like

Yes, you’ll get notifications on your phone if the hikvision app is installed. you’ll need to deactivate the push notification in your mobile if you dont want it.

you can use the ios app for notifications, but obviously not for the bridge as there’s not ios tasker.

1 Like

Hello,

I noticed this thread is about a year old, but wanted to give it a shot anyway.

Does Home Assistant actually listen for an event from the doorbell, by using some API accessible even? (with ISAPI or CGI?)
I am looking for a way to access the “button press” in this doorbell directly, on the doorbell device.

Thanks,

Ron

unfortunately not. I couldnt get the button press directly,
I use auto notification and tasker to capture the mobile app message and ring the bell.

Ah … too bad. It is relatively simple to detect motion on a doorbel, that can be configured to be done with FTP, to a local FTP server for example. The button itself might be trickier.

If nothing else, I might have to get wireshark inbetween… BUT there are different ports. 80, 443, 8000, 9010 and 49152

I dont have an Android phone and are trying to install Hik Connect in Genymotion. Anyone done this?

@juan11perez

Juan

Thanks for this. I’m trying to adapt this to be able to use the cheaper $50 doorbells.

However, I’m having problems with the MQTT set up. I’m using a Ring Pro as the test device and I can get the automation working when Ring’s binary_sensor.doorbell_chime triggers.

Now trying to set up using your set up as I’m sure that I won;t be able to get a Hassio integration with the no brand devices on AliExpress etc.

I set up a new binary_sensor:

  - platform: mqtt
    name: “Doorbell Chime”
    state_topic: ringmqtt/sensor/doorbell
    device_class: sound
    payload_on: “1”
    payload_off: “0”

Automation is set up:

- id: '1566911056607'
  alias: Doorbell Chime via MQTT
  trigger:
  - entity_id: binary_sensor.doorbell_chime
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: media_player.google_mini
      media_content_id: http://192.168.YY.ZZ:8123/local/doorbell-ring-ding-dong-sound.mp3
      media_content_type: audio/mp3
    service: media_player.play_media

Configuration in the Android MQTT Client:

Nickname: Ringmozzy
Broker: 192.168.YY.ZZ:1883
Topic: ringmqtt/sensor/doorbell
Payload: 1

Tasker is set up as per your instructions but connected to Ring and with the text = RegEx with Someone is at your Front Door (as appears on my phone when the Ring rings)

Reason for RegEx instead of Exact is that there’s a bell emoji at the beginning of the message. Is this the problem? If so how to get around that?

Note: When I manually run the MQTT task thru Tasker I see the correct result in the MQTTBox subscription on my PC:

1

qos : 0, retain : false, cmd : publish, dup : false, topic : ringmqtt/sensor/doorbell, messageId : , length : 27, Raw payload : 49

Looking at the MQTT Broker logs I am seeing an error:

1566917933: New connection from [Android with Tasker IP 192.168.AA.BB] on port 1883.
1566917933: Socket error on client , disconnecting.

Thanks in advance!

Sorry to revive an old thread. Just took reception of a Hikvision DS-KB6403-WIP
I’ve managed to set the tasker profile as you described, but it looks as though I’m not getting a notification for the doorbell button press, I only get “The call request has been cancelled”.
Here is what shows up when I press the doorbell button:

Any idea how to catch this?

Also you said you managed to use the hikvision binary_sensor. I have that sensor successfully setup for my other Hikvision cameras, but for the doorbell it doesn’t work.
I get this in my logs:

2019-11-28 23:54:11 ERROR (SyncWorker_26) [pyhik.hikvision] Unable to fetch deviceInfo, error: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2019-11-28 23:54:11 ERROR (SyncWorker_26) [homeassistant.components.hikvision.binary_sensor] Hikvision event stream has no data, unable to set up

Any idea?

Thanks anyway for a great post :slight_smile:

I’ve since simplified this profile. Basically I use AutoNotification Intercept to intercept the app call and then use http to post a trigger to an automation that rings the doorbell. Here’s some screen shots of my tasker conf on the “bridge” tablet.

  1. profile + autonotification setup.






  1. doorbell task + conf (disregard steps 2 to 4, i use the same task to open the camera view on the tablet, you can do similar)


  1. delete hikvision notification

  1. automation
- id: notify_doorbell_chime # this automation uses sensor from tasker/autonotification and triggers door chime
  alias: Notify doorbell chime
  initial_state: true
  trigger:
  - platform: webhook
    webhook_id: doorbell 
  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.chromecastaudio
      volume_level: 0.9
  - service: media_player.play_media
    data_template:
      entity_id: media_player.chromecastaudio, media_player.masterroom
      media_content_id: 'http://192.168.1.100:8123/local/doorbell/doorbell-2.mp3'
      media_content_type: audio/mp4
2 Likes

Thanks a lot for your quick reply.
I think I’m stuck as no notification is being sent.
So looking at other ways to do it. Like using the app opening as a trigger and adding some conditions like whether there was motion detected in the last ~15 sec before the app was open…

Did you say you managed to use the standard hikvision binary_sensor to work? That doesn’t seem to work for me. I may need to raise an issue on git with my doorbell. I have the DS-KB6403-WIP, I believe you have the DS-KB6003-WIP ?

when you press the doorbell there’s a communicaton doorbell>cloud>your app.
Tasker intercepts the call to the app on your phone/tablet. If the app rings when the door button is pressed, then you should be able to intercept it?

I use motioneye, so I use mqtt within motioneye to create a motionsensor in homeassistant.

Thanks. So my mobile devices are iOS so still trying to find my feet with tasker
Can you confirm which url you use with motioneye?
I use project motion and haven’t managed to oui the RTSP stream in it. Even with VLC it stalls rather quickly. Not sure if it’s a Bandwidth or doorbell issue

ah… so tasker as you know only android. So you’ll need an android tablet or something like that.

this is the motioneye url
rtsp://192.168.1.xx:554/Streaming/Channels/101

and this is the string for the motion sensor under “motion detection”

mosquitto_pub -h 192.168.1.100 -t cameras/frontdoor/motion -u -P -m ON

which connects to this binary sensor:

- platform: mqtt  #motioneye sensors
  name: "Frontdoor Motion"
  state_topic: "cameras/frontdoor/motion"  
  device_class: motion
  payload_on: "ON"
  off_delay: 5
  unique_id: frontdoor_motion

Thanks. That’s the URL that I use for my other hikvision cams, but doesn’t work for the doorbell for some reason.
The only one that works is:
rtsp://admin:[password]@192.168.0.xx/ch1/main/av_stream
Even then only the full res (main) works, the 2nd channel (sub) opens up then freezes in VLC.
I’m raising a ticket with Hikvision.

Anyway, thanks a bunch for your help again.

oh, that’s unfortunate.
you’re right my model is 6003. There might be some differences.

one more thing, were you able to login into the camera via the web interface and check settings? onvif etc??

looking at the cameras on the hikvision they look the same…

Thanks Yes I managed to connect to the web interface. (Had to to enable the Surveillance Centre settings)
Just double checked again and noticed there is a newer firmware build which I originally missed, and it fixed the low res RTSP :slight_smile:
Now the only thing that doesn’t work is the motion detection binary_sensor.
I had to use port 80 instead of 8000 like on my other cams for the sensor to be detected, but motion is never detected, so I raised an issue on mezz64’s git:

good,
we’ll if you’re using motioneye you can use the sensor i provided.