[SOLVED] UPS setup on USB port/stty and via AP9716 Network Card ?


Recommended Posts

Despite lots of reading-up, trial and error I can't seem to get my v6.2.(or a v6.1.3) server to see an APC Smartups on a com port.

 

I've connected it via a Startech USB-Serial adapter (ICUSB2321F) and a pukka APC black db9 cable (940-0024C).

 

I've checked that the UPS is communication correctly by jacking into it via Putty (configured: 2400b/8/1/none/RTS) from a Windows 10 laptop (using the same cable combo), and this all works fine, viz:

 

-------------------------------

User Name : apc

Password  : ***

 

American Power Conversion              Network Management Card AOS      v2.6.4

© Copyright 2004 All Rights Reserved  Smart-UPS & Matrix-UPS APP      v2.6.1

-------------------------------------------------------------------------------

Name      : SmartUPS-700-1B                            Date : 06/20/2016

Contact  :                                                        Time : 14:18:27

Location  : Here                                                User : Administrator

Up Time  : 0 Days 0 Hours 5 Minutes                  Stat : P+ N+ A+

 

Searching for a Smart-UPS or a Matrix-UPS...

 

------- Control Console -------------------------------------------------------

 

    1- Device Manager

    2- Network

    3- System

    4- Logout

 

    <ESC>- Main Menu, <ENTER>- Refresh, <CTRL-L>- Event Log

> 1

------- Smart-UPS 700 ---------------------------------------------------------

 

        Status of UPS : On Line

        Last Transfer : Detection of a line voltage notch or spike.

        -----------------------------------------------------------------------

        Input Voltage    : 248.3 VAC        Operating Frequency : 50.00 Hz

        Output Voltage  : 249.6 VAC        Internal Temperature: 103.2 F

        Load Power      : 014.0 % Watts    Battery Voltage    : 27.74 VDC

        Max Line Voltage : 253.5 VAC        Battery Capacity    : 100.0 %

        Min Line Voltage : 249.6 VAC        Runtime Remaining  : 0083 min

        -----------------------------------------------------------------------

        Self-Test Result : Passed            Calibration Result  : Unknown

        Self-Test Date  : 06/17/2016        Calibration Date    : Unknown

 

    1- Control

    2- Diagnostics

    3- Configuration

    4- Detailed Status

    5- About UPS

-----------------------------------

 

Whatever I configure in UPS Settings, I just get 'Connection Lost' even though I never had 'Connected' to start with.

I think I need to replicate the port config that I know works (2400/8/1/none/rts) onto the tty which the USB port is using ... but I don't know where to start  - It's been a VERY long time since I plugged a VT onto a 'nix system

 

Can anyone give me a steer please ?

 

Thanks

Link to comment

Thanks for all those pointers then ...

 

Meanwhile, the following was useful APC serial config info which other may need & which helped me get Putty talking to my APC (vintage SmartUPS 700) on my W10 laptop via a USB port:

 

From the APC/Schneider support forum:

Make sure that there is no application that is using the serial port. For testing you can use Putty and set the port settings to 2400-8-None-1-XOn/XOff. Once you are on the Putty screen press "Shift+Y", this should return an SM on the screen. Press "Shift+A" after seeing SM and this should produce a beep and the LEDs in front should flash once.

 

Also note:

1. The <Backspace> char should be set to Ctrl-H in 'Keyboard' settings on Putty. The default is/was something else.

2. I changed the Com port assigned to the USB on my laptop to Com1 to try and get APC's Powerchute Personal Ed (PCPEInstaller.exe) working, but even when I knew the APC was able to communicate via Com1, the PCPE app could never find an APC device on any port and failed to install.

 

----------------

 

So, over to my unRAID svr with the USB cable which I now know is (or can be made to) work.

I found these commands detailed on unix.stackexchange.com to discover which tty a USB device is using:

 

user@svr2:~# lsusb

Bus 002 Device 002: ID 8087:8001 Intel Corp.

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 002: ID 8087:8009 Intel Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 003 Device 002: ID 18a5:0300 Verbatim, Ltd

Bus 003 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT      232 USB-Serial (UART) IC

Bus 003 Device 003: ID 8087:07dc Intel Corp.

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

user@svr2:~# dmesg|grep tty

[    0.000000] console [tty0] enabled

[    6.795125] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 1655      0A

[46725.791507] usb 3-3: FTDI USB Serial Device converter now attached to ttyUSB0

 

user@svr2:~# udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

...produces a long list of hierarchical configs related to the 'dev' which may be of interest.

 

user@svr2:~# stty -F /dev/ttyUSB0 -a

speed 9600 baud; rows 0; columns 0; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;

swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;

discard = ^O; min = 1; time = 0;

..... & more like this ........

 

user@svr2:~# stty -F /dev/ttyUSB0 2400

