www.homeseer.com    
 

Go Back   HomeSeer Message Board > Energy Management Plug-ins > Energy Management Discussion > APCUPSD Plugin (3P)

APCUPSD Plugin (3P) Discussions related to the APCUPSD UPS monitoring plugin.

Reply
 
Thread Tools Display Modes
  #1  
Old December 21st, 2015, 10:17 PM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Basic and/or Creative Events created with APCUPSD plugin

What are some Basic and/or Creative Events created with this plugin?
Would appreciate your thoughts
__________________
Tom
baby steps...starting again with HS3
HS3Pro: Z-NET & 80 Z wave Devices,
HSTouch: 4 Joggler (Android Kitkat), 2 iPhone, 3 iPads
Whole House Audio: 5 SqueezePlay Jogglers w Bose Speakers
In The Works: 10 Cameras Geovision, new Adecmo/Envisalink Alarm, Arduinos
System: XP on Fanless Mini-ITX w/ SSD
Reply With Quote
  #2  
Old December 22nd, 2015, 09:29 AM
pcp pcp is online now
Super Seer
 
Join Date: Jan 2006
Location: MA
Posts: 1,686
My basic events include notification that power was lost and shutdown of some devices after while (like touch screens and eventually hs3 pc)
Reply With Quote
  #3  
Old February 16th, 2016, 12:33 AM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
So I installed plugin, and apcupsd a couple of months back and didn't set up any events to deal with power outage such as shut down hs or computer. The remote hs computer is set to reboot, in bios, on power return.

A few days ago during a long power outage(according to neighbors), the remote hs computer shut down and didn't come back online. It has never failed to come back online in the last 5 years I've used it without a battery back. But now after using a battery back up and apcupsd software it seems to have shut down windows. The reason I say it seems is because I'm not really sure. I'm not currently there so can't bring it back online to look into this.

Questions:
Is this supposed to happen?
How do you prevent this in the future?

thanks in advance
Reply With Quote
  #4  
Old February 16th, 2016, 06:44 AM
pcp pcp is online now
Super Seer
 
Join Date: Jan 2006
Location: MA
Posts: 1,686
The plugin does not control shutdowns or reboots, it monitors reports status from apcupsd and fires related hs3 events if configured. Spearate apcupsd can shutdown the pc and depending on your bios setup the pc will restart when power is restored. This is at least how it works in my setup/my pcs (running hs3 or not). I can double check this next weekend by simulating a shutdown on several computers.


Sent from my iPad using Tapatalk
Reply With Quote
  #5  
Old February 17th, 2016, 01:51 AM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Thank you.
Do you know how do you keep apcupsd from shutting down the computer?

Or I was thinking may be I should have the hs pc plugged into the "Controlled by Master" or "Battery back up only". Maybe this way the apcupsd and pluign can help gracefully shut down hs, but the power to the non-Master outlets would be killed before apcupsd could shut down windows?


APC BR1500G
Reply With Quote
  #6  
Old February 17th, 2016, 08:32 PM
pcp pcp is online now
Super Seer
 
Join Date: Jan 2006
Location: MA
Posts: 1,686
I think apcupsd runs a script to shutdown the pc and you could customize it. I am might be off, check the apcupsd documentation.


Sent from my iPad using Tapatalk
Reply With Quote
  #7  
Old February 17th, 2016, 08:56 PM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Yes, I did see that in the documentation, but the documentation isn't clear, at least to me, if that is the default setting( to shut down the pc).

I know this isn't you're plugin issue, but appreciate your help as I have limited knowledge with battery back ups. The other problem is that it at my vacation home several states away. If I get someone into the house, I'd like to be able to give them some simple instructions so I can get the hs pc back online and avoid this in the future.

Two things I can think of are:
1.
I was wondering if I plug the hs pc into "Controlled by Master" or "Battery back up only" wouldn't that kill the power to the pc before the battery was fully drained, therefore averting the shutdown process of the apcupsd script? The apcupsd software would assume the pc is plugged into the "Master" outlet, therefore shutdown that outlet last?

2.
The only other quick solution I can tell the visitor to my home is to unplug the usb cable between the pc and battery backup.
Reply With Quote
  #8  
