Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Network UPS Tools to support Uninterruptable Power Supplies #1759

Merged
merged 4 commits into from
Feb 7, 2023

Conversation

florian-h05
Copy link
Contributor

@florian-h05 florian-h05 commented Feb 6, 2023

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:

  • my Eaton 3S 700 directly connected to my dev Pi via USB
  • my Eaton UPS connected to my Synology NAS, therefore using netclient

Ping @mstormi. BTW, I have seen your FOSDEM presentation, very interesting 👍

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Remove upssched.conf (not needed) and TLS sections (not needed).

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Copy link
Contributor

@mstormi mstormi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for my comment at the end.

Did not test but when you say you did that's sufficient.

openhabian-setup.sh Show resolved Hide resolved
@florian-h05
Copy link
Contributor Author

@mstormi Can this get merged?

@mstormi mstormi merged commit 86d5e3d into openhab:main Feb 7, 2023
@florian-h05 florian-h05 deleted the nut branch February 7, 2023 21:24
@florian-h05
Copy link
Contributor Author

Thanks!

Only thing missing now is docs …

@mstormi
Copy link
Contributor

mstormi commented Aug 3, 2023

Only thing missing now is docs …

will you be contributing them, too ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants