Network UPS Tools (nut) setup issues

I can’t seem to get this binding working, hoping someone can help me spot the issue.

openhab.cfg:

############################### NetworkUpsTools Binding ###############################
#
# networkupstools:<instance name>.<parameter>=<value>
#
# Refresh interval for state updates in milliseconds (optional)
networkupstools:ups1:refresh=15000
# UPS device name
networkupstools:ups1.device=ups
# UPS server hostname (optional)
networkupstools:ups1.host=192.168.178.100
# UPS server port (optional)
networkupstools:ups1.port=3493

.items file:

String  STRING_UPS_STATUS       "UPS status [%s]"               (COMPUTERS)             { networkupstools="ups1:ups.status" }
Number  NUMBER_UPS_CHARGE       "UPS charge [%d %%]"            (COMPUTERS)             { networkupstools="ups1:battery.charge" }

I also tried upping the log level of the binding, however it doesn’t seem to be outputting anything extra
Logback.xml:

<logger name="org.openhab.binding.networkupstools" level="TRACE" additivity="false">
<appender-ref ref="FILE" />
</logger>

All I can find in the openhab.log file is:

geert@riddler:~/openHAB-1.7.1$ cat logs/openhab.log | grep -i networkups
2015-10-30 15:50:23.327 [DEBUG] [b.n.i.NetworkUpsToolsActivator] - NetworkUpsTools binding has been started.

The server running openHAB does seem to have the proper permissions to query the nut server:

geert@riddler:~/openHAB-1.7.1$ upsc ups@192.168.178.100
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: not set
battery.mfr.date: 2013/01/24
battery.runtime: 1462
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.7
battery.voltage.nominal: 12.0
device.mfr: APC
device.model: Back-UPS ES 550G
device.serial: 5B1304T02694  
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 5
driver.parameter.port: auto
driver.version: SDS5-2-2015Q1branch-5619-150904
driver.version.data: APC HID 0.95
driver.version.internal: 0.38
input.sensitivity: medium
input.transfer.high: 266
input.transfer.low: 180
input.voltage: 236.0
input.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 870.O2 .I
ups.firmware.aux: O2 
ups.load: 20
ups.mfr: APC
ups.mfr.date: 2013/01/24
ups.model: Back-UPS ES 550G
ups.productid: 0002
ups.serial: 5B1304T02694  
ups.status: OL
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d

I’m at a loss here, any help would be greatly appreciated!
p.s. the nut server in question is a default Synology install

If the ups instance is referenced as “ups” here maybe the items have to be referenced accordingly?
From:
networkupstools=“ups1:ups.status”
to:
networkupstools=“ups:ups.status”

Not according to the documentation:

Gave it a go anyway, no dice though :frowning:

hm, its working for me the only difference is I use a user/password which is my last suggestion to try… :neutral_face:

Tried adding a username and password, still no luck.
Could you please post relevant parts of your setup (minus username and password)?

Could the warning displayed by upsc be tripping up the module?
“Init SSL without certificate database”

I wish the binding would have some debug output…

Turns out I was facing the same problem as the guy in this topic.
Was about to post my findings when I saw his post.

Hi All

Can someone tell me whats required to monitor a Cyberpower UPS from OpenHAB thats connected via USB to a NAS? Its remote. I want OH2 to be a NUT slave

There is alot of conflicting information and the documentation for the networkups tools isn’t very good.

Thanks!

You would need to deploy the NUTS “server” on the NAS and establish comms via the USB cable to the UPS unit

You can then link one or more NUTS “clients” to this server remotely (over IP)

Then one of the “client” hosts would be your OH2 host with the NUTS Binding.

Most of the openHAB docs don’t deal with the actual NUTS setup. They describe how to configure the binding, assuming that you have NUTS properly up and running.

The QNAP is already running as Master and can see the UPS connected, displaying the battery etc just fine.

The linking is what i need help with. the OH2 server is a client. I put it in the allowed list on the QNAP.

I have done this in the past and I don’t remember the details (it’s fire and forget type of stuff :slight_smile:)
Maybe take a look at: https://networkupstools.org/documentation.html

The OH2 docs don’t cover this aspect (installation and configuration of NUTS):

Which part is conflicting?

I’m monitoring the UPS attached to the QNAP NAS with the following networkupstools.cfg:

# Refresh interval for state updates in milliseconds (optional)
refresh=60000

# UPS device name
ups1.device=qnapups

# UPS server hostname (optional)
ups1.host=<QNAP_ip>

# UPS server port (optional)
ups1.port=3493

# UPS server login (optional)
ups1.login=admin

# UPS server pass (optional)
ups1.pass=<password>

ups.items:

Group gUPS "UPS" <ups> (All)
//Number gUPS_Output_Voltage "UPS output voltage [%.1f V]" (gUPS) {networkupstools="ups1:output.voltage"}
Number UPS_Battery_Charge "Battery level [%d %%]" (gUPS) {networkupstools="ups1:battery.charge"}
Number UPS_Battery_Voltage "Battery voltage [%.1f V]" (gUPS) {networkupstools="ups1:battery.voltage"}
Number UPS_Input_Voltage "Input voltage [%d V]" (gUPS) {networkupstools="ups1:input.voltage"}
Number UPS_Input_Voltage_Nominal "Input nominal [%d V]" (gUPS) {networkupstools="ups1:input.voltage.nominal"}
Number UPS_Current_Load "Current load [%d %%]" (gUPS) {networkupstools="ups1:ups.load"}
String UPS_Battery_Runtime "Runtime [JS(duration_from_seconds.js):%s]" <clock> (gUPS) {networkupstools="ups1:battery.runtime"}

Thank you , can you show me your configuration file on the QNAP? I think this is my gap…

Is this from a remote host running OH2 or OH2 is running directly on the NAS?

What configuration file on the QNAP?
The UPS is setup in web interface… no config file…

OH2 is running on a VM on QNAP.

1 Like

How do you know what the username and password is? The Web interface has no area to configure that

The username is admin and the password is the admin's one.
The same ones that you’re using to connect to QTS as administrator.

Oh I see.

Did you install the NUT client on the OH2 machine also? or just the networktools binding?

I see this in my /var/log/syslog


Dec  7 18:05:07 openhab2 systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
Dec  7 18:05:07 openhab2 upsmon[6828]: fopen /var/run/nut/upsmon.pid: No such file or directory
Dec  7 18:05:07 openhab2 upsmon[6828]: Unable to use old-style MONITOR line without a username
Dec  7 18:05:07 openhab2 upsmon[6828]: Convert it and add a username to upsd.users - see the documentation
Dec  7 18:05:07 openhab2 upsmon[6828]: Fatal error: unusable configuration
Dec  7 18:05:07 openhab2 upsmon[6828]: Network UPS Tools upsmon 2.7.4
Dec  7 18:05:07 openhab2 systemd[1]: nut-monitor.service: Control process exited, code=exited status=1
Dec  7 18:05:07 openhab2 systemd[1]: nut-monitor.service: Failed with result 'exit-code'.

did you have to deploy and configure upsc (the client component) on the VM or it works also without a local NUTS deployment? I don’t remember in this moment.

If I am not wrong, you need NUTS installed and configured also on the OH2 host

I think it works like this:

OH2 -> NUTS Binding -> upsc -> upsd -> USB -> UPS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  xxxxxxxxxxxxxxxxx
          local                     remote