Old February 17th, 2016, 09:10 PM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,001
Hi Tom,

The outlets "Controlled by Master" will shut off if whatever is plugged into the Master outlet shuts off. They should turn on whenever the device in the Master outlet is turned on as well. If you have other peripherals that you want power-cycled if you restart the HS computer, then that might be one use for them, otherwise, I would not plug anything in the "Controlled by Master" outlets and just use the Battery Backup outlets.

I use apcupsd as well and I don't believe it shuts down the system by default, but I could be wrong about that. We haven't had a major power failure here for 4+ years, so I've never really "experienced" the functionality. The problem with a controlled shut down is that the system then typically won't restart automatically when power is restored. Therefore the best course of action is to have events shut down the applications, but leave the system running till it runs out of power.

Cheers
Al
__________________
HS3Pro 3.0.0.318 on Jetway JBC501F9Q-Q87-B i7 8GB 1874 Devices, 955 Events, 28 Plugins
Z-Wave 3.0.1.131 Z-Net 105 nodes:Leviton Vizia,Kwikset,FortrezZ Valve/Sensors,Everspring Sensors/Modules/Outlets,CT30 Stats,MIMOLites,Aeotec Smart Switches
RFXCom W800,RFXrec433,RFXtrx433|APCUPSD|Pushover|Squeezebox|weatherXML|HS Phone W2C|APCUPSD|UltraLog
UltraGCIR GC-100|UltraNetcam|UltraPioneer|Ultra1Wire|DSC PC1832|BLLED|BLTVGuide|ImperiHome|jon00 Utilities|MySensors

PHLocation|X10 CM11A IOLinc,etc
Reply With Quote
  #9  
Old February 17th, 2016, 09:32 PM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Thanks Al,
Yeah, just my luck we have long power outage the week after I left. The in the last 2 years there has never been power outages that lasted more than a few mins. I didn't have any events set up and only installed apcupsd with default setting. And the only things plugged into the apc was the hs mini itx and z-net. So I was surprised to see the hs pc shut down completely.
My other pcs and dvr in the house, not connected to the battery back up, rebooted and came back online.
So I'm not sure how this happened. I won't be at the house till the summer so for now, I guess I'll have the visitor disable apc usb cable, then I'll uninstall apcupsd, and disable plugin. This will give at least always bring my hs pc back online.

Quote:
Originally Posted by sparkman View Post
Hi Tom,
The outlets "Controlled by Master" will shut off if whatever is plugged into the Master outlet shuts off. They should turn on whenever the device in the Master outlet is turned on as well. If you have other peripherals that you want power-cycled if you restart the HS computer, then that might be one use for them, otherwise, I would not plug anything in the "Controlled by Master" outlets and just use the Battery Backup outlets.

I use apcupsd as well and I don't believe it shuts down the system by default, but I could be wrong about that. We haven't had a major power failure here for 4+ years, so I've never really "experienced" the functionality. The problem with a controlled shut down is that the system then typically won't restart automatically when power is restored. Therefore the best course of action is to have events shut down the applications, but leave the system running till it runs out of power.

Cheers
Al
Reply With Quote
  #10  
Old February 18th, 2016, 12:14 AM
lveatch lveatch is offline
Seer Deluxe
 
Join Date: Dec 2012
Location: USA - Illinois
Posts: 179
Quote:
Originally Posted by sparkman View Post
Hi Tom,

... I don't believe it shuts down the system by default, ...
I think it does.

Configuration file is located at <root>\apcupsd\etc\apcupsd\apcupsd.conf

See parameters:
# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
# the first that occurs will cause the initation of a shutdown.
#

# If during a power failure, the remaining battery percentage
# (as reported by the UPS) is below or equal to BATTERYLEVEL,
# apcupsd will initiate a system shutdown.
BATTERYLEVEL 5

# If during a power failure, the remaining runtime in minutes
# (as calculated internally by the UPS) is below or equal to MINUTES,
# apcupsd, will initiate a system shutdown.
MINUTES 3

APCUPSD installs the necessary windows batch files and binaries to perform a shutdown. apccontrol.bat controls what scripts / binaries are called for each event.
__________________
Len


