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

NUT driver for UPSPlus #142

Open
dacarson opened this issue Apr 3, 2024 · 1 comment
Open

NUT driver for UPSPlus #142

dacarson opened this issue Apr 3, 2024 · 1 comment

Comments

@dacarson
Copy link

dacarson commented Apr 3, 2024

I wrote a NUT driver for UPSPlus (EP-0136), and I would appreciate any feedback before I submit a PR to the NUT repo.

Make sure that you have NUT installed:
$ sudo apt-get install nut

To build it:
You can clone my forked repository from here:
$ git clone https://github.com/dacarson/nut
$ cd nut

Generate the configuration files:
$ ./autogen.sh

Generate the Makefiles for the items we need to build and their path
$ ./configure --with-linux_i2c --with-statepath=/run/nut --sysconfdir=/etc/nut --with-user=nut --with-group=nut --with-pidpath=/run/nut
parameters meanings
--with_linux_i2c Build the NUT i2c linux UPS drivers
--with-statepath & --with-pidpath Location to put shared file & the PID file (default location for bullseye is /run/nut)
--sysconfdir Location of the NUT configuration files (default location for bullseye is /etc/nut)
--with-user & --with-group Username and Group to run the driver as (default for bullseye is nut:nut)

Build all the components
$ make all

Test the driver to make sure that it will run ok
$ sudo ./drivers/upsplus -DDD -s pi -x port=default -d 1

If it tests out ok, then copy it to the right directory for bullseye:
$ sudo cp upsplus /usr/lib/nut

Add this section to your /etc/nut/ups.conf:

[pi]
    driver = upsplus
    port = /dev/i2c-1
    desc = "RaspberryPi UPSPlus"

Make sure that the NUT upsplus driver can access the i2c-1 bus:
$ sudo chmod a+rw /dev/i2c-1
(The default user/group for a nut installations (user: nut, group: nut) doesn't have read-write access as the i2c bus device is created by default as user and group read-writable that nut is not a part of. This is something I need to work out how to fix because this is reset when the RPi reboots.)

Now restart your NUT driver
$ sudo systemctl restart nut-driver

Test that it is running correctly:
$ upsc pi

@yoyojacky
Copy link
Contributor

Hi dacarson,
Thanks for your effort, I will arrange our enginner to test it out, and give you a feed back, that looks nice!

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

No branches or pull requests

2 participants