Network UPS

I’ve been using it for some time now and it works for me. I’ve got mine Cyberpower UPS connected via USB to a Synology (Master) and OH2 on a RP3. OH can send commands to the UPS and read the stats.Need to test more but it seems ok so far.

Mine is on another machine.
So still the same it connects. Gets the data. Kills the refresh service for some reason and never restarts it…

Enabling the DEBUG console didn’t reveal anything.

the сfg is like

 ups1.device=powercom
 ups1.host=172.x.x.x
 ups1.port=3493
 refresh=60000

have you tried to setup the cfg with networkupstools: in front as in OH1?

Just did. Same problem

2016-06-17 22:48:35.937 [INFO ] [b.core.service.AbstractActiveService] - NetworkUpsTools Refresh Service has been started
2016-06-17 22:48:35.944 [INFO ] [b.core.service.AbstractActiveService] - NetworkUpsTools Refresh Service has been shut down

And receives the values only once (see the timestamp)

 2016-06-17 22:48:43.146 [INFO ] [ome.event.GroupItemStateChangedEvent] - g_UPS changed from 232 to 232 through z_ups_voltage
 2016-06-17 22:48:43.148 [INFO ] [marthome.event.ItemStateChangedEvent] - z_ups_voltage changed from NULL to 232
 2016-06-17 22:48:43.159 [INFO ] [ome.event.GroupItemStateChangedEvent] - g_UPS changed from 232 to UNDEF through z_ups_frquency
 2016-06-17 22:48:43.162 [INFO ] [marthome.event.ItemStateChangedEvent] - z_ups_frquency changed from NULL to 50
 2016-06-17 22:48:43.169 [INFO ] [marthome.event.ItemStateChangedEvent] - z_ups_status changed from NULL to OL
 2016-06-17 22:48:43.177 [INFO ] [marthome.event.ItemStateChangedEvent] - z_ups_load changed from NULL to 10
 2016-06-17 22:48:43.184 [INFO ] [marthome.event.ItemStateChangedEvent] - z_ups_charge changed from NULL to 100
 2016-06-17 22:48:43.192 [INFO ] [marthome.event.ItemStateChangedEvent] - z_ups_runtime changed from NULL to 65535

after some fiddling networkupstools works for me using a 1.9.0 snapshot under OH2. I had to add the “networkupstools:” prefix in the config file for the binding to get it to start.

Okkkkkety. Thanks for the head up i really don’t know how i missed that topic. Indeed i had 1.8.3 binding wgetted into the addons dir. But now i have stopped the OH2, removed the file, wgetted the snapshot form your link but it seems not enough to get rid of? Do i need to run OH2 bundle commands as it seems the problem is the same

See the thread that watou linked. Run bundle:list on the openhab console. If you see the 1.8.3. binding listed as active, you need to run bundle:uninstall.

If you’re running openhab as a service, you can run “./client” in the karaf bin directory to open a console. In my install, this lives in “/usr/share/openhab2/runtime/karaf/bin”.

Cheers,

1 Like

Done. Everything is woking now as it should.
Thanks for the help

2 Likes

Hi,
I have plugged an APC Back UPS Pro 900VA to my Synology DS415+. I would like to use the OpenHAB Network UPS plugin with my UPS.
Is it possible ? What are the parameter values ?

OpenHab has nothing to do with UPS. The network ups binding is just an interface for NUT - network ups tools. So you have to figure them our first.

Has there been a regression in this binding? I’m running a recent snapshot and the refresh service shuts down even with networkupstools: prefix in the config

openhab.log
2017-06-24 10:48:31.873 [INFO ] [b.core.service.AbstractActiveService] - NetworkUpsTools Refresh Service has been started
2017-06-24 10:48:53.119 [INFO ] [b.core.service.AbstractActiveService] - NetworkUpsTools Refresh Service has been shut down

bundle:list
199 | Active | 80 | 1.10.0.201706211218 | openHAB NetworkUpsTools Binding

[edit] scratch that, the real problem is that apcupsd hangs when collecting data from my APC Smart-UPS over Modbus USB. Seems like a common issue, I will try switching to RS232

http://apcupsd-ups-control-software.10985.n7.nabble.com/apcupsd-usb-connection-silently-hangs-td9651.html

