APC SmartUPS Status Device

This is a device Handler to get the status of your APC Smartups that has the optional network card.

It must be on your network with an ipaddress and have telnet enabled in the network setups.

It telnets to the specified ip and port every X minutes as specified in the perferences, and logs in using the username and password specified in the preferences.

It get the UPS runtime in minutes and hours and also the UPS status and last run time and puts these in attributes that can be used in any rule.

For instance, to gracefully shutdown you hub when the UPS is on battery and about to run out of runtime. In this way you can avoid database corruption for an unexpected non clean shutdown..

Enjoy

Larry

4 Likes

dashboard showing attributes

Screenshot 2020-09-13 001120

1 Like

new version..
1.1

Added command to get battery percentage and associated attribute in case you perfer to use rules to check that instead of runtime.
Rounding to whole percentage so I could custom color the tiles from green to red based on percentage..
Here are the custom color settings for tile attributes..
Also need to override the two time tiles with this is the css otherwise those colorize as well.

#tile-1, #tile-2 {
Background-color: rgb(90, 90, 90,.6)!important;
}

In addition, i colored the online, battery statues red/green.

Screenshot 2020-09-13 151727

Been looking for an integration directly with the SmartUPS network card. Does this work with the APC AP9619 environmental network card too? Getting an error during connection (line 119).

Should work but you need to enable telnet in the card through the web interface. You can test that you can telnet directly to the ups.

Any suggestions for a basic UPS that integrated with APC and has the appropriate attributes for a Hubitat hub and a router?

Thanks. Got connected. Now seeing these errors in the log:

Did you configure the device and put usernane and password in. Because it looks like its closing connection because you haven't logged in. You also have to hit save preferences in the device

Try telneting in from a command prompt and logging in. My guess is it is not working. Also are you sure that is the IP for your uos as it is closing immediately after connection.

Apc smt1500 with slot in back for network card 9630 or 9631

You can get one cheap on eBay. You most likely will have to get your own batteries. As most ship without due to weight. Smc 1500 does not work as no slot for net card. Some older models also have slot for network card.

The SmartUPS SUA1500 and SUA1000 are the older model of the SMT-series and also have a slot for a network card. Find them on eBay. All mine are using an old version of the APC network card, the environmental monitoring AP9619 card. Supports an external probe for humidity and temperature. Currently interfaced with HE hub for shutdown control using apcupsd.

Are you using an AP9630 card? I can log in just fine using Telnet to the AP9619 so wondering if there's a difference in card firmware/features causing me an issue.

yes 9630 but weird if you can log in via telnet from the command line i should see something after the log in.. can you log in and try the detstatus -ss command and send me a copy of the output from the command prompt so i can look at it.. i have a couple other ups i will try and see which have which cards. I am not sure whey it is immediately disconnecting you in the log you sent..

also if you want to port forward from your router to port 23 on you ups and give me access i can maybe test it myself..

That is what i am doing to test the various ups i have.. but all have 9630 or 9631 cards i believe

The AP9619 only gives me menu access, no command line. Believe APC added the command line option to their AP963x series of cards. Will pick one up and test it. Will let you know what I find out. Thanks for your help.

ah that explains it..
it is possible to work with menu access but more difficult.. would have to have a totaly different interface.. probably not worth the effort .. you can get newer cards pretty cheap on ebay.

also double check there is no firrmware update program i was able to upgrade the firmware on all my cards to latest using this program
but beware after you do it.. it resets the card to only ssh access so you will need unix or putty for pc to go back in and enable the other services..

New version 1.2 ..
repull from git hub..

  • v 1.2 added changes due to varying net card firmware responses, also added some changed debugging to help debug alternate smart ups net cards
  •    also handle issue where some ups return on line , others online
    

new verison 1.3
Had to change attribute types from integer to number as Int did not work for comparisions in rule machine..

Here are example rules for both battery percentage and runtime that I am using in RM to shutdown the hub. Obviously you need to tune based on how often the device is set to refresh and how fast your ups loses runtime/power. Also the rule does not yet have the shutdown command as I am still testing and waiting for the network card that goes in the actual ups I have the hub on. For now I am testing connecting to one of my remote ups's over port forwarding.

