NUT APC UPS connected with AP9619 network card

Awesome, worked. Thanks.

Spent hours looking for this information. Come to find out, i just need to modify the yaml inside of the NUT Server add on configuration, inside of home assistant os.

Hi –

Newbie here. Was wondering if you can point me to where I need to go and what I need to create\edit the ups.conf file. I got 2 cyberpower switches I want to monitor\get data on. I been trying to get NUT working, but with no success. Many thanks.

How are you connecting to these UPS… USB, ethernet?

Two blade CyberPower UPS’s I am connecting to via rmcard205’s ethernet card that plugs into them. I have revised this post because it appears I need a NUTS server. I am trying to leverage the built in HA integrations, not develop or add new ones. While I do plan on resetting HA up on a Pi. It is currently running on a VM. I am not sure if this would work and the post is quite old.

https://peterkieser.com/2020/11/16/home-assistant-sensors-and-cyberpower-ups-via-rmcard205/

The code writer has not updated this in 2 years so it may not be worth pursuing for the reason above. Leverage existing integrations from vendors, not re-invent the wheel. Thanks to all who helped.

Hi!
I have an old su1400inet with AP9617 network card, please can i have an help to configure sensor, i have no expericence about, you have a guide?
I don’t know how to setup from start.
Thank you

For Cyberpower and APC UPSes using Network connection, this is what I found to work.

- name: ups-PR2000RTXL2U
  driver: snmp-ups
  port: 192.168.1.10
  snmp_version: v3
  secLevel: authPriv
  authProtocol: SHA
  authPassword: 0123456789ABCDEF
  privProtocol: AES
  privPassword: 0123456789ABCDEF
  desc: description does not work
  config: []
  
- name: ups-apc-x2200
  driver: snmp-ups
  port: 192.168.1.11
  snmp_version: v3
  secLevel: authPriv
  authProtocol: MD5
  authPassword: 0123456789ABCDEF
  privProtocol: DES
  privPassword: 0123456789ABCDEF
  desc: description does not work
  config: []

Hi,

Wanted to revisit, but do need clarification. The code for ups.conf should I add that to a device running NUT server? I already have NUT add-on configured on a desktop with a USB attached UPS. Can a second or third be added under NUT add-on config or should this be on device where NUT is installed? Does it matter where its configured?

I never got the nut addon to work, so i went the configuration.yaml route.
Just past the code into your config yaml and change to your settings and you should have connection to the ups and entities to work with.
make sure you allow smnp connection on the ups network card

#UPS test section start

sensor:
  - platform: snmp
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.2021.10.1.3.1
    
  - platform: snmp
    name: ups_smart_capacity
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.1.0
    accept_errors: true
    unit_of_measurement: '%'
  - platform: snmp
    name: ups_smart_runtime_remaining
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.3.0
    accept_errors: true
    value_template: >-
      {% set time = (value | int) / 100 | int %}
      {% set minutes = ((time % 3600) / 60) | int %}
      {% set hours = ((time % 86400) / 3600) | int %}
      {% set days = (time / 86400) | int %}
    
      {%- if time < 60 -%}
        Less than a minute
        {%- else -%}
        {%- if days > 0 -%}
          {{ days }}d
        {%- endif -%}
        {%- if hours > 0 -%}
          {%- if days > 0 -%}
            {{ ' ' }}
          {%- endif -%}
          {{ hours }}h
        {%- endif -%}
        {%- if minutes > 0 -%}
          {%- if days > 0 or hours > 0 -%}
            {{ ' ' }}
          {%- endif -%}
          {{ minutes }}m
        {%- endif -%}
      {%- endif -%}
  - platform: snmp
    name: ups_smart_load_percentage
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.3.0
    accept_errors: true
    unit_of_measurement: '%'
  - platform: snmp
    name: ups_smart_battery_temperature
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.2.0
    accept_errors: true
    unit_of_measurement: '°C'
  - platform: snmp
    name: ups_smart_battery_status
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.2.2.4.0
    accept_errors: true
    value_template: >-
      {%if value == '1' %}
        Good
      {% elif value == '2' %}
        Failed
      {% endif %}
  - platform: snmp
    name: ups_smart_type
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.1.1.1.0
    accept_errors: true
  - platform: snmp
    name: ups_smart_input_voltage
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.3.2.1.0
    accept_errors: true
    unit_of_measurement: 'V'
  - platform: snmp
    name: ups_smart_last_transfer_reason
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.3.2.5.0
    accept_errors: true
    value_template: >-
      {%if value == '1' %}
        No events
      {% elif value == '2' %}
        High line voltage
      {% elif value == '3' %}
        Brownout
      {% elif value == '4' %}
        Loss of mains power
      {% elif value == '5' %}
        Small temporary power drop
      {% elif value == '6' %}
        Large temporary power drop
      {% elif value == '7' %}
        Small spike
      {% elif value == '8' %}
        Large spike
      {% elif value == '9' %}
        UPS self test
      {% elif value == '10' %}
        Excessive input voltage fluctuation
      {% endif %}
  - platform: snmp
    name: ups_smart_output_load
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.3.0
    accept_errors: true
    unit_of_measurement: '%'
  - platform: snmp
    name: ups_smart_output_current
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.2.4.0
    accept_errors: true
    unit_of_measurement: 'A'
  - platform: snmp
    name: ups_smart_last_self_test_result
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.7.2.3.0
    accept_errors: true
    value_template: >-
      {%if value == '1' %}
        OK
      {% elif value == '2' %}
        Failed
      {% elif value == '3' %}
        Invalid Test
      {% elif value == '4' %}
        Test In Progress
      {% endif %}
  - platform: snmp
    name: ups_smart_last_self_test_date
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.7.2.4.0
    accept_errors: true
  - platform: snmp
    name: ups_smart_communication_status
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.8.1.0
    accept_errors: true
    value_template: >-
      {%if value == '1' %}
        on
      {% elif value == '2' %}
        off
      {% endif %}
  - platform: snmp
    name: ups_smart_status
    host: 192.168.178.102
    baseoid: 1.3.6.1.4.1.318.1.1.1.4.1.1.0
    accept_errors: true
    value_template: >-
      {%if value == '1' %}
        Unknown
      {% elif value == '2' %}
        On Line
      {% elif value == '3' %}
        On Battery
      {% elif value == '4' %}
        On Smart Boost
      {% elif value == '5' %}
        Timed Sleeping
      {% elif value == '6' %}
        Software Bypass
      {% elif value == '7' %}
        Off
      {% elif value == '8' %}
        Rebooting
      {% elif value == '9' %}
        Switched Bypass
      {% elif value == '10' %}
        Hardware Failure Bypass
      {% elif value == '11' %}
        Sleeping Until Power Returns
      {% elif value == '12' %}
        On Smart Trim
      {% endif %}

