Network UPS Tools (nut) setup issues

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

Now you see why its confusing.

Do you need a nut client on OH2? or is the binding a replacement!

1 Like

EDIT: just came up. Is there anything else I need to do to OH2 to have it receive a power signal to shutdown if the UPS sees power loss?


18:11:55.792 [INFO ] [smarthome.event.ItemStateChangedEvent] - UPS_Battery_Runtime changed from NULL to 1050
18:11:55.797 [INFO ] [smarthome.event.ItemStateChangedEvent] - UPS_Current_Load changed from NULL to 33
18:11:55.799 [INFO ] [smarthome.event.ItemStateChangedEvent] - UPS_Input_Voltage changed from NULL to 237.0
18:11:55.801 [INFO ] [smarthome.event.ItemStateChangedEvent] - UPS_Input_Voltage_Nominal changed from NULL to 230
18:11:55.804 [INFO ] [smarthome.event.ItemStateChangedEvent] - UPS_Battery_Voltage changed from NULL to 26.4
18:11:55.806 [INFO ] [smarthome.event.ItemStateChangedEvent] - UPS_Battery_Charge changed from NULL to 80

I have the nut-client installed on the OH2 machine, but I don’t think it is required.
Actually, I think it’s unconfigured. The file /etc/nut/nut.conf is the default one.

1 Like

OK, cool. Do you use any Windows VMs on the QNAP or other VMs you signal a shut down for?

yeah, it seems that the NUTS Binding acts directly as a client to the NUTS daemon
the other client components are used to shutdown the O/S on the remote host and they are not needed by the binding

1 Like

This is what the documentation needs to spell out :slight_smile:

1 Like