Anyone using this successfully in 2.x? I have it working in OH1, but cannot get various versions of the plugin working in 2.x (either with or without the prefix).

[ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService, id=338, bundle=218/mvn:org.openhab.binding/org.openhab.binding.networkupstools/1.11.0-SNAPSHOT]: Unexpected problem updating configuration org.openhab.networkupstools
java.lang.ArrayIndexOutOfBoundsException: 1
        at org.openhab.binding.networkupstools.internal.NetworkUpsToolsBinding.updated(NetworkUpsToolsBinding.java:167)[218:org.openhab.binding.networkupstools:1.11.0.201707070110]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1461)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1417)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)[3:org.apache.felix.configadmin:1.8.12]
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)[3:org.apache.felix.configadmin:1.8.12]
        at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]

Hi @herbus,
For me, everything works with OH 2.1.0 ! :slight_smile:

I have installed the last stable release of OH2 (version 2.1.0). From PaperUI, I have added the Network UPS Tools Binding (version 1.10.0). I have updated the networkupstools.cfg (conf/services/) file like that:

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

# UPS device name
ups1.device=ups

# UPS server hostname (optional)
#ups1.host=localhost
ups1.host=<hostname of my UPS server, ie Synology NAS>

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

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

# UPS server pass (optional)
#ups1.pass=

And my .item file:

String OnduleurAPC900G_Status "Status [%s]" (groupOnduleur) { networkupstools = "ups1:ups.status" }
Number OnduleurAPC900G_Battery_Runtime "Battery runtime [%.1f Sec]" <battery> (groupOnduleur) { networkupstools="ups1:battery.runtime" }
String OnduleurAPC900G_Load "Load [%s]" (groupOnduleur) { networkupstools = "ups1:ups.load" }
String OnduleurAPC900G_Device_Serial "Device serial [%s]" (groupOnduleur) { networkupstools = "ups1:device.serial" }
String OnduleurAPC900G_Device_Model "Model [%s]" (groupOnduleur) { networkupstools = "ups1:ups.model" }

Hey guys,
Has anything changed with the compatibility of this binding? I have set up a new OH2.3 install on Ubuntu. I have configured NUT and get a response back from upsc. I have configured the networkupstools.cfg file and items exactly as above but no luck.
I see some errors in the console but as a newbie I’m not sure what this means and how to debug further. Grateful for any help!

    20:53:27.741 [ERROR] [org.apache.felix.configadmin         ] - [org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService, id=331, bundle=201/mvn:org.openhab.binding/org.openhab.binding.networkupstools/1.12.0]: Unexpected problem updating configuration org.openhab.networkupstools
    java.lang.ArrayIndexOutOfBoundsException: 1 at org.openhab.binding.networkupstools.internal.NetworkUpsToolsBinding.updated(NetworkUpsToolsBinding.java:167) [201:org.openhab.binding.networkupstools:1.12.0]

No, still running fine on my system.
Did you setup your networkups.cfg correct ?

I believe so…

networkupstools.cfg has minimal config:

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

# UPS device name
ups1.device=ups

# UPS server hostname (optional)
ups1.host=localhost

ups.items=

Number Ups_Output_Voltage "UPS output voltage [%.1f V]" (Ups) {networkupstools="ups1:output.voltage"}
String Ups_Status "UPS status [%s]" (Ups) {networkupstools="ups1:ups.status"}

Please post your upsc output.

ok so upsc output…

upsc ups@localhost
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 20
battery.runtime: 3320
device.mfr: EATON
device.model: 5S 1000
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: MGE HID 1.39
driver.version.internal: 0.41
input.frequency: 50.5
input.voltage: 240.0
input.voltage.extended: no
outlet.1.desc: PowerShare Outlet 1
outlet.1.id: 2
outlet.1.status: on
outlet.desc: Main Outlet
outlet.id: 1
output.frequency: 50.0
output.voltage: 230.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 01.02.0011
ups.load: 0
ups.mfr: EATON
ups.model: 5S 1000
ups.power: 0
ups.power.nominal: 1000
ups.productid: ffff
ups.realpower: 0
ups.status: OL
ups.timer.shutdown: -1
ups.vendorid: 0463

Just to rule out anything with the UPS/driver I have a NUT server with a different UPS, so I pointed it at the IP instead of localhost. Same result, again the upsc can see the UPS and gets a good output. What can I try next?