This adapter for ioBroker connects to a defined NUT server to provide the status and details of a connected UPS/USV as ioBroker states, so that it can be used there.
This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers. For more details and for information how to disable the error reporting see Sentry-Plugin Documentation! Sentry reporting is used starting with js-controller 3.0.
IP address of the NUT server. NUT needs to run in server mode and needs to be accessible by the computer the iobroker NUT adapter runs on. So check firewall settings if you have problems and allow the access. If the UPS is connected locally you can also use 127.0.0.1 or localhost.
Port of NUT. The default port is 3493
Name of the UPS as defined in the NUT configuration of the NUT server.
Hints:- If you want to connect to an UPS connected to a Synology diskstation the name is simply "ups".
- If you want to connect to an UPS connected to a QNAP NAS the name is simply "qnapups".
Interval in Seconds to update the data. Default is 300s
Included is a small linux shell-script at scripts/nut-notify.sh which can be configured in upsmon.
The script needs execute rights (chmod +x nut-notify.sh).
It should be added to /etc/nut/upsmon.conf like:
NOTIFYCMD "cd /opt/iobroker/;./nut-notify.sh"
Additionally configure all relevant notify messages like:
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
NOTIFYFLAG FSD SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK SYSLOG+WALL+EXEC
NOTIFYFLAG COMMBAD SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC
Important is the added "EXEC" flag.
One simple example for a nut-notify.sh script is:
#! /bin/sh
# NUT adapter notify script.
logger -t nut-notify "Notify iobroker $UPSNAME -> $NOTIFYTYPE"
/opt/iobroker/iobroker message nut notify "{\"upsname\":\"$UPSNAME\",\"notifytype\":\"$NOTIFYTYPE\"}"
If you have problems and the adapter do not deliver the data you can use the two scripts in directory "test" of the adapter installation (so normally in node_modules/iobroker.nut/test relative to your iobroker installation directory) to try it out on the commandline. Call the scripts using "node filename.js" to see the awaited parameters.
- test_upslist.js: Connects to the NUT server and returns a list of available UPS names
- test_upsvars.js: Connects to the NUT server for a defined UPS and returns a list of available UPS variables
- docs for webpage
- IMPORTANT: js-controller 3.0 is now needed at least
- (Apollon77) Delay adapter initialization when USV is not reachable on adapter start
- (simatec) jsonConfig added
- (simatec) test and release updated
- (Apollon77) Add connection states
- (Apollon77) Optimize for js-controller 3.3
- (foxriver76) we fixed the state value type set to
battery.charge
- (Apollon77) Enhance the port check
- (Apollon77) Check configured port before using it (Sentry IOBROKER-NUT-3)
- (Apollon77) Optimize stop handling (Sentry IOBROKER-NUT-1)
- (Apollon77) Prevent warnings in js-controller 3.2
- (Apollon77) Require at least js-controller 2.0
- (Apollon77) adjust connection close handling
- (Apollon77) add compact mode
- (Apollon77) update dependencies
- (Apollon77) Add Sentry error reporting
- Fix Admin
- Fix status parsing
- Enhance error handling
- Add possibility to call commands on the UPS
- change mode from schedule to deamon
- implement message support to receive messages from upsmon
- add status.severity to get one status about the USV with values idle, operating, operating_critical, action_needed, unknown
- add better usable status states under "status" channel
- finalizied initial version
- initial release for testing
The MIT License (MIT)
Copyright (c) 2016-2022 Apollon77 ingo@fischer-ka.de
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.