#UPS test section end

@Darkyputz - Thanks for posting this code. I do have 2 CyberPower ups’s with rmcard205’s in them. Would prefer to see temps in °F. I have noticed in the past I was never able to get temps using a script like this as a package developed by someone else. I think that is because I need the optional Enviro Sensor that connects to the Universal port on the rmcard205. Been trying to confirm this before spending $100 on one. Wondering if in fact I do need the optional card.

Hello…
Which temp are you referring about?
Battery temp stated from the UPS?
When you get a Celsius value returned from this script, you can take that value, create a new entity and fill this entity with a calculated Fahrenheit value and use that for display instead

I would assume battery temp, but I have never been able to get a temperature with 2 UPS’s with rmcard205’s installed using code from this guy:

https://peterkieser.com/2020/11/16/home-assistant-sensors-and-cyberpower-ups-via-rmcard205/

Also when I log into UPS’s via the assigned address given to the rmcard205 I don’t see any reference to temp anywhere.

I have been using NUT successfully with USB plugged directly into my home assistant server and get lots of info…

- name: living-room-ups-network
  driver: snmp-ups
  port: 10.0.150.109
  snmp_version: v3
  config: []
- name: living-room-ups-usb
  driver: usbhid-ups
  port: auto
  config: []

problem is when I try to connect to it over IP address, I can get only IP, and USB stops working. I tried changing the order, which didn’t help and adding a carriage return, but saving deletes the return. The other issue is that when connected through the network, I only get the sensors but no diagnostics. If I remove the networked UPS from the config, then the USB connection starts working again. This must not be the correct way to add another UPS to my NUT add-on.

I got 3 Pi’s running NUT and the UPS’s are from CyberPower (1325, SX550Ga, SL750u). I don’t see an option to get Battery Temp. Would like to see it. Was curious what brand UPS you were using. This is using usbhid-ups

I am using a couple of very old APC SU2200 with probably equally old AP9617 10/100BaseT network management cards.

Is that a different UPS from the screenshot above, and reference to USB…?
Didn’t think that AP9617 has USB, only Ethernet (10/100) ?

Hi there
Sorry to bring that old one back up, but I configured on my AP9640 SNMPv3 and used @NathanR |s example config.

users:
  - username: user
    password: SecretPassword
    instcmds:
      - all
    actions: []
devices:
  - name: ups
    driver: snmp-ups
    port: 192.168.1.111
    snmp_version: v3
    secLevel: authPriv
    secName: homeassistant
    authPassword: secret1
    privPassword: secret2
    authProtocol: MD5
    privProtocol: DES
    config: []
mode: netserver
shutdown_host: "false"

I receive:

Add-on version: 0.13.1
You are running the latest version of this add-on.
System: Home Assistant OS 13.0  (amd64 / qemux86-64)
Home Assistant Core: 2024.8.3
Home Assistant Supervisor: 2024.08.0

[...]

[18:07:29] INFO: Starting the UPS drivers...
Created directory: /var/lib/snmp/cert_indexes
Startup timer elapsed, continuing...
Network UPS Tools - UPS driver controller 2.8.0
cont-init: info: /etc/cont-init.d/nut.sh exited 1
cont-init: info: running /etc/cont-init.d/nutclient.sh
cont-init: info: /etc/cont-init.d/nutclient.sh exited 0
cont-init: warning: some scripts exited nonzero
s6-rc: warning: unable to start service legacy-cont-init: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.

The container stops immediately and I have no chance looking into it. Any ideas?

I could never figure things out properly.

I think it’s a malformed config file.

It works with SNMPv1 perfectly fine.

One of the devs was helping on the gihub repo IIRC you can maybe go find those messages and try to get SNMPv3 working?

In the next few months I’m going to fix it due to having time at work again and the need for securing those devices.


  1. Try it with basic config (SNMPv1)
  2. Try it with advanced config (SNMPv3)
devices:
  - name: ups
    driver: snmp-ups
    port: 192.168.1.111
    desc: "apc-x2200"
config:
  snmp_version = v3
  secLevel = authPriv
  authProtocol = MD5
  authPassword = secret1
  privProtocol = DES
  privPassword = secret2
1 Like

well…
You have to configure the access controls. Everything is blocked by default in the new FW, even if snmp v1 is enabled.
so: v1 is working, v3 is failing, but also with snmpwalk - I’ll dig into it.

I did dig into it and what should I say… I’ll switch to the native SNMP integration and hack down OIDs manually. No additional tool with fishy configs.

Here’s my solution: Get data from APC Smart + Network Management Card via SMTP - #22 by man55

I used the iReasoning MIB browser and looked for the appropriate values from the APC PowerNet MIB.
(don’t forget to add a .0 at the end)