You need to use the conditions in both the trigger and the if statements becuase you want the rule to trigger immediately if the ups goes on battery just in case you dont have sufficient rutime, and then also everytime either the runtime in minutes (with 0 hours) or the battery percentage goes down.

Ok, here is the update.. read carefully very important.
You cannot use integer for the attribute type, number works, but then the rules error out if you don't use a decimal pt. in the rule ie. 20.0 NOT 20.

You also therefore cannot use a drecreased trigger on these custom attributes (I belive these are all bugs/quirks? in RM) ... Anyway there are workarounds.. Use a Changed trigger and number with decimal points in comparisons.. Also make sure to pay attention to the Case of your words ie OnBattery NOT Onbattery etc. Otherwise again your rules will not work..
Recommand you test the rules without the shutdown and just sending message like I have.

So, after all that here are the two rules that work: One based on battery percentage, and one based on minutes left of runtime. Also, of course you need to add the hub shutdown command in the actions! :slight_smile:

Also, make sure to pull latest version from github . version 1.3 currently

!

Hmm, thanks for the suggestions guys. Here's the thing. I have 5 hubs distributed across a large physical area. So having a single UPS with multiple outlets doesn't seem to fit my use case. Sorry, I'm a noob at UPS's....

obviously you need multiple UPS's you can run multiple versions of the driver to multiple ups as each will be on its own ip address. Just create a device based on the device type for each ups.

Not cheap but it works. But regardless you probably need multiple ups' or some backup anyway as unintended shutdowns tend to corrupt the database as I and others have found out.

How are you getting each hub on the net? you have cat 5/6 distributed to each hub?

Yeah exactly -- I have cat5 homeruns to a utility room in the corner of the basement. I also have a backup generator with capacity for 6-8 circuits, but the boss (wife) insists we use it for less important things :stuck_out_tongue_winking_eye: like refrigerator, furnace, garage door, freezer, and a couple others. So no capacity left for my router and HE hubs. Thus the question.

I'll have to look at their product catalog. Even their small UPS's have the smart feature set?

No as mentioned about only the smartups, either the smt (not smc) or the older sua models have the slot for the network card in the back.. The cheaper BackUPS series unfortunately do not and only have serial interface connections and no ip address or command line interface.

But, also mentioned you cna get then pretty cheaply on amazon or ebay, and then get you own batteries to put in.. also the netcards as most are not shipped by default can get also gotten cheaply..

Also, if you buy a used or refurb one without batteries be sure to ask if it comes with the internal connector cables and fuse or you see it in the pictures as the batteries usually dont come with them although you can get them separatly for around 15-20 bucks.
I got my last one for 99 bucks with free shpping , plus the batteries is really not much more than a cheaper model and is much better quality. Of course not new.. You can still get them new but they are around 500-600.

Also, mentioned are the olde rsua1500 and 1400 models that have slots for a network card, but you can get the newer smt used for the same or less anyway so no real reason to pickup the older unless you already have some of them.

Here are a few links.

ups

https://www.ebay.com/itm/APC-Smart-UPS-1500-SMT1500-1500VA-120-UPS-Battery-Backup-UPS-NO-BATTERY-GOOD/143702191210?hash=item2175516c6a:g:6cQAAOSwAS1fRxnU

https://www.ebay.com/itm/APC-SMT1500-Smart-UPS-PS-Backup-120V-No-Battery-90-Days-Warranty-Fast-Ship/283958081776?hash=item421d3878f0:g:ZN4AAOSwNSxfD08a

Batteries

https://www.ebay.com/itm/Mighty-Max-12V-18Ah-Replaces-RBC7-SU1400-SUA1500-SU700-APC-Cartridge-2-Pack/381205019433?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2060353.m2749.l2649

net cards

https://www.ebay.com/itm/APC-9631-Network-Management-Card-UPS-APC9631-640-1110B-Z-Rev-06/133511546132?hash=item1f15e88514:g:LWMAAOSwFn9fUq-t

new version on git hub

v 1.4 added option to enable/disable.

1 Like