APCUPSD Plugin discussion

Posted on
Thu Aug 25, 2016 2:38 am
petematheson offline
Posts: 738
Joined: Sep 14, 2014
Location: Southampton, UK

Re: APCUPSD Plugin discussion

Thanks Guys. All working here. The plugin was already disabled so my path was in the Plugins (Disabled) folder.
Made the changes and enabled the plugin - all working fine.

:D

Posted on
Thu Aug 25, 2016 8:22 am
Asconasny offline
Posts: 153
Joined: Jan 16, 2015

Re: APCUPSD Plugin discussion

Excellent!.

I can confirm it´s working with my system

Thank you

regards
Asconasny

Posted on
Thu Aug 25, 2016 7:23 pm
DaveL17 offline
User avatar
Posts: 4915
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: APCUPSD Plugin discussion

Thanks for the fix. Confirmed working here too.

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Aug 25, 2016 8:23 pm
rapamatic offline
Posts: 237
Joined: Aug 03, 2015
Location: Glencoe, IL

Re: APCUPSD Plugin discussion

Working for me too. Thanks for figuring this out!


Sent from my iPhone using Tapatalk

Posted on
Thu Aug 25, 2016 9:54 pm
MartyS offline
Posts: 69
Joined: May 06, 2008
Location: Charlotte, North Carolina

Re: APCUPSD Plugin discussion

Thank you all for the feedback! I'm glad that the code change has gotten so many of you working again.

/Marty

Posted on
Sun Aug 28, 2016 9:47 am
yassi offline
Posts: 370
Joined: Sep 06, 2015
Location: Germany

Re: APCUPSD Plugin discussion

Works for me, after the modification!
THX!!! :D

Posted on
Sun Sep 18, 2016 3:39 pm
DVDDave offline
Posts: 343
Joined: Feb 26, 2006
Location: San Jose, CA

Re: APCUPSD Plugin discussion

kw123 wrote:
for the situation that the ups shuts down the mac gracefully and the power comes back and the mac does not restart:

run a script every 30 minutes that sets a power on event in one hour from now, eg it is 7 am in the morning the script would issue a command
echo yourpasswordhere | sudo -S pmset repeat wakeorpoweron MTWRFSU 08:00:00
and at 7:30
echo yourpasswordhere | sudo -S pmset repeat wakeorpoweron MTWRFSU 08:30:00

this would guarantee that your mac wakes up while you are not home , but only if the power comes back within the hour, otherwise it would wait 24 hours, but at least It would wake up.


Karl

