Coder Social home page Coder Social logo

norkator / apcupsd-monitor Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 3.0 4.81 MB

Android app for monitoring Eaton and APC UPS devices statuses and view events (UPS => Uninterruptible power supply) supports APC network management card, synology upsc

Home Page: https://play.google.com/store/apps/details?id=com.nitramite.apcupsdmonitor

License: GNU Affero General Public License v3.0

Java 100.00%
apcupsd apc ups uninterruptible-power-supply android-application android apcupsd-monitor norkator battery-monitor battery-level

apcupsd-monitor's Introduction

APCUPSD UPS Battery Monitoring Android application Promo Video

Upper image is a video link.

APCUPSD Monitor

Android app for monitoring APC and EATON IPM UPS device statuses and view events. Watch Youtube video for better description. I brought this project on Github so other people can add features for their own use. See license and contribution rules below.

Приложение для Android для мониторинга состояний устройств ИБП APC и EATON IPM и просмотра событий. Посмотрите видео на Youtube для лучшего описания. Я разместил этот проект на Github, чтобы другие люди могли добавлять функции для собственного использования. См. Правила лицензирования и внесения взносов ниже.

Table of contents

Images

Example of dark theme widget Example of events
widget events

Features

  • Basic status details viewer.
  • Event logs viewer.
  • Supports parsing data via SSH, APCUPSD Daemon NIS, Synology UPS, APC Network Management Card, Eaton IPM (Intelligent Power Manager).
  • Firebase based status check triggering and monitoring with notifications.
  • Front screen widget support.
  • Light and dark themes automatically following Android OS system theme.

UPS specific notes

Always be careful when opening UPS software interfaces to public internet. These interfaces seem to be interesting target for security researchers and bad people. Learn to create VPN tunnel from your device to your network instead and route traffic trough that. Or use only in local network via WLAN.

APCUPSD

  • SSH supported with custom command options.
    • APC NMC (Network Management Card AOS)
    • Synology UPSC with upsc ups command.
  • NIS protocol supported which is best option for closed|internal network use.

Eaton

  • Node ID is same as serial number. Node ID - это то же самое, что и серийный номер.
  • This app is developed towards IPM version -> 1.69.253 or higher. Используйте IPM версии 1.69.253 или выше.
  • IPM with https (default) installation way, which means web UI opens from port 4680.
  • IPM with cleartext http >> NOT RECOMMENDED
    • Use this only if you have no other way.
    • Change IPM configuration to allow http, this means port 4679. eaton_unsecure
    • Switch app https settings toggle to false.
    • Cleartext required special code from app side, which Google may drop support any time.
    • Открытый текст требовал специального кода со стороны приложения, который Google может прекратить поддерживать в любой момент.

Requirements

  1. Download and install Android Studio: https://developer.android.com/studio
  2. You need virtual or physical phone.
  3. Follow IDE instructions.
  4. Open issue if something is unclear.

Contributions

  • Feel free to add new features and fix bugs. I review pull requests and make releases when required.
  • If you are planning to make new feature or bigger change, open issue and let's talk about it first. Because it needs to serve everyone.
  • If you feel my code is horrible, feel free to tell me about it. No hard feelings, lets improve together.
  • Have huge need to write more tests? you are really welcome to do so.

Authors

Contributors

License

See repo license section or license file.

Permission to release this app on any Play Store as a new app is forbidden!
Запрещается выпускать это приложение в любом магазине Play в качестве нового приложения!

apcupsd-monitor's People

Contributors

bo0tzz avatar dependabot[bot] avatar fuutott avatar norkator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

apcupsd-monitor's Issues

Feature request: configure displayed items on main screen

There's currently an option to configure the items that are displayed in the detail screen. I'd also like an option to configure the items that are shown on the main screen, so that I can get a quick overview of the values I care about across all my UPSes.

App crashes

Every time i add a nut server the app crashes and wont open. After cleaning the cahes i am able to access the app again.

Fix ArrayIndexOutOfBoundsException

"java.lang.ArrayIndexOutOfBoundsException"

Type: java.lang.RuntimeException

Only one impacted user

