-
Notifications
You must be signed in to change notification settings - Fork 28
Description
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