https://github.com/shred/commons-nut
Java client for the NUT (Network UPS Tools) protocol
https://github.com/shred/commons-nut
client-library java nut uninterruptible-power-supply ups
Last synced: 10 months ago
JSON representation
Java client for the NUT (Network UPS Tools) protocol
- Host: GitHub
- URL: https://github.com/shred/commons-nut
- Owner: shred
- License: lgpl-3.0
- Created: 2022-11-12T10:52:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-12T11:07:26.000Z (over 3 years ago)
- Last Synced: 2024-12-25T19:49:52.295Z (over 1 year ago)
- Topics: client-library, java, nut, uninterruptible-power-supply, ups
- Language: Java
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-LGPL.txt
Awesome Lists containing this project
README
# commons-nut  
A simple Java NUT ([Network UPS Tools](https://networkupstools.org)) client.
This software is part of the Shredzone Commons.
**Experimental!** I wrote this client because I found no other one at Maven Central. It is a very simple implementation that does not cover all protocol features, and is also not quite well unit tested.
For me it is sufficient like that, so don't expect frequent updates. However, please give feedback if you're using this client in your project (for example by starring it at Codeberg). If there is sufficient interest in this client, it would motivate me to invest more time into its development.
## Features
* Connects to many UPS via a NUT server.
* Supports the most important commands of the protocol.
* Small footprint, only requires Java 11 or higher.
* Logging via SLF4J
* [Semantic Versioning](https://semver.org).
## Quick Start
Just create a `Client` object as starting point, and use its methods.
```java
try (Client client = new Client("localhost")) {
client.getDeviceList().forEach(System.err::println);
Device ups = client.getDevice("myups");
ups.getVariables().forEach(System.err::println);
ups.getRWVariables().forEach(System.err::println);
ups.getCommands().forEach(System.err::println);
} catch (NutException ex) {
ex.printStackTrace();
}
```
## Limitations
This client implements only the most important features of the [NUT protocol](https://networkupstools.org/docs/developer-guide.chunked/ar01s09.html) 1.2 or higher.
These commands are not supported yet:
* `GET TYPE`, `LIST ENUM`, `LIST RANGE`
* `GET TRACKING`, `SET TRACKING`
* `LIST CLIENT`
* `PRIMARY`, `FSD`
* `STARTTLS` and socket encryption
## Debugging
By setting the log level of the `org.shredzone.commons.nut` package to `DEBUG`, the communication with the NUT server will be logged.
**Caution:** The `DEBUG` log output contains the login credentials! Do not use it on production level.
## Contribute
* Fork the [Source code at Codeberg](https://codeberg.org/shred/commons-nut). Feel free to send pull requests.
* Found a bug? [File a bug report!](https://codeberg.org/shred/commons-nut/issues)
## License
_commons-nut_ is open source software. The source code is distributed under the terms of [GNU Lesser General Public License Version 3](http://www.gnu.org/licenses/lgpl-3.0.html).