user@svr2:~#

 

user@svr2:~# stty -F /dev/ttyUSB0 -a

speed 2400 baud; rows 0; columns 0; line = 0;

 

... but I think/gather I still need to configure the UPSD to see this tty ...

Link to comment

BINGO !!!

 

Thanks Ashe !!

 

It looks like the key config detail which I was missing ... was the name of the device (/dev/ttyUSB0) in the device field of the UPS settings page.

 

Having entered this the status immediately changed to (I think it was) .... Resuming .... followed by 'Online'

 

It's now working fine !!

 

I note that the setting 'UPS Cable' - doesn't seem to make a difference whether it's set to 'USB' or 'smart'. I haven't tried every other combo.

 

However .. @Ashe - how/where do you get that sexy graphical interface to UPS Settings ???

I have Beta 6.2.0-beta21 .. version but mine is just text based ... nothing fancy like your version ???

 

Also .. @digitalfixer - what's a MODBUS cable ??  Is it a USB to RJ11 cable. If so, it won't fit legacy APC UPS' which had/have an RS232/DB9 connector, so to connect an old SmartUPS 700/800/900/1000 etc ... to a modern PC/server you need the setup I've spec'd (USB-DB25 + APC 940-0024C cable) 

 

I think ..

Thanks !

Link to comment

Also .. @digitalfixer - what's a MODBUS cable ??  Is it a USB to RJ11 cable. If so, it won't fit legacy APC UPS' which had/have an RS232/DB9 connector, so to connect an old SmartUPS 700/800/900/1000 etc ... to a modern PC/server you need the setup I've spec'd (USB-DB25 + APC 940-0024C cable) 

 

I think ..

Thanks !

 

Modbus is the replacement for APCSmart. It's used on newer APC units.

 

Kevin.

Link to comment

@digitalfixer - Thanks for clarifying that.

 

Can anyone advise further - can the UPS Settings page be used to configure access/monitoring of an APC UPS via a telnet session to it's NIC - given that I can have the same admin dialogue with the UPS via either it's serial port or it's NIC.

 

IE, can I replace '/dev/ttyUSB0' with '192.168.xx.yy:22' or whatever the telnet port happens to be set to and 'USB' with 'NET'... or can only the NUT plugin do this ?

 

I did try a few combinations but it didn't seem to work ... but should it? ... or do I need to use NUT for that instead?

Link to comment

OK - HOLD that question !!.

 

I found some help in the 'Help' lines for the 'USP Settings' page.

 