java.lang.RuntimeException: at android.os.AsyncTask$3.done (AsyncTask.java:354) at java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:383) at java.util.concurrent.FutureTask.setException (FutureTask.java:252) at java.util.concurrent.FutureTask.run (FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641) at java.lang.Thread.run (Thread.java:764) Caused by: java.lang.ArrayIndexOutOfBoundsException: at java.lang.System.arraycopy (Native Method) at com.jcraft.jsch.Buffer.getByte (Buffer.java:148) at com.jcraft.jsch.Buffer.getString (Buffer.java:188) at com.jcraft.jsch.UserAuthPassword.start (UserAuthPassword.java:158) at com.jcraft.jsch.Session.connect (Session.java:470) at com.nitramite.apcupsdmonitor.ConnectorTask.connectSSHServer (ConnectorTask.java:191) at com.nitramite.apcupsdmonitor.ConnectorTask.upsTaskHelper (ConnectorTask.java:142) at com.nitramite.apcupsdmonitor.ConnectorTask.doInBackground (ConnectorTask.java:92) at com.nitramite.apcupsdmonitor.ConnectorTask.doInBackground (ConnectorTask.java:33) at android.os.AsyncTask$2.call (AsyncTask.java:333) at java.util.concurrent.FutureTask.run (FutureTask.java:266) at CPU at 117 at 39 at 34 at 17 at 12 at 11 at 9.7 at 5.7 at 5.1 at 4.8 at 4.8 at 4.3 at 3.3 at 2.9 at 2.9 at 2.5 at 1.8 at 1.8 at 1.5 at 1.5 at 1.3 at 1.2 at 1.2 at 1.1 at 1.1 at 1.1 at 1.

Synology nas support

Command used to get output
upsc ups

Example output:

battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.runtime: 5580
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 27.0
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Smart-UPS 750
device.serial: AS1244114679
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 5
driver.parameter.port: auto
driver.version: DSM6-2-25364-191230
driver.version.data: APC HID 0.95
driver.version.internal: 0.38
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: UPS 08.3 / ID=18
ups.mfr: American Power Conversion
ups.mfr.date: 2012/11/01
ups.model: Smart-UPS 750
ups.productid: 0003
ups.serial: AS1244114679
ups.status: OL
ups.timer.reboot: -1
ups.timer.shutdown: -1
ups.vendorid: 051d

IPM logic info deletion issue

IPM logic clears database data too early before successful data query from IPM instance meaning ups current data is lost at app side. This is misleading.

Find way to implement tests for ConnectorTask

ConnectorTask is critical class with its threads. Would be nice to find working way to implement tests for this class to run it with each UPS this is ever developed for from NIS, SSH, NMC to Eaton but mocking all this might be hard to do. Using Mockito might be possible?

2 x Features requests for apcupsd-monitor

In APCUPSD mode:

  1. Please add support for upsd "instance": we specify it with a @ on front of the FQDN for monitoring the correct upsd master host instance (as defined in ups.conf). For example: [email protected] refer to the instance "usbhid" from ex4100.localdomain master upsd host. Please refer to section "6.2. Basic configuration", subsection "Driver configuration" at https://networkupstools.org/docs/user-manual.chunked/ar01s06.html

  2. Please add support for authenticated upsd requests by username and password (as defined in the file upsd.users on the master upsd host). For more details, please refer to: https://networkupstools.org/docs/man/upsd.users.html

java.lang.NullPointerException

People are experiencing new crashes after latest updates.

java.lang.NullPointerException:
at com.nitramite.apcupsdmonitor.CustomUpsAdapter.getView (CustomUpsAdapter.java:83)
at com.wdullaer.swipeactionadapter.DecoratorAdapter.getView (DecoratorAdapter.java:47)
at com.wdullaer.swipeactionadapter.SwipeActionAdapter.getView (SwipeActionAdapter.java:63)
at android.widget.AbsListView.obtainView (AbsListView.java:2629)
at android.widget.ListView.makeAndAddView (ListView.java:2224)
at android.widget.ListView.fillDown (ListView.java:826)
at android.widget.ListView.fillFromTop (ListView.java:888)
at android.widget.ListView.layoutChildren (ListView.java:1960)
at android.widget.AbsListView.onLayout (AbsListView.java:2405)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1582)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout (SwipeRefreshLayout.java:689)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at androidx.coordinatorlayout.widget.CoordinatorLayout.layoutChild (CoordinatorLayout.java:1213)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayoutChild (CoordinatorLayout.java:899)
at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout (CoordinatorLayout.java:919)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at androidx.appcompat.widget.ActionBarOverlayLayout.onLayout (ActionBarOverlayLayout.java:536)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1582)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout (DecorView.java:1225)
at android.view.View.layout (View.java:24475)
at android.view.ViewGroup.layout (ViewGroup.java:7383)
at android.view.ViewRootImpl.performLayout (ViewRootImpl.java:4212)
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:3647)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:2575)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:9916)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1010)
at android.view.Choreographer.doCallbacks (Choreographer.java:809)
at android.view.Choreographer.doFrame (Choreographer.java:744)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:995)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8512)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)