HomeSeer Version: HS3 Pro Edition 3.0.0.435
Linux version: Linux homeseer Ubuntu 16.04 x86_64
Number of Devices: 633
Number of Events: 773

Enabled Plug-Ins
2.0.54.0: BLBackup
2.0.40.0: BLLAN
3.0.0.48: EasyTrigger
30.0.0.36: RFXCOM
3.0.6.2: SDJ-Health
3.0.0.87: weatherXML
3.0.1.190: Z-Wave
Reply With Quote
  #11  
Old February 18th, 2016, 12:27 AM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,001
Quote:
Originally Posted by lveatch View Post
I think it does.

Configuration file is located at <root>\apcupsd\etc\apcupsd\apcupsd.conf

See parameters:
# Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so
# the first that occurs will cause the initation of a shutdown.
#

# If during a power failure, the remaining battery percentage
# (as reported by the UPS) is below or equal to BATTERYLEVEL,
# apcupsd will initiate a system shutdown.
BATTERYLEVEL 5

# If during a power failure, the remaining runtime in minutes
# (as calculated internally by the UPS) is below or equal to MINUTES,
# apcupsd, will initiate a system shutdown.
MINUTES 3

APCUPSD installs the necessary windows batch files and binaries to perform a shutdown. apccontrol.bat controls what scripts / binaries are called for each event.
Thanks Len, just confirmed that on my system too. Do you know if those values can be set to 0 to disable the auto-shutdown, or is there a better way to disable that?

Thanks
Al
Reply With Quote
  #12  
Old February 18th, 2016, 01:08 AM
lveatch lveatch is offline
Seer Deluxe
 
Join Date: Dec 2012
Location: USA - Illinois
Posts: 179
Sorry, but I do not know if 0 will disable. I would expect apcupsd to start the shutdown process once 0 minutes/battery % has been reached, causing a hard crash of your computer. 0 minutes / battery % is based on apcupsd's estimate of those values.

If you really wanted to disable the shutdown and allow a hard crash, then make a backup of apccontrol.bat and comment the shutdown command. I have not tested this.

