[Nut-upsuser] battery.charge and other fixes needed for X-Power Tigra 1kVA

Arnaud Quette aquette.dev at gmail.com
Wed May 16 07:55:15 UTC 2012


2012/5/16 Tmima Pliroforikis Perifereiakis Enotitas Pierias
<pliroforiki at pieria.pkm.gov.gr>:
> Frédéric Bohé wrote:
>>
>> On Mon, 2012-05-14 at 13:20 +0300, Tmima Pliroforikis Perifereiakis
>> Enotitas Pierias wrote:
>>>
>>> Hello Frederic,
>>>
>>> Frédéric Bohé wrote:
>>>>
>>>> [snip]
>>>>
>>>>         offdelay = value
>>>>             Time to wait before shutting down the UPS (seconds). This
>>>> value
>>>>             is truncated to units of 6 seconds (less than 60 seconds) or
>>>> 60
>>>>             seconds (more than 60 seconds). Defaults to 30 seconds.
>>>>
>>>>
>>>> So you can try to add this to your ups.conf and see if it works.
>>>
>>>
>>> If the a battery low is received, the system which is connected to the
>>> UPS initiates a shutdown successfully. However, the UPS does not power
>>> off as configured with offdelay and it does not power up as configured
>>> with ondelay. So it seems that a "upscmd<upsname>  shutdown.return 1"
>>> should definitely be used.
>>
>>
>> Well, the blazer_ser driver should issue this command.
>> Can you call the following command after stopping NUT (there should be
>> no other driver running). Beware that this will likely shutdown your UPS
>> so make sure your PC is not electrically connected to it.
>>
>> blazer_ser -a<ups_name>  -DDDDD -k
>
>>
>> Then you can send the output to the list.
>
> Nice catch, seems shutdown is not working at all :( :
>
> C:\Program Files\NUT\bin>blazer_ser -a ups1 -DDDDD -k
> Network UPS Tools - Megatec/Q1 protocol serial driver 1.52
> (2.6.3-3534:3545M)
>   0.000000     debug level is '5'
>   0.000000     w32_serial_open (com1)
>
>   0.015625     setting initial state on com1
>   0.015625     000007AC = w32_serial_open (com1)
>   0.015625     vmin_ 0, vtime_ 0
>   0.125000     action 0
>   0.125000     vtime 0, vmin 1
>   0.125000     ReadTotalTimeoutConstant -2, ReadIntervalTimeout -1,
> ReadTotalTimeoutMultiplier -1
>   0.125000     vmin_ 1, vtime_ 0
>   0.125000     action 0
>   0.125000     vtime 0, vmin -1
>   0.125000     ReadTotalTimeoutConstant -2, ReadIntervalTimeout -1,
> ReadTotalTimeoutMultiplier -1
>   0.234376     Initiating UPS shutdown
>   0.343752     send: C
>   0.343752     w32_serial_read : ulen 512, vmin_ -1, vtime_ 0, hEvent
> 000007A8
>   0.375002     w32_serial_read : characters are available on input buffer
>   0.375002     w32_serial_read : Reading 1 characters
>   0.375002     w32_serial_read : total characters read = 1
>   0.375002     w32_serial_read : Reading 3 characters
>   0.375002     w32_serial_read : total characters read = 4
>   0.390627     w32_serial_read : characters are available on input buffer
>   0.390627     w32_serial_read : Reading 1 characters
>   1.390634     w32_serial_read : total characters read = 4
>   1.390634     read: NAK
>   1.390634     instcmd: command [shutdown.stop] failed
>   1.500009     send: C
>   1.500009     w32_serial_read : ulen 512, vmin_ -1, vtime_ 0, hEvent
> 000007A8
>   1.531259     w32_serial_read : characters are available on input buffer
>   1.531259     w32_serial_read : Reading 1 characters
>   1.531259     w32_serial_read : total characters read = 1
>   1.546885     w32_serial_read : Reading 3 characters
>   1.546885     w32_serial_read : total characters read = 4
>   1.546885     w32_serial_read : characters are available on input buffer
>   1.546885     w32_serial_read : Reading 1 characters
>   2.546891     w32_serial_read : total characters read = 4
>   2.546891     read: NAK
>   2.546891     instcmd: command [shutdown.stop] failed
>   2.656267     send: C
>   2.656267     w32_serial_read : ulen 512, vmin_ -1, vtime_ 0, hEvent
> 000007A8
>   2.687517     w32_serial_read : characters are available on input buffer
>   2.687517     w32_serial_read : Reading 1 characters
>   2.687517     w32_serial_read : total characters read = 1
>   2.687517     w32_serial_read : Reading 3 characters
>   2.703142     w32_serial_read : total characters read = 4
>   2.703142     w32_serial_read : characters are available on input buffer
>   2.703142     w32_serial_read : Reading 1 characters
>   3.703148     w32_serial_read : total characters read = 4
>   3.703148     read: NAK
>   3.703148     instcmd: command [shutdown.stop] failed
>   3.703148     Shutdown failed!
>
> So it seems we are unable to shut this thing down? For the record, the
> ups.conf I was using is the following:
>
> ups.conf
> ========
> [ups1]
> driver = blazer_ser
> port = com1
> novendor
> runtimecal = 300,100,840,50
> offdelay = 120
> ondelay = 3
>
> Now is the strange thing. I switched to the bestups driver for the purposes
> of contucting the same test. I changed ups.conf to:
>
> ups.conf
> ========
>
> [ups1]
> driver = bestups
> port = com1
> id = 610,1000,225,230,10.0,36.0
> nombattvolt=41.1
>
> This time, executing the kill command (bestups -a ups1 -DDDDD -k) seems to
> do the trick! From the log:
>
> C:\Program Files\NUT\bin>bestups -a ups1 -DDDDD -k
>
> Network UPS Tools - Best UPS driver 1.06 (2.6.3-3534:3545M)
>   0.000000     debug level is '5'
>   0.000000     w32_serial_open (com1)
>   0.000000     setting initial state on com1
>   0.000000     000007AC = w32_serial_open (com1)
>   0.000000     vmin_ 0, vtime_ 0
>
>   0.109376     action 0
>   0.109376     vtime 0, vmin 1
>
>   0.109376     ReadTotalTimeoutConstant -2, ReadIntervalTimeout -1,
> ReadTotalTmeoutMultiplier -1
>   0.109376     Initiating UPS shutdown
> The UPS will shut down in approximately one minute.
>   0.359378     w32_serial_read : ulen 64, vmin_ 1, vtime_ 0, hEvent 000007A8
>   0.359378     w32_serial_read : characters are available on input buffer
>   0.359378     w32_serial_read : Reading 1 characters
>   0.359378     w32_serial_read : total characters read = 1
>   0.359378     w32_serial_read : Reading 13 characters
>   0.359378     w32_serial_read : total characters read = 14
>   0.359378     w32_serial_read : ulen 64, vmin_ 1, vtime_ 0, hEvent 000007A8
>   0.359378     w32_serial_read : characters are available on input buffer
>   0.359378     w32_serial_read : Reading 1 characters
>   0.406253     w32_serial_read : total characters read = 1
>   0.421878     w32_serial_read : Reading 13 characters
>   0.421878     w32_serial_read : total characters read = 14
>   0.421878     w32_serial_read : ulen 64, vmin_ 1, vtime_ 0, hEvent 000007A8
>   0.421878     w32_serial_read : characters are available on input buffer
>   0.421878     w32_serial_read : Reading 1 characters
>   0.468753     w32_serial_read : total characters read = 1
>   0.468753     w32_serial_read : Reading 13 characters
>   0.468753     w32_serial_read : total characters read = 14
>   0.468753     w32_serial_read : ulen 64, vmin_ 1, vtime_ 0, hEvent 000007A8
>   0.484378     w32_serial_read : characters are available on input buffer
>   0.484378     w32_serial_read : Reading 1 characters
>   0.515629     w32_serial_read : total characters read = 1
>   0.515629     w32_serial_read : Reading 4 characters
>   0.515629     w32_serial_read : total characters read = 5
> The UPS will restart in about one minute.
>
> Checking physically the ups, it really shutted down. It almost immediately
> restarted though, perhaps because it was connected to AC power? Pity that I
> can't use this driver though, since neither offdelay, nor ondelay are
> supported:
>
> C:\Program Files\NUT\bin>bestups -h
>
> Network UPS Tools - Best UPS driver 1.06 (2.6.3-3534:3545M)
>
> usage: bestups -a <id> [OPTIONS]
>  -a <id>        - autoconfig using ups.conf section <id>
>                 - note: -x after -a overrides ups.conf settings
>
>  -V             - print version, then exit
>  -L             - print parseable list of driver variables
>  -D             - raise debugging level
>  -q             - raise log level threshold
>  -h             - display this help
>  -k             - force shutdown
>  -i <int>       - poll interval
>  -r <dir>       - chroot to <dir>
>  -u <user>      - switch to <user> (if started as root)
>  -x <var>=<val> - set driver variable <var> to <val>
>                 - example: -x cable=940-0095B
>
> Acceptable values for -x or ups.conf in this driver:
>
>        Override nominal battery voltage : -x nombattvolt=<value>
>              Battery voltage multiplier : -x battvoltmult=<value>
>            Force UPS ID response string : -x ID=<value>

the subtle difference between these 2 drivers is that bestups only
sends "S01R0001" while blazer first try to cancel any pending shutdown
before launching SxxRxxxx, with the option of changing {on,off}delay.

to confirm this, simply use upsrw to send a shutdown.return command.
having the driver running in debug mode, I'd like to see the related traces.
if it works, I'll check for making shutdown.cancel failure non fatal
(Ie, optional).

cheers,
Arnaud
-- 
Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.free.fr/



More information about the Nut-upsuser mailing list