NIS APCUPSD not updating logs

I had a broken APC UPS wich I changed with a newer one.
I have real data information working in the app but the Events logs not refreshing at all with last event as Not availbale
Any thoughts?

Thanks

Eaton IPM with http

Investigate possibility to use IPM with http.

If works, then create new settings to select between http and https with IPM upses.

No connection using APCUPSD TCP

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

Google security features breaking app

"""
We reviewed APCUPSD Monitor - Remote UPS Battery Monitor, with package name com.nitramite.apcupsdmonitor, and found that your app uses software that contains security vulnerabilities for users. Apps with these vulnerabilities can expose user information or damage a user’s device, and may be considered to be in violation of our Malicious Behavior policy.

Below is the list of issues and the corresponding APK versions that were detected in your recent submission. Please migrate your apps to use the updated software as soon as possible and increment the version number of the upgraded APK
"""

Problem comes from ignoring SSL certificates. So basically getting IPM feature work is pain **** and need to use HTTP.

NUT UPS stats not diplayed

I successfully configure a NUT UPS, it seems to connect but no Infos are reported. When I click 'debug informations' I see the payload returned. But it looks like the text encoding maybe isn't right, maybe that's the problem. The host is TrueNAS Scale with the UPS plugin. Other clients can fetch data property from the server:

BEGIN LIST VAR eatonbattery.charge "11"battery.charge.low "35"battery.runtime "215"battery.type "PbAc"device.mfr "EATON"device.model "Ellipse ECO 650"device.serial "000000000"device.type "ups"driver.name "usbhid-ups"driver.parameter.pollfreq "30"driver.parameter.pollinterval "2"driver.parameter.port "/dev/uhid"driver.parameter.synchronous "no"driver.version "2.7.4"driver.version.data "MGE HID 1.40"driver.version.internal "0.41"input.transfer.high "264"input.transfer.low "184"outlet.1.desc "PowerShare Outlet 1"outlet.1.id "2"outlet.1.status "on"outlet.1.switchable "no"outlet.2.desc "PowerShare Outlet 2"outlet.2.id "3"outlet.2.status "on"outlet.2.switchable "no"outlet.desc "Main Outlet"outlet.id "1"outlet.power "25"outlet.switchable "no"output.frequency.nominal "50"output.voltage "230.0"output.voltage.nominal "230"ups.beeper.status "enabled"ups.delay.shutdown "20"ups.delay.start "30"ups.firmware "02"ups.load "8"ups.mfr "EATON"ups.model "Ellipse ECO 650"ups.power.nominal "650"ups.productid "ffff"ups.serial "000000000"ups.status "OL"ups.timer.shutdown "0"ups.timer.start "0"ups.vendorid "0463"END LIST VAR eaton

Default NUT port seems to not be substituted, initial setup could be better integrated

Cheers, I was made aware of this app by a NUT community member and posted a link at https://github.com/networkupstools/nut/wiki/Android-clients (will add to proper docs later).

Looks great upon first impression, so please don't take this post as criticism but rather as points of improvement :)

