norkator / apcupsd-monitor

Android app for monitoring Eaton and APC UPS devices statuses and view events (UPS => Uninterruptible power supply) supports APC network management card, synology upsc
https://play.google.com/store/apps/details?id=com.nitramite.apcupsdmonitor
GNU Affero General Public License v3.0
20 stars 3 forks source link

No connection using APCUPSD TCP #22

Closed gidhap closed 3 years ago

gidhap commented 3 years ago

Hi, I am running an APS Smart UPS, working well so far. My Powerchute agents and Linux cllients (slaves) connect very well. Unfortunately I cannot connect via the app. "UPS unreachable" and "debug output is null". Is it possible to directly connect from the app to the UPS on 3551, or do I need to have a server running apcupsd? Txs

norkator commented 3 years ago

Hey,

Yes you need to have apcupsd. That port 3551 is related to that software. (http://www.apcupsd.org/)

I remember one time trying Powerchute but that doesn't have any remote capabilities if I remember right.

You can use some network scanner / port scanner to see if that port 3551 is open. I have app for that case too if needed: https://play.google.com/store/apps/details?id=com.nitramite.quickscan

gidhap commented 3 years ago

Hey Martin, txs for the quick response. fyi "Powerchute Network" is the version to be used for Win10 clients/slaves to access APCs via ethernet. I tried your portscanner, nice tool btw, but it didn't show the 3551 as being open. However, I am not a coder at all, so here is my simplified view. If a Linux Client using apcupsd, acting as a slave to the UPS, can read all the APC UPS data, the prerequisites to pull information from the UPS is given, or am I wrong? I attached the output of one of my linux clients accessing the UPS via SNMP. Maybe it is only a small tweak required ;) ? If it would work, it would be great, but if not - no problem at all.

apcupsd.conf.txt

` karl@proxmox:~# apcaccess

APC : 001,044,1035 DATE : 2021-02-16 19:18:03 +0100
HOSTNAME : proxmox VERSION : 3.14.14 (31 May 2016) debian UPSNAME : APCUPS CABLE : Ethernet Link DRIVER : SNMP UPS Driver UPSMODE : Stand Alone STARTTIME: 2021-02-16 15:06:17 +0100
MODEL : Smart-UPS 1000 STATUS : ONLINE LINEV : 233.0 Volts LOADPCT : 18.0 Percent BCHARGE : 100.0 Percent TIMELEFT : 47.0 Minutes MBATTCHG : 40 Percent MINTIMEL : 5 Minutes MAXTIME : 0 Seconds MAXLINEV : 233.0 Volts MINLINEV : 230.0 Volts OUTPUTV : 233.0 Volts SENSE : High DWAKE : 1000 Seconds DSHUTD : 480 Seconds DLOWBATT : 2 Minutes LOTRANS : 207.0 Volts HITRANS : 253.0 Volts ITEMP : 30.0 C ALARMDEL : 30 Seconds BATTV : 27.0 Volts LINEFREQ : 50.0 Hz LASTXFER : Automatic or explicit self test NUMXFERS : 0 TONBATT : 0 Seconds CUMONBATT: 0 Seconds XOFFBATT : N/A SELFTEST : NG STESTI : OFF STATFLAG : 0x05000008 MANDATE : 11/06/2013 SERIALNO : AS1345222226 BATTDATE : 08/15/2014 NOMOUTV : 230 Volts FIRMWARE : UPS 08.8 (ID18) END APC : 2021-02-16 19:18:32 +0100
karl@proxmox:~# `

norkator commented 3 years ago

"I am not a coder at all" - Not a problem.

Your setup looks good and that output should be working too, if not (I can test it manually soon) then I make changes. We can get this working, no problem.

By the way, your attached config for apcupsd has one problem:

# NISIP <dotted notation ip address>
#  IP address on which NIS server will listen for incoming connections.
#  This is useful if your server is multi-homed (has more than one
#  network interface and IP address). Default value is 0.0.0.0 which
#  means any incoming request will be serviced. Alternatively, you can
#  configure this setting to any specific IP address of your server and 
#  NIS will listen for connections only on that interface. Use the
#  loopback address (127.0.0.1) to accept connections only from the
#  local machine.
NISIP 127.0.0.1

That ip is set to be accessible from only local machine as that instructions say. Set it to that 0.0.0.0 to make it available. Then you can use that port scanner application again and should see port 3551 open --> hopefully.

Post me your results. I try check that config output should it be parseable. By quick look it should work.

norkator commented 3 years ago

Don't delete your apcaccess output you pasted here because it looks to have more information my cheap UPSes don't provide so I could use this to improve application.

norkator commented 3 years ago

Tested app with your data like this https://github.com/norkator/apcupsd-monitor/blob/master/app/src/main/java/com/nitramite/apcupsdmonitor/Mock.java simulating my UPS but replacing output with your provided data and it worked nicely.

norkator commented 3 years ago

Closing since app has no problem

gidhap commented 3 years ago

Hi Martin, after reading through the apcupsd manual to better understand the setup I found and understood my problem. Whilst all my LINUX and WIN10 clients act as a slave, receiving their UPS information directly from the APC SMART UPS, the APP isn't designed to do so, it wants to talk to an APC NIS server (apcupsd). So I had to set up one LINUX client as an APC NIS server, which is done by adding two lines to the conf file: NETSERVER ON NISIP 0.0.0.0 Very happy with your app now, also bought your QuickScan app which is very handy.

norkator commented 3 years ago

Hi Martin, after reading through the apcupsd manual to better understand the setup I found and understood my problem. Whilst all my LINUX and WIN10 clients act as a slave, receiving their UPS information directly from the APC SMART UPS, the APP isn't designed to do so, it wants to talk to an APC NIS server (apcupsd). So I had to set up one LINUX client as an APC NIS server, which is done by adding two lines to the conf file: NETSERVER ON NISIP 0.0.0.0 Very happy with your app now, also bought your QuickScan app which is very handy.

Glad you got it sorted out. My own setups are very simple usb serial cables and stock apcupsd with their own drivers with NIS server enabled and those have been just worked.

gidhap commented 3 years ago

I did a quick drawing and a set of links to information which might be helpful for others too. See attached APC.pdf

norkator commented 3 years ago

I did a quick drawing and a set of links to information which might be helpful for others too. See attached APC.pdf

This comes to a point that I dont have experience with ethernet connected upses. Great drawing, simplifies understanding of your setup.