OpenMediaVaultでOMRON BY50Sを使う

APC SmartUPSのバッテリー警告灯が頻繁に点灯するようになり、OMRON BY50Sに買い替えました。
UPS本体が5年近く使っていまして、交換用バッテリーを替えても長持ちしないだろうと判断した為です。
最近はUPSとサーバーのモニタリングもシリアル接続からUSB接続に置き換わってきていて、OMRON BY50SにもUSBポートがあるし、問題ないだろうと安易な考えでした。実際はそのままでは使えず、シェルから若干の追加設定が必要でした。

root@localhost:~# lsusb | grep -i omron
Bus 004 Device 002: ID 0590:0081 Omron Corp.

バス番号とデバイス番号を調べて....

root@localhost:~# lsusb -v -s 004:002

Bus 004 Device 002: ID 0590:0081 Omron Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x0590 Omron Corp.
  idProduct          0x0081
  bcdDevice            1.08
  iManufacturer           3 OMRON
  iProduct                1 BY50S
  iSerial                 0

バス番号とデバイス番号を元に idVendor と idProduct を調べる...

root@localhost:~# cat > /lib/udev/rules.d/52-nut-usbups-local.rules <<'EOF'
ACTION!="add|change", GOTO="nut-usbups_rules_end"
SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
BUS!="usb", GOTO="nut-usbups_rules_end"

LABEL="nut-usbups_rules_real"
# omron UPS BY50S - blazer_usb
ATTR{idVendor}=="0590", ATTR{idProduct}=="0081", MODE="664", GROUP="nut"

LABEL="nut-usbups_rules_end"
EOF

得られた情報を元にudevのルールを新規作成して...

root@localhost:~# udevadm control --reload-rules
root@localhost:~# udevadm trigger --verbose --attr-match=idVendor=0590 --attr-match=idProduct=0081
/sys/devices/pci0000:00/0000:00:1a.1/usb4/4-1

udevのルールをリロードして...
20160112_114557
WebUIにログインして、[Services]-[UPS]-[General settings]のDriver configuration directivesに

driver = blazer_usb
port = auto
vendorid = 0590
productid = 0081
subdriver = ippon

と書けば出来上がり。


root@filesv-120:~# upsc ups
battery.voltage: 13.50
battery.voltage.high: -1.08
battery.voltage.low: -0.87
device.type: ups
driver.name: blazer_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0081
driver.parameter.subdriver: ippon
driver.parameter.vendorid: 0590
driver.version: 2.6.4
driver.version.internal: 0.08
input.frequency: 49.9
input.voltage: 101.5
input.voltage.fault: 0.0
output.voltage: 101.1
ups.beeper.status: disabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 35
ups.productid: 0081
ups.status: OL BYPASS
ups.temperature: 37.5
ups.type: offline / line interactive
ups.vendorid: 0590

シェルからupscコマンド(引数はupsの識別子、[Services]-[UPS]-[General settings]のIdentiferで設定した値)で上記のように表示されれば通信出来ています。

【参考情報】
OMRON BY50SをUbuntu 11.04で使用する d.sunnyone.org
Debian GNU-Linux - nut - omron BY50FW - PIB