In the next tutorial I will show you how to monitor a Mustek PowerMust 2012 UPS with Ubuntu Server 14.
The UPS is connected to the server using a USB cable.
Ubuntu server details :
[email protected]:/# cat /etc/lsb-release
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
[email protected]:/# uname -a
Linux erp 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
If you connect the USB to the server you should see this message :
[email protected]:/# dmesg
[80186.156023] usb 4-2: new low-speed USB device number 2 using uhci_hcd [80186.330039] usb 4-2: New USB device found, idVendor=0665, idProduct=5161 [80186.330046] usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [80186.330049] usb 4-2: Product: USB to Serial [80186.330051] usb 4-2: Manufacturer: INNO TECH [80186.360169] hid-generic 0003:0665:5161.0003: hiddev0,hidraw2: USB HID v1.00 Device [INNO TECH USB to Serial] on usb-0000:00:1d.2-2/input0
Note the USB descriptor for later : 0665:5161
Step 1 : install nut
[email protected]:/# sudo apt-get install nut nut-cgi
Add UPS config, for my UPS i used the name : must-pa-2012
[email protected]:/# nano /etc/nut/ups.conf
Add the following lines :
[must-pa-2012] driver = blazer_usb port = auto
Start ups monitor:
#sudo upsdrvctl start
You may receive the error message below :
Can't claim USB device [0665:5161]: could not detach kernel driver from interface 0: Operation not permitted Driver failed to start (exit status=1)
This means that there is a problem with permissions, so we need to set the permission and then reboot.
Set permissions for UPS, remember the descriptor noted above, 0665:5161 in my case:
[email protected]:/# nano /etc/udev/rules.d/10-must-pa-2012.rules
Add the line :
SYSFS{idVendor}=='0665', SYSFS{idProduct}=='5161', MODE='0666'
Edit nut.conf
[email protected]:/# nano /etc/nut/nut.conf
Change MODE to standalone :
MODE=standalone
Create a user for nut :
[email protected]:/# nano /etc/nut/upsd.users
[ups_admin] password = 12345678 upsmon master
Add the ups to monitoring software :
[email protected]:/# nano /etc/nut/upsmon.conf
MONITOR [email protected] 1 ups_admin 12345678
Try to start the ups monitoring :
[email protected]:/# upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.1 Network UPS Tools - Megatec/Q1 protocol USB driver 0.10 (2.7.1) Can't chdir to /var/run/nut: No such file or directory Driver failed to start (exit status=1)
[email protected]:/# service nut-server start
* Starting NUT - power devices information server and drivers
Show UPS statisics :
[email protected]:/# upsc [email protected]
Init SSL without certificate database battery.charge: 33 battery.voltage: 22.50 battery.voltage.high: 26.00 battery.voltage.low: 20.80 battery.voltage.nominal: 24.0 device.type: ups driver.name: blazer_usb driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.version: 2.7.1 driver.version.internal: 0.10 input.current.nominal: 9.0 input.frequency: 50.1 input.frequency.nominal: 50 input.voltage: 198.0 input.voltage.fault: 198.0 input.voltage.nominal: 220 output.voltage: 233.6 ups.beeper.status: enabled ups.delay.shutdown: 30 ups.delay.start: 180 ups.load: 13 ups.productid: 5161 ups.status: OL BOOST ups.type: offline / line interactive ups.vendorid: 0665
UPS graphic info :
Enable CGI in Apache :
[email protected]:/usr/lib/cgi-bin# a2enmod cgi
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message Your MPM seems to be threaded. Selecting cgid instead of cgi. Enabling module cgid. To activate the new configuration, you need to run: service apache2 restart
Restart Apache :
[email protected]:/usr/lib/cgi-bin# service apache2 restart
* Restarting web server apache2
Access the server IP, mine is 10.10.10.250 :
http://10.10.10.250/cgi-bin/nut/upsstats.cgi
Update 18.07.2015
If you receive a message about no hosts to monitor “Error: no hosts to monitor (check hosts.conf)“, you must edit /etc/nut/hosts.conf and add the following line :
nano /etc/nut/hosts.conf
MONITOR [email protected] "Local UPS"
This guide works also with a SOCOMEC NET0600-PE UPS.

UPS Ubuntu
5 comments
Skip to comment form ↓
Jacques
March 22, 2015 at 9:37 pm (UTC 2) Link to this comment
Hi
I successfully implemented this code on a Raspberry Pi, version as follows:
Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux
and am able to read my Mustek UPS status using
upsc [email protected]
But when I use dmesg it seems that the USB port is constantly being released and renewed using a new ID number every 10 seconds:
…
[ 339.996365] usb 1-1.2: USB disconnect, device number 27
[ 341.511182] usb 1-1.2: new low-speed USB device number 28 using dwc_otg
[ 341.620658] usb 1-1.2: New USB device found, idVendor=0665, idProduct=5161
[ 341.620690] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 341.620706] usb 1-1.2: Product: USB to Serial
[ 341.620721] usb 1-1.2: Manufacturer: INNO TECH
[ 341.633816] hid-generic 0003:0665:5161.0019: hiddev0,hidraw0: USB HID v1.00 Device [INNO TECH USB to Serial] on usb-bcm2708_usb-1.2/input0
[ 351.61889] usb 1-1.2: USB disconnect, device number 28
[ 352.781604] usb 1-1.2: new low-speed USB device number 29 using dwc_otg
[ 352.891188] usb 1-1.2: New USB device found, idVendor=0665, idProduct=5161
[ 352.891221] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 352.891238] usb 1-1.2: Product: USB to Serial
[ 352.891253] usb 1-1.2: Manufacturer: INNO TECH
[ 352.905849] hid-generic 0003:0665:5161.001A: hiddev0,hidraw0: USB HID v1.00 Device [INNO TECH USB to Serial] on usb-bcm2708_usb-1.2/input0
…
This would increment all the way to device number 61. I suspect this could also be causing my RPi to reboot without reason.
Please assist
Thank you
Jacques
Bogdan
March 25, 2015 at 1:41 pm (UTC 2) Link to this comment
Change cable / USB port first.
Test the UPS with a normal PC connected to the USB.
Jacques
March 29, 2015 at 11:09 am (UTC 2) Link to this comment
Thank you Bogdan.
Actually the issue was caused by the fact that the upsdrvctl was not started automatically during RPi reboot. So I added the following
sudo upsdrvctl start
into /etc/rc.local, now those messages only occur 6-7 times before the service is started.
Now, after some time I get the following every 30 seconds or so, but I see this is reported in other threads on the WWW:
USBDEVFS_CONTROL failed cmd blazer_usb rqt 33 rq 9 len 8 ret -110
Still digging deeper to get to the bottom of this in dmesg…
Regards
Jacques
Ed
August 8, 2015 at 7:38 pm (UTC 2) Link to this comment
The -110 in “USBDEVFS_CONTROL failed cmd blazer_usb rqt 33 rq 9 len 8 ret -110” indicates a timeout
I solved the problem by increasing the “pollinterval” setting in /etc/nut/ups.conf to 5 (from the default of 2) thereby allowing more time for the UPS to reply when polled.
alp
July 27, 2019 at 12:17 pm (UTC 2) Link to this comment
Works great with PowerMust 400 USB. thanks!