└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # OpenUPS Install Linux 2 | 3 | ![alt text](http://www.mini-box.com/openUPS-by-Mini-Box-b.jpg "OpenUPS") 4 | 5 | 6 | # Step 1 7 | Plug the device in, check the device connection 8 | 9 | ```bash 10 | $ lsusb | grep "d004" 11 | Bus 001 Device 002: ID 04d8:d004 Microchip Technology, Inc. 12 | ``` 13 | 14 | If no Microchip Technology device shows up, check the usb conection and try again 15 | 16 | # Step 2 17 | Install NUT using your prefered package manager. 18 | *OpenUPS requires at least networkupstools 2.7.3 or higher.* 19 | 20 | e.g on Ubuntu: 21 | ```bash 22 | $ sudo apt-get install nut 23 | ``` 24 | If installing from sources: 25 | ``` 26 | sudo apt install build-essential python libtool pkg-config automake 27 | sudo addgroup nut 28 | sudo useradd -M -s /bin/false -g nut ups 29 | 30 | git clone git://github.com/networkupstools/nut.git 31 | ./autogen.sh 32 | ./configure --with-user=ups --with-group=nut 33 | make 34 | sudo make install 35 | 36 | sudo cp /usr/local/ups/etc/upsd.conf.sample /usr/local/ups/etc/upsd.conf 37 | sudo cp /usr/local/ups/etc/upsd.users.sample /usr/local/ups/etc/upsd.users 38 | sudo chmod 770 /usr/local/ups/etc/upsd.users 39 | sudo chown root.nut /usr/local/ups/etc/upsd.users 40 | ``` 41 | 42 | # Step 3 43 | Stop the upsdrvctl service 44 | 45 | e.g on Ubuntu: 46 | ```bash 47 | $ sudo upsdrvctl stop 48 | ``` 49 | If installed from sources: 50 | ```bash 51 | $ /usr/local/ups/sbin/upsdrvctl stop 52 | ``` 53 | 54 | # Step 4 55 | Edit /etc/ups.conf (or /usr/local/ups/etc/ups.conf from sources) and add the following lines at the bottom: 56 | 57 | ``` 58 | [openups] 59 | driver = usbhid-ups 60 | port = auto 61 | vendorid = 04d8 62 | pollfreq = 30 63 | desc = "Mini-Box OpenUPS" 64 | productid = d004 65 | ``` 66 | Configure the driver for the openups 67 | 68 | e.g on Ubuntu: 69 | ``` 70 | $ sudo /lib/nut/usbhid-ups -u root -a openups 71 | ``` 72 | 73 | If installed from sources: 74 | ``` 75 | /usr/local/ups/bin/usbhid-ups -u ups -a openups 76 | ``` 77 | 78 | If you get the error "Can’t chdir to /var/run/nut: No such file or directory" 79 | 80 | ```bash 81 | $ sudo mkdir /var/run/nut 82 | $ sudo chown root:nut /var/run/nut 83 | $ chmod 770 /var/run/nut 84 | ``` 85 | 86 | # Step 5 87 | Change the permissions for the USB port 88 | 89 | a) Find the bus number and device number for the UPS 90 | 91 | ```bash 92 | $ lsusb | grep "d004" 93 | Bus 001 Device 002: ID 04d8:d004 Microchip Technology, Inc. 94 | ``` 95 | 96 | b) 97 | ```bash 98 | $ sudo chmod 0666 /dev/bus/usb/[bus number]/[device number] 99 | ``` 100 | 101 | NOTE: these permissions will need to be reset everytime you restart the computer or unplug the device 102 | 103 | OPTIONAL: a UDEV rule can be added to avoid this 104 | ```bash 105 | $ sudo touch /etc/udev/rules.d/50-usb-openups.conf 106 | $ echo 'SUBSYSTEM=="usb", ATTR{idProduct}=="d004", MODE="0666"' | sudo tee --append /etc/udev/rules.d/50-usb-openups.conf 107 | ``` 108 | 109 | # Step 6 110 | Start the driver service 111 | 112 | e.g on Ubuntu: 113 | ```bash 114 | $ sudo upsdrvctl start 115 | ``` 116 | If installed from sources: 117 | ```bash 118 | $ /usr/local/ups/sbin/upsdrvctl start 119 | ``` 120 | 121 | # Step 7 122 | Start UPSD 123 | 124 | e.g on Ubuntu: 125 | ```bash 126 | $ sudo upsd 127 | ``` 128 | 129 | If installed from sources: 130 | ``` 131 | sudo /usr/local/ups/sbin/upsd -u ups 132 | ``` 133 | 134 | # Step 8 135 | You can now view the live UPS data using your preffered UPSD Client 136 | 137 | e.g with the built in UPSC client 138 | 139 | ```bash 140 | $ upsc openups@localhost 141 | battery.capacity: 100 142 | battery.charge: 100 143 | battery.charge.low: 5 144 | battery.charge.warning: 20 145 | battery.current: 0.000 146 | battery.mfr.date: ? 147 | battery.runtime: 3932100 148 | battery.temperature: 34.22 149 | battery.type: ? 150 | battery.voltage: 10.22 151 | device.mfr: Mini-Box.Com 152 | device.model: OPEN-UPS 153 | device.serial: LI-ION 154 | device.type: ups 155 | driver.name: usbhid-ups 156 | driver.parameter.pollfreq: 30 157 | driver.parameter.pollinterval: 2 158 | driver.parameter.port: auto 159 | driver.parameter.productid: d004 160 | driver.version: 2.7.1 161 | driver.version.data: openUPS HID 0.1 162 | driver.version.internal: 0.38 163 | input.current: 0.000 164 | input.voltage: 533.95 165 | output.current: 0.000 166 | output.voltage: 488.36 167 | ups.mfr: Mini-Box.Com 168 | ups.model: OPEN-UPS 169 | ups.productid: d004 170 | ups.serial: LI-ION 171 | ups.status: OL 172 | ups.vendorid: 04d8 173 | ``` 174 | If installed from sources: 175 | ``` 176 | /usr/local/ups/bin/upsc openups@localhost 177 | ``` 178 | --------------------------------------------------------------------------------