One thing that I stumbled upon in a local setup was that I selected the "NUT" option as the server protocol and initially entered just the IP address (hoping to see the list of one or more UPSes exposed there, to select one). Alas, nothing appeared and the full devicename@servername had to be typed (as suggested in help text for the field). Fetching a list of devices and configuring them in clickety-click style would be a welcome addition. Likewise, discovering a server in the subnet which listens on expected port (and/or using mDNS/avahi if user's NUT is built with that) could be a further friendly option.

Another was that actually my first try was the hostname (which goes to IPv6 for me), and whether due to app or Android or networking concerns, it did not go well. UPDATE: After some investigation, I found that my upsd was actually only listening on IPv4. When I fixed that (adding a LISTEN myIPV6hostname along with LISTEN * for IPv4), the app picked it up well - so both DNS and IPv4/IPv6 are supported properly.

Finally, the issue because of which I came to post here: I had to explicitly enter the port number (3493). Although the help text speaks about default ports for different protocols, I somehow expected that an absent entry would cause the app to use that default port. This did not happen and feels like a bug :)

PS: not "remove server" but "remote server" in some message, and "18 of load" (missing "%" char) caught my eye ;)

Synology NAS updating via SSH does no longer work

Most likely last updates affected to this. I didn't have any chance to test this.

Original user email contect:
I've been using your APCUPSD App for one year, and for some weeks I haven't been able to update the data from a Cyberpower UPS connected to a Synology NAS. My other APC UPS connected via Raspberry works, I tried to delete and re-add the one connected to the Synology and I think it can detected because the App asks me to approve the new fingerprint.

Release is not compliant with the Google Play 64-bit requirement

Apparently this: #47

is causing this:

"""
This release is not compliant with the Google Play 64-bit requirement.
The following APKs or app bundles are available to 64-bit devices, but they only have 32-bit native code: [41]
Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code that it needs. This avoids increasing the overall size of your app.
"""

and origin for this is: https://github.com/norkator/apcupsd-monitor/pull/47/files#diff-0beea3d47c5229f0c5f32fc4054727d6b9f7d15a6f26ff5c69cd5da699dcc168

SSH access to NMC2 not working

Hi,
I'm a big fan of this app, and am happily using it to read out data from an apcupsd server. Now I have another UPS with a network management card 2 that I'd like to add to the app as well, but it doesn't seem to work. The NMC2 firmware is fully updated, and I can access it over SSH from my phone. When I add it to the app however, it doesn't seem to work - the UPS status screen just shows N/A, and nothing is shown under debug output. You can see the settings I used at https://i.imgur.com/qcXcYOW.jpg. Is there anything I might be missing? Thanks :)

Edit: I do get a prompt to accept the SSH host key, but after that nothing seems to work.

App crashes when trying to access settings menu on A7

Hi! I'm Marcus and I really like using your app. It has already proven it's usefulness in a couple of power outages, when I could not use a regular computer to check the remaining time on my UPS I use for my network equipment. Thanks for making it!
Unfortunately, my newer-ish phone, an Honor 8X with Android 10, broke. Now I'm back at my older Huawei P9 Lite, which stopped at Android 7. Can't say it's unusable, it is actually better in some ways than the newer phones.

I've started to have this issue on a previous version of this app and the issue still persists with the newest version.
Whenever I tap onto the gear icon in the top right corner of the main screen in your app, it is supposed to take me to the settings menu. Instead, the screen goes black for a sec and then the app closes by itself.
Just to clarify, I installed your app onto my older phone just not too long ago, so I can't really confirm if this issue didn't occur in an older version of the app.

I should be able to send you a logcat (debug level, my device is rooted) from my device when this issue occurs. For now, I'm finally going to get that log and try to find out what's going on.

Edit: got the crash!

AndroidRuntime
FATAL EXCEPTION: main
Process: com.nitramite.apcupsdmonitor, PID: 19324
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nitramite.apcupsdmonitor/com.nitramite.apcupsdmonitor.Preferences}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6517)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832)
Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:928)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:809)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
at com.nitramite.apcupsdmonitor.Preferences.onCreate(Preferences.java:70)
at android.app.Activity.performCreate(Activity.java:6915)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
... 9 more

Edit 2: There's many warnings occuring right before the app crashes that read:

ResourceType
For resource 0x7f110242, entry index(578) is beyond type entryCount(182)

Each warning contains different hex values and numbers.

Push notifications

Would it be possible to implement push notifications when the app detects a UPS is on power or went offline?

Possible notification/alert options:
-on battery
-offline
-online
-battery change
-low battery
-UPS issue shutdown

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.