Shutdown HE automatically from Windows PC or via Dashboard

I have my HE on a UPS that's also shared and monitored by a Windows PC. That PC is set to shut down when the UPS is getting low on power. I'd like to know what, if anything, people are using to also have their hubs shut down? Ideally it would be a way to have the PC send a shutdown command to HE. But if there's not an easy way to do that then the next option would be to have the PC notify me via email or sms (from the UPS monitoring software) so I can issue a shutdown command from the Dashboard if I'm away.

I've looked into setting up NUT on the PC, but frankly the setup documentation is overwhelming and not PC oriented. This PC is running my BI sever so I don't have the option of switching it to a different OS.

I don't know how to do that from a PC running Windows, but if you're using Linux and apcupsd, then you can call this script as part of your shutdown ....

#!/bin/bash
#
he_login=your_he_username
he_passwd=your_he_password
he_ipaddr=your_he_ip_address
cookiefile=`/bin/mktemp`
#
curl -k -c $cookiefile -d username=$he_login -d password=$he_passwd https://$he_ipaddr/login
curl -k -sb $cookiefile -X POST https://$he_ipaddr/hub/shutdown
rm $cookiefile
2 Likes

I've always wondered how to send credentials via Curl, I'll have to give this a try, in Windows that should translate to

set he_login=your_he_username
set he_passwd=your_he_password
set he_ipaddr=your_he_ip_address
set cookiefile="c:\temp\mktemp"

curl -k -c %cookiefile% -d username=%he_login% -d password=%he_passwd% https://%he_ipaddr%/login
curl -k -sb %cookiefile% -X POST https://%he_ipaddr%/hub/shutdown
rd %cookiefile% /s /q

And you'd save it as a bat file and run it using an atjob at shutdown most likely

1 Like

Thank you - I haven't written a batch file in ~30 years .....

2 Likes

I don't have my hub shutdown as it's on cascaded battery packs that should last for well over 12 hours (20000 mAh each). :smiley: If I do need to shut it down, I can power my router up to get to it.

3 Likes

Dude. What DON'T you have? (Maaaaaaan .... he has all the cool toys) :grin:

3 Likes

LOL I don't have a million dollars or a yacht or my own rocket either. Those are the REALLY cool toys! :wink:

1 Like

Here you go:

:motor_boat: :rocket: 1.000.000 x :dollar:

2 Likes

@dan.t, in case no one has told you today, you're awesome. LOL

Soooo, just a quick question... How do I cash in the :moneybag:???

You always want more :rofl: That wasn't an original requirement.... Maybe in the next version....

2 Likes

So you DO know me!!! :wink: hahaha

1 Like

Hopefully by "cascaded battery packs" you mean several actual batteries connected in parallel and you don't mean daisy chained UPS's plugged into one another because that does not add the wattage or get additional runtime.

1 Like

It's a small battery wall in two sections using 18650 batteries (my bestie is a vape store manager, so I have access to as many batteries as I need).

Gotcha. I've just heard of people trying to daisy chain UPS's together by plugging one into the next and that just doesn't work for a couple reasons. The HE doesn't require much power so as long as you have the batteries in parallel with an adapter to boost the 3.7v battery voltage up to the hubs 5v need, sounds like you have a good setup. Also very nice to have that access to batteries that you do! :slightly_smiling_face:

1 Like