Monitor your Hikvision NVR

in case this is useful for someone, this how I monitor my NVR from Home Assistant via SNMP.
This is the final result:

image

Process:

1.- Enable SNMP in your Hikvision NVR:

2.- Create your sensors: (sensors.yaml)

 ################# HIKVISIOn NVR ##############################
  - platform: snmp
    name: 'nvr_uptime'
    community: public      
    host: 192.168.86.40
    baseoid: 1.3.6.1.2.1.1.3.0
    accept_errors: true
    unit_of_measurement: 'days'
    value_template: '{{((value | int) / 8640000) | int}}'

  - platform: snmp
    name: 'nvr_hikonline'
    host: 192.168.86.40
    baseoid: 1.3.6.1.4.1.50001.1.102.0
    accept_errors: true
    value_template: >-
      {% if value is equalto "1" %}
        Online
      {% else %}
        Offline
      {% endif %}
  - platform: snmp
    name: 'nvr_hikdevice_status'
    host: 192.168.86.40
    baseoid: 1.3.6.1.4.1.50001.1.230.0
    accept_errors: true
    value_template: >-
      {% if value is equalto "1" %}
        Online
      {% else %}
        Offline
      {% endif %}
  - platform: snmp
    name: 'nvr_disk_free_space'
    host: 192.168.86.40
    baseoid: 1.3.6.1.4.1.50001.1.241.1.4.1.0
    accept_errors: true
    unit_of_measurement: 'MB'
    value_template: '{{((value | int) / 1024) | int}}'
  - platform: snmp
    name: 'nvr_disk_size'
    host: 192.168.86.40
    baseoid: 1.3.6.1.4.1.50001.1.241.1.5.1.0
    accept_errors: true
    unit_of_measurement: 'MB'
    value_template: '{{((value | int) / 1024) | int}}'
  - platform: snmp
    name: 'nvr_cpu_frequency'
    host: 192.168.86.40
    baseoid: 1.3.6.1.4.1.50001.1.201.0
    accept_errors: true
  - platform: template
    sensors:
      nvr_disk_free_percent:
        friendly_name: 'NVR Disk Free'
        unit_of_measurement: '%'
        value_template: '{{ (((states.sensor.nvr_disk_free_space.state | float) / (states.sensor.nvr_disk_size.state | float)) * 100) | round(1) }}'

3.- Customize the icons: (customize.yaml)

sensor.nvr_cpu_frequency:
  icon: mdi:chip
sensor.nvr_disk_free_percent:
  icon: mdi:harddisk
sensor.nvr_uptime:
  icon: mdi:timer
sensor.nvr_hikdevice_status:
  icon: mdi:cctv
sensor.nvr_hikonline:
  icon: mdi:security-network

4.- Lovelace Card (iu-lovelace.yaml)

  - type: glance
    title: Hikvision NVR
    icon: mdi:cctv
    entities:
      - entity: sensor.nvr_hikdevice_status
        name: NVR
      - entity: sensor.nvr_hikonline
        name: HIKOnline
      - entity: sensor.nvr_uptime
        name: Uptime
      - entity: sensor.nvr_disk_free_percent
        name: Disk Free
      - entity: sensor.nvr_cpu_frequency
        name: CPU Freq
18 Likes

Thank you, it’s great.

1 Like

Can you get your NVR cameras URI streaming?
I have ds-7216 and I can’t get them.
Edit: it was misconfigured. I get them.

Cool!

I have been trying and enabled the access to the cameras but it keeps asking for credentials when I’m using the :65001+ ports but none of my credentials seems to work.

Is this similar to the issue you had?

No, I just tried to use live view via RTSP. My problem was that I hadn’t valid web user.
Why do you use 65000+ ports? Why don’t you use RTSP?

Out of desperation mostly :slight_smile:
I read somewhere that the lastest firmwares just do it that way.
I’ll give a shot to the RTSP to see how it goes

:slight_smile:
I read them too.
But now the live view works by RTSP and the HA Hikvision Binary Sensor not. It sees the sensors but the statement doesn’t change.

Do you know this User Guide?

I upgreded the firmware and no SNMP.

No, Thanks for that.
I’m checking now

I’m in firmware V4.1.50 build 180423, all good with the SNMP

What kind of NVR do you have?

I have a DS-7608NI-I2 / 8P. I checked the firmware and it says I’m in the latest one.
Both the SNMP and the sensors work for me, and RSTP now works using your link. :clap:

Notice they removed it from one version then reinstated in the next.

Took me a few hours to figure out all the details- might help someone else if your trying to get RTSP or HTTP Pictures from your Hikvision NVR:
Just remove () and insert your data- such as your RTSP port or HTTP port from your NVR network page under configuration of your NVR.

rtsp://(IPAddress):(RTSP Port)/Streaming/Channels/101/

http://(IPAddress):65001/PSIA/Streaming/channels/1/picture

http://(IPAddress):(HTTPPort80?)/PSIA/Streaming/channels/101/picture

http://(IPAddress):(HTTPPort80?)/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels/101/picture

http://(IPAddress):(HTTPPort80?)/PSIA/Streaming/channels/101/picture?videoResolutionWidth=1920&videoResolutionHeight=1080

http://(IPAddress):(HTTPPort80?)/ISAPI/Streaming/channels/101/picture

http://(IPAddress):(HTTPPort80?)/ISAPI/ContentMgmt/StreamingProxy/channels/101/picture

3 Likes

Thank you worked flawlessly.

Just gave this a go with my NVR. I cant even get it to pickup sensors. I’ve updated the Hikvision 7616 6ch POE to enable SNMP without issue. Is the method in the first post still working?

Yes, it works flawlessly for me.
Just make sure you have the right IP addresses.

Hi,

I tried your code. I can’t get it to show up in lovelace. Can you help me ? Thanks.

Ric

You should use icon for the sensor not card…