[Solved] Network UPS tools

I cannot seem to get this working.

My networkupstools.cfg is as follows:

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

# UPS device name

networkupstools:ups.device=ups

# UPS server hostname (optional)

networkupstools:ups.host=freenas.local

# Propertie
networkupstools:ups="battery.charge"

However, no matter what I do I always end up with the following:

2019-07-31 16:10:25.357 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.event.EventHandler, org.osgi.service.cm.ManagedService, id=480, bundle=227/mvn:org.openhab.binding/org.openhab.binding.networkupstools/1.14.0-SNAPSHOT]: Updating property device of configuration org.openhab.networkupstools caused a problem: Invalid configuration setting. Configuration key must contain a period ('.'), but does not.

org.osgi.service.cm.ConfigurationException: device : Invalid configuration setting. Configuration key must contain a period ('.'), but does not.

	at org.openhab.binding.networkupstools.internal.NetworkUpsToolsBinding.updated(NetworkUpsToolsBinding.java:171) ~[?:?]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) ~[9:org.apache.felix.configadmin:1.9.14]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [9:org.apache.felix.configadmin:1.9.14]

	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [9:org.apache.felix.configadmin:1.9.14]

	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1113) [9:org.apache.felix.configadmin:1.9.14]

	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1069) [9:org.apache.felix.configadmin:1.9.14]

	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:138) [9:org.apache.felix.configadmin:1.9.14]

	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105) [9:org.apache.felix.configadmin:1.9.14]

	at java.lang.Thread.run(Thread.java:748) [?:?]

The system appears to be telling you there is a configuration error.

Thanks, I got that :thinking:. The system however does not tell me what parameter in the configuration is wrong. It’s not very helpful in this case.

And the documentation on the networkupstools is not that explanatory as well.

Likely relevant

Another possibility from Google.

# Propertie
networkupstools:ups="battery.charge"

I think this is your illegal parameter. What do you try to do it?

In OH2, you don’t need to add binding prefix (‘networkupstools’) to you configuration parameters, when they are in separated file which name is the binding name. So following should work as well

networkupstools.cfg:

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

# UPS device name
ups.device=ups

# UPS server hostname (optional)
ups.host=freenas.local

If you remove illegal parameter from the file, you might need to restart the OH to get parameter be removed from configAdmin (see more details from issue).

1 Like

Remove all of the prepended networkupstools: from each entry.

This is an old binding and I suspect that you have found an example somewhere that is a few years old. Back in OH 1.x there was one big config file and each binding needed to prepend their name to all of their config parameters in that file. Now each binding gets its own file so the prepended name is no longer needed and is in fact a syntax error.

1 Like

I wrote this guide a couple of weekends ago, and it might be helpful to you.

As far I know, this isn’t correct statement. If config parameter doesn’t contain service pid, configDispatcher will use file name as pid (it will add also org.openhab prefix at the end). As you can see also from stack trace, config parameter is delegated to the networkupstools binding, which will throw the exception.

So following parameter names should be identical (if file name is networkupstools.cfg)

refresh=60000
networkupstools:refresh=60000
org.openhab.networkupstools:refresh=60000

And yet OP is getting a syntax error. If it’s not that, what is it?

See my guess from previous post (first one)

This one. You don’t define the individual parameters/properties that you are looking for in the .cfg file, that’s for connection details.

You define these in the Item binding config string

Number UPS_Battery_Charge "Battery level [%d %%]" (gUPS) {networkupstools="ups1:battery.charge"}

cribbed from

Removing the networkupstools from the configuration file helped.

My networkupstools.cfg now looks like this:

# Refresh interval for state updates in milliseconds (optional)

#refresh=60000

# UPS device name

ups1.device=ups

# UPS server hostname (optional)

ups1.host=freenas.local

# UPS server port (optional)

#ups1.port=3493

# UPS server login (optional)

#ups1.login=

# UPS server pass (optional)

#ups1.pass=

The ups.items now looks like:

Number ups_output_voltage "UPS output voltage [%.1f V]" (Ups) {networkupstools="ups1:output.voltage"}

Number ups_input_voltage "UPS Input Voltage [%s]V" (Ups) {networkupstools="ups1:input.voltage"}

String ups_status "UPS status [%s]" (Ups) {networkupstools="ups1:ups.status"}

Number ups_battery_charge "UPS Battery Charge [%s]%" (Ups) {networkupstools="ups1:battery.charge"}

Number ups_battery_voltage "UPS Battery Voltage [%s]V" (Ups) {networkupstools="ups1:battery.voltage"}

Number ups_input_voltage_nominal "UPS Input Voltage [%s]V" (Ups) {networkupstools="ups1:input.voltage.nominal"}

Number ups_load "UPS Load [%s]V" (Ups) {networkupstools="ups1:ups.load"}

It now works like a charm.

Thanks all for the support!