Cyberpower PDU SNMP intergration help

Any configuration help Ican get would be greatly appreciated!

I picked up a Cyberpower PDU - PDU15SW8FNET - on the cheap and I have been trying to get the switches and sensors setup using SNMP and I am struggling. The website functions fine, but HA is so much smoother.

Here is the product website which has the MIB file on it - PDU15SW8FNET - Switched - Product Details, Specs, Downloads | CyberPower

This is my error message from the logs -
SNMP error: No SNMP response received before timeout

I have the below in my config.yaml


snmp:

  ###########################################
  # TOTAL CURRENT
  ###########################################
  - name: pdu_total_current
    host: 192.168.5.177
    community: public
    version: "2c"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.2.3.1.1.2.1
    unit_of_measurement: "A"
    device_class: current
    state_class: measurement
    scan_interval: 30

  ###########################################
  # PER OUTLET CURRENT
  ###########################################
#############################################
# CyberPower PDU15SW8FNET
#############################################

############################
# SNMP SENSORS
############################

  # Total Current
  - name: pdu_total_current
    host: 192.168.5.177
    community: public
    version: "2c"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.2.3.1.1.2.1
    unit_of_measurement: "A"
    device_class: current
    state_class: measurement
    scan_interval: 30

  # Outlet Currents
  - { name: pdu_outlet1_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.1, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet2_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.2, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet3_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.3, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet4_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.4, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet5_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.5, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet6_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.6, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet7_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.7, unit_of_measurement: "A", device_class: current, state_class: measurement }
  - { name: pdu_outlet8_current, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.5.1.1.5.8, unit_of_measurement: "A", device_class: current, state_class: measurement }

  # Outlet Status Sensors
  - { name: pdu_outlet1_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.1 }
  - { name: pdu_outlet2_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.2 }
  - { name: pdu_outlet3_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.3 }
  - { name: pdu_outlet4_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.4 }
  - { name: pdu_outlet5_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5 }
  - { name: pdu_outlet6_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.6 }
  - { name: pdu_outlet7_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.7 }
  - { name: pdu_outlet8_status, host: 192.168.5.177, community: public, version: "2c", baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.8 }

############################
# TEMPLATE POWER SENSORS
############################
template:
  - sensor:
      - name: pdu_total_power
        unit_of_measurement: "W"
        device_class: power
        state_class: measurement
        state: "{{ states('sensor.pdu_total_current')|float(0) * 120 }}"
      - { name: pdu_outlet1_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet1_current')|float(0) * 120 }}" }
      - { name: pdu_outlet2_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet2_current')|float(0) * 120 }}" }
      - { name: pdu_outlet3_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet3_current')|float(0) * 120 }}" }
      - { name: pdu_outlet4_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet4_current')|float(0) * 120 }}" }
      - { name: pdu_outlet5_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet5_current')|float(0) * 120 }}" }
      - { name: pdu_outlet6_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet6_current')|float(0) * 120 }}" }
      - { name: pdu_outlet7_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet7_current')|float(0) * 120 }}" }
      - { name: pdu_outlet8_power, unit_of_measurement: "W", device_class: power, state_class: measurement, state: "{{ states('sensor.pdu_outlet8_current')|float(0) * 120 }}" }

############################
# OUTLET SWITCHES
############################
switch:
  - platform: snmp
    name: pdu_outlet1
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.1
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet2
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.2
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet3
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.3
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet4
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.4
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet5
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.5
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet6
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.6
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet7
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.7
    payload_on: 1
    payload_off: 2

  - platform: snmp
    name: pdu_outlet8
    host: 192.168.5.177
    community: private
    version: "2c"
    baseoid: 1.3.6.1.4.1.3808.1.1.3.3.3.1.1.4.8
    payload_on: 1
    payload_off: 2


Check your OID paths with a GUI SNMP browser (often called a SNMP walk).

Make sure your OID is a leaf in the tree and not a branch.
Many tools can deduct the leaf from a branch or at least the first leaf in the branch. HA do not have this ability though, so it needs to be a leaf OID.

I did try MIB browser - I think I needed to remove the last .1 for the pdu total current to make it match the walk, but I am still getting the same no response error.

Ok - working back from scratch - knowing even just a small amount more than before - I did find another error in my yaml that may have caused a hiccup. I am also starting much smaller scale to try and go with baby steps.

sensor:
    platform: snmp
    name: pducurrent
    host: 192.168.5.177
    community: public
    version: "1"
    baseoid: .1.3.6.1.4.1.3808.1.1.3.2.3.1.1.2
    unit_of_measurement: "A"
    device_class: current
    state_class: measurement
    scan_interval: 30

With this edit I no longer get the error, but I don’t see anything when i click the entity.

That is exactly for har you must not do.

That could be because you do not have the leaf IOD

Ok so I added the 1 back in, and now it’s reading data.

But I am still confused- in the MIB browser screenshot it doesn’t show the last “.1” in what I believe is the leaf. Is this just me not knowing how OIDs work?

I appreciate the response.

That is what I mentioned earlier, some programs can deduct the leaf, if they are given the branch just above the leaf.

Yes you did mention it - that’s on me for not understanding.

Is the last leaf always a .1 or can it vary based upon the OID - such as outlet numbers being 1-8 in this case?

And thank you.

It can vary.
A branch can have up to 9 leafs.
.1 is usually always used, but you might not need that one on the branch.

Hi @Goferlisk - did you get this all up and running smoothly in HA?

Hello!

I was able to get 1 sensor working for total current of the whole PDU. I spent another hour or so trying to get more things working to no avail.

I have several PDUs, and wanted them in HA. I created an app: SNMP to MQTT Bridge.

In general, You add in this app Your PDU (if Your doesn't have profile already, You can create one, o i can try to prepare). Right now i support some APC, ATEN and Energenie.

SNMP integration in HA is very basic, i found that app will be better in this case, cause every manufacturer of PDU have own quirks etc. how to use SNMP. And HA SNMP integration is not good. Also, to test anything You need to restart HA ... with app it works better.