I made good progress. If both of my UPS’s are on battery, a multiswitch is turned on and I get a notification. Only problem I am having is the OnBattery=0 variable in each UPS device does not change to 1 when I unplug them, but stays at 0. I have double checked the APCUPSD app and it shows the status going from ONLINE to ONBATT so something is happening.
If I manually change the UPS devices to OnBattery=1, all my triggers work perfectly.
I am seeing battery levels, connected wattage, and lots of other variables, from APCUPSD but the OnBattery is the only one I do not see changing. Almost like I am missing something again ???
I always found it interesting how you must give Vera time to get used to new things and this plug-in was no different.
After a couple of days of it running with the new plug-in, this morning I was testing it again and after about 1 to 2 minutes, the OnBattery variable finally changed to 1, triggering an icon change on VeraMate. It got me thinking to also look at the line voltage, since either one indicates a power loss.
So I unplugged the second UPS, again waited a couple of minutes, and the second switch flipped on so the trigger Power Outage tripped, sending me a notification. Working as expected except for the longer than expected delays. I had even set the Vera polling to 1 second (from 5 yesterday) and the APCUPSD polling variable to 5 seconds.
I waited a few minutes, then plugged in the UPS with the larger load. A couple of minutes later plugged in the second UPS, and again after a couple of minutes, received a notification that power was restored.
So everything seems to be working, now I just need to figure out the delay.
It seems like you’re no longer using IIS – right? With respect to the delays you were seeing, there are a bunch of timing loops to consider. 1st is the sampling period of apcupsd: I believe the “POLLTIME” setting in the apcupsd.conf file defaults to 60 seconds. I set mine to 10 seconds. Then there is the polltime of the Vera plugin, I set that to 10 seconds as well. I want to get reasonable notifications in case of a power outage, but at the same time I don’t want to overtax the sampling. It’s also one of the reasons I wanted to take the webserver out of the loop because it introduces yet another timing loop.
Exactly, no need to run IIS to just get the data APCUPSD already serves.
When I said I changed the APCUPSD polling to 5 seconds, it was the ONBATTERYDELAY variable. The POLLTIME variable was remarked out and set to 60, so I set it to 1. Retested and much peppier now. Not sure why I did not see it before.
Again, thanks for the awesome tweak on an awesome plug-in. Oh, and +1 to you and kabili207.
As I have a Rasberry Pi running a web server and openLuup I took a bit of a different route. I installed NUT on the Pi and created the attached plugin to parse the upsc command response. This plug in looks like a standard Door/Windows sensor. Benefit of that is that Vera and apps can better deal with it. The only thing is that the Alerts will trigger a door open notification.
When using it on a Vera you still need a Pi or other server with NUT installed as that cannot run on the Vera it self.
This is tested with an APC UPS attached to a Synology NAS and NUT on a Rasberry Pi.
Follow these instructions to install NUT [url=https://www.domoticz.com/forum/viewtopic.php?t=2266]Remote UPS for Raspberry - Domoticz (installing just the nut-client package may suffice, not tested)
test the installation using the command : upsc ups@(your NAS IP)
When on Vera you need a remote server to run the upsc command.
Put this php script in the default sever directory. Configure the IP address of your NAS.
For a Pi with Apache and default settings this is /var/www/html
<?php
$nas_ip = '192.168.x.x';
$output = shell_exec('upsc ups@'.$nas_ip);
echo "<pre>$output</pre>";
?>
When you have installed on openLuup you do not need the php script, but then you need to set the Remote variable to 0.
Install the plugin by uploading the D_UPSSensor1.xml and I_UPSSensor1.xml files to your Vera. Then manually create a device using these two files.
The device is a default door/windows sensor so it will behave as such. Extra variables will be set with all parameters from the upsc command and others like Watts, just have a look.
The only configuration required is to set the IP address for the web server running the script in the ip attribute.
When running local on openLuup you must enter the IP address of your NAS and set the Remote variable to 0.
As I have a Rasberry Pi running a web server and openLuup I took a bit of a different route. I installed NUT on the Pi and created the attached plugin to parse the upsc command response. This plug in looks like a standard Door/Windows sensor. Benefit of that is that Vera and apps can better deal with it. The only thing is that the Alerts will trigger a door open notification.
When using it on a Vera you still need a Pi or other server with NUT installed as that cannot run on the Vera it self.[/quote]
I guess if you find out how NUT talks to the Synology NAS to get the status, then yes I’d think so. No idea how hard that is though. This was a few hours job. Maybe next my try ;).
So… one evening later and a managed to figure out how NUT talks to a UPS server (like a Synology NAS) over IP and attached is a version of the plugin that does not require a Pi running NUT and a special script :D.
If you upload this version and point it to your Synology NAS IP address it should work directly.
It does not support communication via SSL, so if you turned that on on your UPS server it won’t work. Also if you have a different server than a Synology NAS you may need to change the UPSName variable and add the correct port to the ip attribute. The default port number is 3493.
BTW, tested on UI7 and openLuup. I do not do UI5 anymore.
[quote=“reneboer, post:69, topic:169161”]So… one evening later and a managed to figure out how NUT talks to a UPS server (like a Synology NAS) over IP and attached is a version of the plugin that does not require a Pi running NUT and a special script :D.
It does not support communication via SSL, so if you turned that on on your UPS server it won’t work.[/quote]
Awesome - thanks! I do use a Synology NAS, but with SSL, but let me look at it and test. I am UI5, so can test that too.
So… one evening later and a managed to figure out how NUT talks to a UPS server (like a Synology NAS) over IP and attached is a version of the plugin that does not require a Pi running NUT and a special script :D.
If you upload this version and point it to your Synology NAS IP address it should work directly.
It does not support communication via SSL, so if you turned that on on your UPS server it won’t work. Also if you have a different server than a Synology NAS you may need to change the UPSName variable and add the correct port to the ip attribute. The default port number is 3493.
BTW, tested on UI7 and openLuup. I do not do UI5 anymore.
When you have installed on openLuup you do not need the php script, but then you need to set the Remote variable to 0.
Hi Rene, where is the “Remote” variable referred to in the above. I can’t find it anywhere.
I have installed the plugin on openLuup but cannot get a connection to my NUT server, which is also running on the same machine as openLuup. I’m using the apcupsd client driver as I could only get apcupsd running on the remote machine connected to my UPS (NUT would not load on the windows box connected to the UPS).
When you have installed on openLuup you do not need the php script, but then you need to set the Remote variable to 0.
Hi Rene, where is the “Remote” variable referred to in the above. I can’t find it anywhere.
I have installed the plugin on openLuup but cannot get a connection to my NUT server, which is also running on the same machine as openLuup. I’m using the apcupsd client driver as I could only get apcupsd running on the remote machine connected to my UPS (NUT would not load on the windows box connected to the UPS).[/quote]
Hi Buxton,
The Remote variable is only for the V1.0 version. The current release can poll directly. No need to install NUT. Please note that for several servers, for example Synology, both devices must be on the same subnet.
OK thx. I may try to mod the plugin to work directly with the APCUPS server. There is a network interface to the APCUPS software that provides data from the UPS itself.
I just ran a small test run to see how it ran and wow Now it turns up like yz 125 . I just have to run it at the track next week and see what its worth ???
It feels strong.