Giter VIP home page Giter VIP logo

openups's Introduction

OpenUPS Install Linux

alt text

Step 1

Plug the device in, check the device connection

$ lsusb | grep "d004"
Bus 001 Device 002: ID 04d8:d004 Microchip Technology, Inc.

If no Microchip Technology device shows up, check the usb conection and try again

Step 2

Install NUT using your prefered package manager. OpenUPS requires at least networkupstools 2.7.3 or higher.

e.g on Ubuntu:

$ sudo apt-get install nut

If installing from sources:

sudo apt install build-essential python libtool pkg-config automake
sudo addgroup nut
sudo useradd -M -s /bin/false -g nut ups

git clone git://github.com/networkupstools/nut.git
./autogen.sh
./configure --with-user=ups --with-group=nut
make
sudo make install

sudo cp /usr/local/ups/etc/upsd.conf.sample /usr/local/ups/etc/upsd.conf
sudo cp /usr/local/ups/etc/upsd.users.sample /usr/local/ups/etc/upsd.users
sudo chmod 770 /usr/local/ups/etc/upsd.users
sudo chown root.nut /usr/local/ups/etc/upsd.users

Step 3

Stop the upsdrvctl service

e.g on Ubuntu:

$ sudo upsdrvctl stop

If installed from sources:

$ /usr/local/ups/sbin/upsdrvctl stop

Step 4

Edit /etc/ups.conf (or /usr/local/ups/etc/ups.conf from sources) and add the following lines at the bottom:

[openups]
    driver = usbhid-ups
    port = auto
    vendorid = 04d8
    pollfreq = 30
    desc = "Mini-Box OpenUPS"
    productid = d004

Configure the driver for the openups

e.g on Ubuntu:

$ sudo /lib/nut/usbhid-ups -u root -a openups

If installed from sources:

/usr/local/ups/bin/usbhid-ups -u ups -a openups

If you get the error "Can’t chdir to /var/run/nut: No such file or directory"

$ sudo mkdir /var/run/nut
$ sudo chown root:nut /var/run/nut
$ chmod 770 /var/run/nut

Step 5

Change the permissions for the USB port

a) Find the bus number and device number for the UPS

$ lsusb | grep "d004"
Bus 001 Device 002: ID 04d8:d004 Microchip Technology, Inc.

b)

$ sudo chmod 0666 /dev/bus/usb/[bus number]/[device number]

NOTE: these permissions will need to be reset everytime you restart the computer or unplug the device

OPTIONAL: a UDEV rule can be added to avoid this

$ sudo touch /etc/udev/rules.d/50-usb-openups.conf
$ echo 'SUBSYSTEM=="usb", ATTR{idProduct}=="d004", MODE="0666"' | sudo tee --append /etc/udev/rules.d/50-usb-openups.conf

Step 6

Start the driver service

e.g on Ubuntu:

$ sudo upsdrvctl start

If installed from sources:

$ /usr/local/ups/sbin/upsdrvctl start

Step 7

Start UPSD

e.g on Ubuntu:

$ sudo upsd

If installed from sources:

sudo /usr/local/ups/sbin/upsd -u ups

Step 8

You can now view the live UPS data using your preffered UPSD Client

e.g with the built in UPSC client

$ upsc openups@localhost
battery.capacity: 100
battery.charge: 100
battery.charge.low: 5
battery.charge.warning: 20
battery.current: 0.000
battery.mfr.date: ?
battery.runtime: 3932100
battery.temperature: 34.22
battery.type: ?
battery.voltage: 10.22
device.mfr: Mini-Box.Com
device.model: OPEN-UPS
device.serial: LI-ION
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: d004
driver.version: 2.7.1
driver.version.data: openUPS HID 0.1
driver.version.internal: 0.38
input.current: 0.000
input.voltage: 533.95
output.current: 0.000
output.voltage: 488.36
ups.mfr: Mini-Box.Com
ups.model: OPEN-UPS
ups.productid: d004
ups.serial: LI-ION
ups.status: OL
ups.vendorid: 04d8

If installed from sources:

/usr/local/ups/bin/upsc openups@localhost

openups's People

Contributors

ashibod avatar mini-box avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

openups's Issues

Input current reported is consistently zero

Is it possible to fix the driver so that input current is reported correctly?
Currently with the Open UPS this driver reports:

$ upsc ups
battery.capacity: 100
battery.charge: 100
battery.charge.low: 20
battery.charge.warning: 20
battery.current: 0.000
battery.mfr.date: ?
battery.runtime: 3932100
battery.runtime.low: 1200
battery.temperature: 40.38
battery.type: ?
battery.voltage: 23.14
device.mfr: Mini-Box.Com
device.model: OPEN-UPS
device.serial: PBSO4-LiFePO
device.type: ups
driver.flag.ignorelb: enabled
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: d004
driver.parameter.synchronous: no
driver.parameter.vendorid: 04d8
driver.version: 2.7.4-695-gf15947f0
driver.version.data: openUPS HID 0.4
driver.version.internal: 0.43
input.current: 0.000          ⟵ This always appears as zero
input.voltage: 19.46
output.current: 1.789
output.voltage: 19.85
ups.mfr: Mini-Box.Com
ups.model: OPEN-UPS
ups.productid: d004
ups.serial: PBSO4-LiFePO
ups.status: OL
ups.vendorid: 04d8

Comparing to values using the Windows software (on the same machine in a virtual machine) the other input and output values look to be correct.
Great these modules can be used natively in Linux.
Thanks!
Adam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.