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.
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.
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
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
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
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?
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.
Thanks for the script. Would you have any suggestion of how to edit the YAML for an additional APC UPS so the sensor information would differentiate between (2) devices?