you could put this into an action and run it every 30 minutes::
Code: Select all
import datetime, time, subprocess
nextTimeString = datetime.datetime.fromtimestamp(time.time() +3600).strftime("%H:%M:%S")
cmd= "echo YOURPASSWORDHERE  | sudo -S /usr/bin/pmset repeat wakeorpoweron MTWRFSU "+ nextTimeString
#indigo.server.log(cmd)
ret= subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()
#indigo.server.log(str(ret))
ret= subprocess.Popen("pmset -g sched", stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate()
indigo.server.log((ret[0] +"  " +ret[1]).replace("\n",""))


Hi Karl,

I'm just starting to think about getting a UPS to power my Mac Mini, modem and router to send me a message if the power goes down. I'm most concerned that I don't mess up the restart after power failure function though, especially when I'm away on an extended trip..

If I understand this correctly, the above script places a command in the power management unit of the Mac to start up at a certain time. Rather than running it every hour, couldn't it be run at the time the Mac is told to shut down due to a power failure?

Alternatively, I saw some discussion on the possibility of telling the Mac that this is an abnormal shutdown to force the restart function to be enabled.

Also, do you have any recommendation for an inexpensive (<$50) UPS that would work with all of this.

Thanks!

--Dave

Posted on
Wed Sep 21, 2016 7:00 pm
kw123 offline
User avatar
Posts: 6504
Joined: May 12, 2013
Location: Dallas, TX

APCUPSD Plugin discussion

One of the issues is you don't know when the power comes back. You might be off by one minute then you need to wait 24 hours. !!

Don't know of any emergency reboot

I just buy apc. They seem to work. But you need to replace the batteries every 2 years.


Sent from my iPhone using Tapatalk

Posted on
Thu Sep 22, 2016 2:45 am
durosity offline
User avatar
Posts: 3777
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: APCUPSD Plugin discussion

kw123 wrote:
But you need to replace the batteries every 2 years.


I've had various APC UPSes over the years and i've found the batteries tend to last 5-6 years. I prefer the ones that take standard 12v 7ah batteries as you can just replace the cells when individual ones fail.. not that APC would recommend doing that.

Computer says no.

Posted on
Thu Sep 22, 2016 4:58 am
yassi offline
Posts: 370
Joined: Sep 06, 2015
Location: Germany

Re: APCUPSD Plugin discussion

durosity wrote:
kw123 wrote:
But you need to replace the batteries every 2 years.


I've had various APC UPSes over the years and i've found the batteries tend to last 5-6 years. I prefer the ones that take standard 12v 7ah batteries as you can just replace the cells when individual ones fail.. not that APC would recommend doing that.


I have also 2 APC UPSes, the older one is running since 2011 with the same batteries.

Posted on
Sun Sep 25, 2016 6:32 pm
MartyS offline
Posts: 69
Joined: May 06, 2008
Location: Charlotte, North Carolina

Re: APCUPSD Plugin discussion

kw123 wrote:
I just buy apc. They seem to work. But you need to replace the batteries every 2 years.


I've bought several brands of UPS over the years for work (office space and data centers) and home but APC have always been the ones that have provided the features and sizes that I've needed. Unlike others though, my battery life has been amazing.

My oldest APC model is currently sporting a battery from late 2002, if you can believe the BATTDATE value being returned by APCUPSD. Because of the light load on the unit it supported a runtime of longer than 3 hours the last time it was called upon for anything extended. Sure, a battery that old might die at any moment but all the self-tests continue to be positive.

For anything not rack-mounted, a UPS owner will often find that when a battery does die that the breakeven point for replacing the battery vs replacing the whole unit may be a close one (unless you're willing to risk after-market batteries) as sometimes the newer features and brand new protection circuits are just too good to pass up for a relatively small difference in cost.

/Marty

Posted on
Fri Sep 30, 2016 7:20 pm
durosity offline
User avatar
Posts: 3777
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: APCUPSD Plugin discussion

Feature request:

As far as I'm aware APCupsd has the ability to force a device into running on battery, shutting down or restarting. If it's possible to do this I'd love to see it implemented in the plugin as I can see forcing the UPS to restart as being quite a useful feature.

Computer says no.

Posted on
Sun Oct 09, 2016 5:53 am
dz1rfj offline
Posts: 114
Joined: Mar 13, 2016

Re: APCUPSD Plugin discussion

Marty,

Trying this cool plugin, but have the 32512 error message in the indigo event log.

I copied this command and came up with no results: ls -la /sbin/apc*
Not really a mac guy, I think it might be looking for a sbin folder off the root? directory , and not finding it.

I am on 0.4.2 of the plug in, and 3.14.14 of the apc agent.

I have deleted the device, and re-created, not sure if there is a fix somewhere, or if there is a step by step for non techies that can get this plugin working, that would be awesome!

Thanks in advance for any tips on how to solve this issue.

some log contents:

plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Z-Wave received "CofeeMotion" status update is off
apcupsd Plugin started. Polling apcupsd server(s) every 5.0 minutes with a timeout of 8 seconds
apcupsd Error readApcupsd: Connection to apcaccess failed with error code:32512. Attempt 1 of 5
Z-Wave received "CofeeMotion" status update is on
apcupsd Error readApcupsd: Connection to apcaccess failed with error code:32512. Attempt 2 of 5
apcupsd Error readApcupsd: Connection to apcaccess failed with error code:32512. Attempt 3 of 5
apcupsd Error readApcupsd: Connection to apcaccess failed with error code:32512. Attempt 4 of 5
apcupsd Error readApcupsd: Connection to apcaccess failed with error code:32512. Attempt 5 of 5
apcupsd Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 191, in runConcurrentThread
File "plugin.py", line 297, in readApcupsd
TypeError: not enough arguments for format string

apcupsd Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Z-Wave received "CofeeMotion" status update is off



Thanks,

Brian

Posted on
Sun Oct 09, 2016 8:12 am
DaveL17 offline
User avatar
Posts: 4915
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: APCUPSD Plugin discussion

Hi Brian - you'll actually need to modify the plugin.py file to fix a bug on line 297. There's a description of the fix earlier in this thread.

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Oct 13, 2016 9:20 am
dz1rfj offline
Posts: 114
Joined: Mar 13, 2016

Re: APCUPSD Plugin discussion

Dave, thanks. Where is the file located, and is that the actual file name , plugin.py?


Sent from my iPhone using Tapatalk

Page 5 of 9 1, 2, 3, 4, 5, 6, 7, 8, 9

Who is online

Users browsing this forum: No registered users and 1 guest