Code:
:doshutdown
rem
rem  If you want to try to power down your UPS, uncomment
rem    out the following lines, but be warned that if the
rem    following shutdown -h now doesn't work, you may find
rem    the power being shut off to a running computer :-(
rem  Also note, we do this in the doshutdown case, because
rem    there is no way to get control when the machine is
rem    shutdown to call this script with --killpower. As
rem    a consequence, we do both killpower and shutdown
rem    here.
rem  Note that Win32 lacks a portable way to delay for a
rem    given time, so we use the trick of pinging a
rem    non-existent IP address with a given timeout.
rem
rem   %APCUPSD% /kill
rem   ping -n 1 -w 5000 10.255.255.254 > NUL
rem   %POPUP% "Doing %APCUPSD% --killpower"
rem   %APCUPSD% --killpower
rem   ping -n 1 -w 12000 10.255.255.254 > NUL
rem
   %SHUTDOWN% -h now    <<<<<--------- comment this line
   GOTO :done
Reply With Quote
  #13  
Old February 18th, 2016, 01:47 AM
sparkman's Avatar
sparkman sparkman is offline
OverSeer
 
Join Date: Oct 2001
Location: Calgary, Alberta, Canada
Posts: 6,001
Thanks Len, just double-checked the manual and both those settings can be set to -1 to disable them.

Cheers
Al
Reply With Quote
  #14  
Old February 18th, 2016, 03:09 AM
zwolfpack zwolfpack is online now
Seer Master
 
Join Date: Sep 2015
Location: Orange County, California, USA
Posts: 948
Very interesting! This prompted some testing.

My setup is a BE550G UPS powering a Hometroller S6, a Cable modem, and a wall-wart that Y's to a router and a network switch. A Z-net is powered off the S6 thru one of the USB ports. Default apsuspd.conf.

I pulled the plug and monitored the APCUPSD status. When fully charged, it says its load percentage is 12% and estimated run time is 61 minutes. At the 71 minute mark, the status reported 5% battery and 3 minutes remaining (coincidence that both reached at same time?). Hometroller shut down at this point. Seventeen minutes later, the UPS finally gave up the ghost.

Of course had power been restored during this window the Hometroller would never come back!

I'd wager that the OP's window would be longer; he has a larger capacity UPS and essentialy no load once the computer shuts down.
Reply With Quote
  #15  
Old February 18th, 2016, 07:29 AM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Guys, thank you for this insight and the discussion. This really helps. I've also emailed the apcupsd user list on sourceforge and waiting to hear back. I really didn't expect the ups to add another level of complexity and point of failure in my remote setup. But to be fair to apcupsd, the author does highly recommend testing the system with a simulated power outage.

Does anyone know for sure or has anyone tested these setting with BATTERYLEVEL and MINUTES to -1 would avert the system shutdown?
Reply With Quote
  #16  
Old February 18th, 2016, 08:37 AM
pcp pcp is online now
Super Seer
 
Join Date: Jan 2006
Location: MA
Posts: 1,686
I haven't but based on discussions here I should check / test the shutdown and restart. I changed the embedded computer hosting hs3 several weeks ago and never tested this should it happen (the older hs2 setup with apcupsd did restart when power was restored)


Sent from my iPad using Tapatalk
Reply With Quote
  #17  
Old February 18th, 2016, 09:16 AM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
According to the documentation there are 4 parameters that trigger a shutdown by apcupsd. Which are Timeout, Batterylevel, Minutes, Exhausted Battery Signal. Of the four listed Batterylevel and Minutes need to be configured to -1 if you don't want a shutdown. Timeout is 0 by default.
Also I think when apcupsd documentation says "shutdown", they are actually saying sleep/hibernation? Perhaps this is understood lingo in the backup battery circles, but I just realized it . So my remote hs pc must be in hibernation since the power outage.


From the Documentation:

When one of the conditions listed below occurs, apcupsd issues a shutdown command by calling /etc/apcupsd/apccontrol doshutdown, which should perform a shutdown of your system using the system shutdown(8) command. You can modify the behavior as described in Customizing Event Handling.
The conditions that trigger the shutdown can be any of the following:
  • Running time on batteries have expired (TIMEOUT)
  • The battery runtime remaining is below the configured value (BATTERYLEVEL)
  • The estimated remaining runtime is below the configured value (MINUTES)
  • The UPS signals that the batteries are exhausted.
A shutdown could also be initiated if apcupsd detects that the batteries are no longer functioning correctly. This case, though very unusual, can happen at any time even if there is proper mains voltage, and /etc/apcupsd/apccontrol emergency is called.
Reply With Quote
  #18  
Old February 21st, 2016, 07:42 AM
TomTom's Avatar
TomTom TomTom is offline
Seer Master
 
Join Date: Apr 2012
Location: USA
Posts: 1,402
Have you had a chance to test this? I won't have access to my remote setup till I can get someone to go there and restart the pc. So I just want to be sure I'm doing the right thing(s) while the person is still in the house because after they leave the next time they come back will be a week or two later.

Quote:
Originally Posted by pcp View Post
I haven't but based on discussions here I should check / test the shutdown and restart. I changed the embedded computer hosting hs3 several weeks ago and never tested this should it happen (the older hs2 setup with apcupsd did restart when power was restored)


Sent from my iPad using Tapatalk
Reply With Quote
  #19  
Old February 21st, 2016, 11:59 PM
pcp pcp is online now
Super Seer
 
Join Date: Jan 2006
Location: MA
Posts: 1,686
No I did not have the time to try it this weekend.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New devices created each time plugin is started Agwan HS3 Plug-In Development 3 August 25th, 2015 05:49 PM
Question about devices created by plugin simonmason JV Caddx Plug-In 17 September 27th, 2010 11:24 AM
created devices on ID already used by other plugin completelyhis MCS Temperature 3 October 30th, 2009 11:20 AM
Where do you find the links created on the plugin sample? Michael McSharry Plug-In Development 3 October 1st, 2002 02:39 PM


All times are GMT -4. The time now is 11:04 PM.


Copyright HomeSeer Technologies, LLC