Page 5 of 10

Re: APCUPSD Plugin discussion

PostPosted: Thu Aug 25, 2016 2:38 am
by petematheson
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

Re: APCUPSD Plugin discussion

PostPosted: Thu Aug 25, 2016 8:22 am
by Asconasny
Excellent!.

I can confirm it´s working with my system

Thank you

regards
Asconasny

Re: APCUPSD Plugin discussion

PostPosted: Thu Aug 25, 2016 7:23 pm
by DaveL17
Thanks for the fix. Confirmed working here too.

Dave

Re: APCUPSD Plugin discussion

PostPosted: Thu Aug 25, 2016 8:23 pm
by rapamatic
Working for me too. Thanks for figuring this out!


Sent from my iPhone using Tapatalk

Re: APCUPSD Plugin discussion

PostPosted: Thu Aug 25, 2016 9:54 pm
by MartyS
Thank you all for the feedback! I'm glad that the code change has gotten so many of you working again.

Re: APCUPSD Plugin discussion

PostPosted: Sun Aug 28, 2016 9:47 am
by yassi
Works for me, after the modification!
THX!!! :D

Re: APCUPSD Plugin discussion

PostPosted: Sun Sep 18, 2016 3:39 pm
by DVDDave
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

APCUPSD Plugin discussion

PostPosted: Wed Sep 21, 2016 7:00 pm
by kw123
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

Re: APCUPSD Plugin discussion

PostPosted: Thu Sep 22, 2016 2:45 am
by durosity
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.

Re: APCUPSD Plugin discussion

PostPosted: Thu Sep 22, 2016 4:58 am
by yassi
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.

Re: APCUPSD Plugin discussion

PostPosted: Sun Sep 25, 2016 6:32 pm
by MartyS
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.

Re: APCUPSD Plugin discussion

PostPosted: Fri Sep 30, 2016 7:20 pm
by durosity
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.

Re: APCUPSD Plugin discussion

PostPosted: Sun Oct 09, 2016 5:53 am
by dz1rfj
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

Re: APCUPSD Plugin discussion

PostPosted: Sun Oct 09, 2016 8:12 am
by DaveL17
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

Re: APCUPSD Plugin discussion

PostPosted: Thu Oct 13, 2016 9:20 am
by dz1rfj
Dave, thanks. Where is the file located, and is that the actual file name , plugin.py?


Sent from my iPhone using Tapatalk