trying to set up nut binding in 2.4 stable on a desktop running Debian9
nut is running on the same machine as OH and returning data
here is my /etc/openhab2/services/networkupstools.cfg
# Refresh interval for state updates in milliseconds (optional)
#refresh=60000
# UPS device name
ups1.device=apc-650
# UPS server hostname (optional)
#ups1.host=localhost
# UPS server port (optional)
#ups1.port=3493
# UPS server login (optional)
#ups1.login=
# UPS server pass (optional)
#ups1.pass=
here is error in log
17:02:47.726 [ERROR] [tools.internal.NetworkUpsToolsBinding] - No configuration for UPS with name: 'ups'
I have tried a lot of combinations in the device line and even commented out it throws this error
I’m about ready to uninstall the binding
Are you sure about the device name? Mine is simply ups for three different ups, given by the ups.conf file in nut server configuration. Here is mine (only relevant part):
[UPS]
driver = usbhid-ups
port = auto
desc = "APC UPS"
So, the device name should be the heading (in lower case)
My ups.conf looked just like your’s Udo exept the name it was
[apc-650]
driver = usbhid-ups
port = auto
desc = "APC UPS"
I changed it to match yours and also changed my networkupstools.cfg to match and it still is throwing the error
I had to stop and start the nut-server for the change to take effect
openhab@openhab2:~$ openhab-cli console
Logging in as openhab
__ _____ ____
____ ____ ___ ____ / / / / | / __ )
/ __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __ |
/ /_/ / /_/ / __/ / / / __ / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/ |_/_____/
/_/ 2.5.0-SNAPSHOT
Build #1502
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown openHAB.
openhab> config:edit org.openhab.networkupstools
openhab> config:property-list
ups3.device = ups
ups3.host = vdr-server
ups3.login = <loginname>
ups3.pass = <password>
ups3.port = 3493
openhab>
If you are getting more lines of configuration, delete the wrong ones
with config:property-delete <parametername>, do another config:property-list to ensure you got them all, finally save the edit with config:update.
OK…
I went back and edited /etc/nut/ups.conf and replaced UPS with my original name then I added a user in /etc/nut/upsd.users. Then I added a line to /etc/nut/upsmon.conf
Then I restart nut server
root@treehouse:/var/run/nut# service nut-server stop
root@treehouse:/var/run/nut# service nut-server start
root@treehouse:/var/run/nut# service nut-server status
● nut-server.service - Network UPS Tools - power devices information server
Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2019-09-15 10:24:28 EDT; 8s ago
Process: 6489 ExecStart=/sbin/upsd (code=exited, status=0/SUCCESS)
Main PID: 6490 (upsd)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/nut-server.service
└─6490 /lib/nut/upsd
Sep 15 10:24:28 treehouse systemd[1]: Starting Network UPS Tools - power devices information server...
Sep 15 10:24:28 treehouse upsd[6489]: fopen /var/run/nut/upsd.pid: No such file or directory
Sep 15 10:24:28 treehouse upsd[6489]: listening on 127.0.0.1 port 3493
Sep 15 10:24:28 treehouse upsd[6489]: listening on 127.0.0.1 port 3493
Sep 15 10:24:28 treehouse upsd[6489]: Connected to UPS [apc-650]: usbhid-ups-apc-650
Sep 15 10:24:28 treehouse systemd[1]: Started Network UPS Tools - power devices information server.
Sep 15 10:24:28 treehouse upsd[6490]: Startup successful
then I restarted the networkupstools bundle
now I get
OK, no change, still throws the error (exactly every one minute), only difference is it throws it twice in a row about 12 thousands of a second apart now
Thanks for helping me Udo, and yes, I agree, it is strange.
Let me update the situation. I have changed my /etc/openhab2/services/networkupstools.cfg file and restart the bundle and the changes are picked up! For instance, I changed the refresh from 60 seconds to 30 seconds and then to two minutes. After a bundle restart, the error timing in the log changes to happen at the new refresh. So I know OpenHAB is working enough to get my changes.
I’ve read a ton of threads about this and tried everything.
I have changed my /etc/nut/ups.conf to use [ups] and [UPS]
Restarted OpenHAB, restarted the operating system (needed updates anyhow, uptime over 2 months) cleared the cache.
what gets me is in the source code, here is the error code (it’s not a very complex binding)
for (String name : items.keySet()) {
NutConfig nut = upses.get(name);
if (nut == null) {
logger.error("No configuration for UPS with name: '{}'", name);
continue;
}
if (nut == null){
to me would indicate the binding is recieving a null input