#1 01.06.13 22:54
UPS PowerMan RealSmart 700 on Linux
Нужно было подключить бесперебойник PowerMan RealSmart 700 к линуксу, конкретно к Ubuntu
ПО которое на сайте производителя - только в бинарниках, и вообще не запускается (говорит что файл не бинарный)
Поиск на просторах интернета толком ничего не дал, окромя стать по настройке NUT (http://warlomak.blogspot.ru/2011/08/ups … buntu.html) в убунту
и некий блог (http://lj.rossia.org/users/k001/264022.html), где якобы удалось завести этот UPS с драйвером fentonups, а что это - непонятно, в дистрибе nut его нет.
После некоторой возни, было выяснено, что драйвер нужен blazer_ser и работает этот UPS по протоколу megatec
Но работает он только первые 5 секунд, потом UPS отваливается
Код::
/etc/nut# /lib/nut/blazer_ser -DDD -a myups -x protocol=megatec Network UPS Tools - Megatec/Q1 protocol serial driver 1.51 (2.6.3) 0.000000 debug level is '3' 0.100721 Trying megatec protocol... 0.100821 send: Q1 0.326085 read: (227.2 140.0 224.8 023 49.4 25.5 27.1 00101000 0.326243 Status read in 1 tries 0.326252 Supported UPS detected with megatec protocol 0.326324 send: F 0.443369 read: #230.0 003 024.0 50.0 0.443417 Ratings read in 1 tries 0.443493 send: I 0.630997 read: # FUDEN S163-700 9.02A 0.631059 Vendor information read in 1 tries 0.631067 Battery runtime will not be calculated (runtimecal not set) 0.631163 send: Q1 0.856740 read: (227.2 140.0 224.8 023 49.4 25.4 27.1 00101000 0.856882 dstate_init: sock /var/run/nut/blazer_ser-myups open on fd 5 0.856976 send: Q1 1.081907 read: (15>.0 140.0 225.8 023 49.4 25.4 27.1 00101000 1.081936 blazer_status: non numerical value [15>.0] 2.858011 send: Q1 3.083232 read: (224.9 140.0 223.6 023 49.4 25.4 27.1 00101000 4.858028 send: Q1 5.082883 read: (228.0 140.0 225.4 022 49.4 25.5 27.1 00101000 6.858726 send: Q1 7.083782 read: (225.4 140.0 223.4 023 49.4 25.5 27.1 00101000 8.858820 send: Q1 9.084265 read: (226.0 140.0 223.6 023 50.1 25.5 27.1 00101000 10.858999 send: Q1 11.084340 read: (226.0 140.0 224.2 023 50.1 25.5 27.1 00101000 12.859622 send: Q1 13.084914 read: (226.0 140.0 224.0 023 50.1 25.5 27.1 00101000 14.861413 send: Q1 15.861549 read: timeout 15.861575 blazer_status: short reply 15.861583 Communications with UPS lost: status read failed!
и перезапуск не помогает
посмотрел код, в файле nut-2.6.5/drivers/blazer_ser.c на 176 строке закоментил
Код::
/* ser_set_dtr(upsfd, cablepower[i].dtr); ser_set_rts(upsfd, cablepower[i].rts); */
и вместо этого вписал
Код::
ser_set_dtr(upsfd, 0); ser_set_rts(upsfd, 1);
и драйвер стал работать стабильно
скомпилил и положил файл blazer_ser в /lib/nut/
далее все по инстркции, что в первой ссылке:
$ sudo apt-get install nut
Правим:
# mcedit /etc/default/nut
START_UPSD=yes
START_UPSMON=yes
# mcedit /etc/nut/nut.conf
MODE=standalone
# mcedit /etc/nut/ups.conf
user = nut
[myups]
driver = blazer_ser
port = /dev/ttyS0
protocol=megatec
default.battery.voltage.high = 13.60
default.battery.voltage.low = 10.60
offdelay = 6
ondelay = 7
# mcedit /etc/nut/upsd.conf
LISTEN 127.0.0.1 3493
# mcedit /etc/nut/upsd.users
[upsadmin]
password = mypasswd
upsmon master
actions = SET
instcmds = ALL
# mcedit /etc/nut/upsmon.conf
RUN_AS_USER nut
MONITOR myups@localhost 1 upsadmin mypasswd master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -Ph +0"
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
Настраиваем права:
$ sudo chown root:nut /etc/nut/*
$ sudo chmod 640 /etc/nut/*
Создаём /etc/udev/rules.d/99_nut-serialups.rules:
# /etc/udev/rules.d/99_nut-serialups.rules
KERNEL=="ttyS0", GROUP="nut"
Даём команды, чтобы не перегружать компутер:
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger
$ sudo service nut restart
$upsc myups
добавив к нему только "user = nut" в файле /etc/nut/ups.conf, а то драйвер не мог получить доступа к папке
в итоге получили:
:/etc/nut# upsc myups
battery.charge: 100
battery.voltage: 28.10
battery.voltage.high: 26.00
battery.voltage.low: 20.80
battery.voltage.nominal: 24.0
device.mfr: FUDEN
device.model: S163-700
device.type: ups
driver.name: blazer_ser
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ttyS0
driver.parameter.protocol: megatec
driver.version: 2.6.5
driver.version.internal: 1.55
input.current.nominal: 3.0
input.frequency: 49.9
input.frequency.nominal: 50
input.voltage: 223.5
input.voltage.fault: 140.0
input.voltage.nominal: 230
output.voltage: 223.5
ups.alarm: UPS selftest failed!
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.firmware: 9.02A
ups.load: 23
ups.mfr: FUDEN
ups.model: S163-700
ups.status: ALARM OL
ups.temperature: 25.8
ups.type: offline / line interactive
Данный ман должен подойти для PowerMan RealSmart 700, FUDEN S163-700
Offline
#2 01.06.13 23:04
Re: UPS PowerMan RealSmart 700 on Linux
Подумав еще немного, разобрался. Нужно было указать cablepower=reverse
[myups]
driver = blazer_ser
port = /dev/ttyS0
protocol=megatec
cablepower = reverse
http://www.networkupstools.org/docs/man/blazer.html
By default the driver will set DTR and clear RTS (normal). If you find that your UPS isn’t detected or the communication with the UPS is unreliable, you may try if clear DTR and set RTS (reverse), set DTR and RTS (both) or clear DTR and RTS (none) improves this situation.
и тогда работает с исходным бинарником "из коробки"
Offline

