openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
818 stars 251 forks source link

Add Network UPS Tools to support Uninterruptable Power Supplies #1759

Closed florian-h05 closed 1 year ago

florian-h05 commented 1 year ago

Part 1 of #1712. Part 2 is Waveshare UPS HAT support, which I cannot contribute (at least for now).

Description

This PR adds support for setting up Network UPS Tools both in unattended and interactive mode.

nut itself can be setup by openHABian to either connect to a local USB UPS (the code is ready to support more drivers, but I don't have any good proposals because usbhid-ups supports most modern UPSes in my feeling) or to another instance of nut on the local network, e.g. your Synology NAS.

The setup is currently not utilising upssched, which would allow to have mail notifications etc., but I think I can provide a follow up PR for this capability. I just don't want to blow up this PR anymore.

Note: the upsd users that are created have secure passwords that are generated on the fly by OpenSSL, except the one user that Synology NAS expects. Since this user cannot control anything, just read UPS data, I don't see a security problem there.

Note: I used the standard nut configuration files from Raspbian 11 and modified them to our needs. I decided against removing some sections, because this would avoid advanced users from manually editing these files.

Testing

I have tested both the interactive and the unattended setup several times with:

Ping @mstormi. BTW, I have seen your FOSDEM presentation, very interesting :+1:

florian-h05 commented 1 year ago

@mstormi Can this get merged?

florian-h05 commented 1 year ago

Thanks!

Only thing missing now is docs …

mstormi commented 11 months ago

Only thing missing now is docs …

will you be contributing them, too ?