YES - you can point your unRAID UPS Settings page at an IP Address (of a UPS' Ethernet Mgmt Card), using these settings (but don't get too excited - it isn't working yet) :

 

---------------------------------------------------------------

UPS Cable                          Ether

 

Custom UPS cable:              <    > Blank

 

UPS type:                          PCnet

 

Device:                              192.168.xx<username>:<passphrase>: PORT#

---------------------------------------------------------------

 

BUT ... I'm not quite there yet. The default port for this is apparently 3052. According to Google, 3052 is specific to 'APC PowerChute Network'. Entering 3052 above doesn't get it working and nor does the telnet port (23) or SSH (22), SNMP (161-162) despite the fact that I can telnet do the UPS/Mgmt Card and get all the config info I need, so what, if any, available service on the APC UPS is handling the status updates.

 

OR .. Do I need to be pointing unRAID to an instance of APC's Network Mgmt App ..  to get this working ?

 

Anyone got this working, if so, how?

Thanks 

 

Link to comment

@Ashe - Thanks for the link ... but it doesn't work for me (on my sandbox ver 6.2.0-beta21)

 

I've tried every combination of settings for - Ether/PCnet/IP-with-&-without: user/pwd/ports ... but I can't get even close to 'Refreshing' and ultimately I just get ... 'Communication Lost' coupled with 'No Information' at the bottom of the screen collected from the UPS.

 

I should add that obviously the original question is solved, but it would be great to get this extra bit of functionality tested too, so as to have a complete picture/record of what's possible or not. There may be others with IP enabled UPS on key unRAID hardware, who would like to have the option of using IP signalling if/when the hardwired (USB-DB9) option is temporarily unavailable.

 

So ... any other suggestions .. or ways to debug what's happening in my case ?

Link to comment

I found these posts on how to configure for a NIS service, i.e. where a unRAID (or other) server is serving out status of the UPS that it's also physically connected to via a serial cable:

https://lime-technology.com/forum/index.php?topic=31071.msg429068#msg429068

https://lime-technology.com/forum/index.php?topic=25710.msg223928#msg223928

 

But that's NOT what I'm trying to figure out here ...

 

I found this un-answered Q from 'Slimer' on the same issue I have:

https://lime-technology.com/forum/index.php?topic=46063.msg440388#msg440388

 

I also saw somewhere a passing comment from 'Joe.L' which suggests he may know how to edit apcupsd.conf to make this work, but no actual details were included.

 

So .. does anyone know if it's possible to get APCUPSD to talk DIRECTLY to an APC UPS via it's AP9716 management card, using APC's proprietary protocol, using a Web port, using SNMP or other setup, and if so HOW ?

 

I'll amend the topic heading to include a reference to AP9716 setup, to see if that gets a bit more input

Cheers

Link to comment

@digitalfixer - I believe the Clinet/Server reference in the apcupsd manual is to APC's NIS service, where a server (any server) is physically connected to a UPS via a serial or modbus cable, but then also serves out the same status info to other devices (clients) OF THAT UPS. Which is not what I was trying to do.

 

However the very next section is what I WAS looking for. See below for this slightly amended ver (to aid brevity):

 

PowerChute Network Shutdown Driver (PCNET)

As of 3.14, Apcupsd supports the PowerChute Network Shutdown protocol ... an alternative to SNMP for use with APC's AP9617 .. network .. modules.

 

## apcupsd.conf v1.1 ##

UPSCABLE ether

UPSTYPE pcnet

LOCKFILE /var/lock

DEVICE ipaddr:user:passphrase

UPSCLASS standalone

UPSMODE disable

 

Note that the username and passphrase ARE NOT THE Web/SNMP login CREDENTIALS ... The default username on a new card is "apc" and the default passphrase is "admin user phrase". To change the passphrase, log in to the Web UI and go to the UPS tab, then to PowerChute -> Configuration ... The password must be a minimum of 15 characters long. The web UI will silently ignore shorter passwords and does not give an error message. There is no apparent way to change the username.

 

HOWEVER - If you try entering the default pasphrase as 'Admin user phrase" even in quotes YOU WON'T SUCCEED, because note what happens (to /etc/apcupsd/apcupsd.conf) when the correct (default) phrase has been entered and then parsed by the apcupsd starting:

 

Entered the DEVICE details c/w passphrase entered in "double quotes" in the UPS Settings page, then grep'd the apcupsd.conf file in /etc/apcupsd to check the change had been applied:-

 

user@svr2:/etc/apcupsd# grep 0.129 apcupsd.conf

DEVICE 192.168.0.129:apc:admin user phrase

 

Note that the quotes have already been stripped out.

THEN Started the apcupsd service and then grep'd the apcupsd.conf file again. NOTHING ELSE HAS CHANGED

 

user@svr2:/etc/apcupsd# grep 0.129 apcupsd.conf

DEVICE 192.168.0.129:apc:admin

 

The 2nd and 3rd words of the passphrase following the first space have VANISHED. Notice that this will be reflected in the settings page also.

 

So I set the passphrase to something with NO SPACES - in my case "test-admin-passphrase"

Infact there is no need to use quotes now as there are no spaces anyway, resulting in this :-

 

user@svr2:/etc/apcupsd# grep 0.129 apcupsd.conf

DEVICE 192.168.0.129:apc:test-admin-passphrase

 

FINALLY - you need to ADD your 'client's' IP address, also in the UPS>Powerchute> area ... but under another tab - 'Client'. OTHERWISE IT WON'T BE ALLOWED to connect to the Powerchute Web Interface.

 

So my settings, for DIRECT NETWORK CONNECTION to an APC AP9617 from a unRAID server (v 6.2.0-beta21) are:

 

UPS Cable                    Ether

Custom UPS Cable      <    > Blank

UPS Type                    PCnet

Device                        <IP.of.my.AP9617.card>:apc:test--admin-passphrase

 

Having  also set "test--admin-passphrase" as the new password in the UPS>Powerchute>Configuration page accessed via the Web interface, AND setup my Client's IP address in UPS>Powerchute>Clients

 

And hey presto, it started working !!

 

... and it doesn't require a server to serve the status of it's UPS out to it's clients

 

-----------------------------

 

I should add that with regard to setting up of serial ports:

1. I am referring to using OLD APC SmartUPS (tested with 700's and 1000's) with a DB9 serial connector

2. The USB cable I use to get the serial port working was a Startech (but there appear to be other suppliers of this type of cable) - StarTech.com 1 Port FTDI USB to Serial RS232 Adapter Cable with COM Retention - USB to RS232 Serial Port Adapter. Available on Amazon in UK.

3. You need to pair this with an APC 940-0024c cable, OR lookup the pinout details (Google knows) and get yourself a DB9M-DB9F jumper adapter such as this: http://www.l-com.com/d-sub-plastic-pcb-jumper-box-db9-male-female

4. With settings on the UPS Settings page as:

 

UPS Cable                    USB

Custom UPS Cable      <    > Blank

UPS Type                    APCsmart

Device                        /dev/ttyUSB0  (or whatever yours is - see the start of this thread for how to discover this)

 

All done !!

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.