Python plugin: UPS Monitor

Python and python framework

Moderator: leecollings

User avatar
ycahome
Posts: 248
Joined: Sunday 12 February 2017 10:55
Target OS: Linux
Domoticz version: lat Beta
Contact:

Re: Python plugin: UPS Monitor

Post by ycahome »

Also, am wondering if you could include a bash script on your plugin in order to update with a single command:

filename: upgrade.sh

Code: Select all

#!/bin/bash

git reset --hard
git pull --force
sudo chmod +x plugin.py
sudo chmod +x upgrade.sh
sudo /etc/init.d/domoticz.sh restart
this way, next time you can upgrade with a single command

Code: Select all

sudo ./upgrade.sh
Logread
Posts: 229
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Logread »

@ycahome,

Thanks for the suggestions... please feel free to contribute the script on GitHub and/or the wiki
hamster
Posts: 42
Joined: Friday 28 April 2017 19:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: USA
Contact:

Re: Python plugin: UPS Monitor

Post by hamster »

Logread wrote: Thursday 15 February 2018 14:13 New version 0.2.1 is available.
AWESOME! Will install and begin testing.
manutremo
Posts: 69
Joined: Saturday 19 November 2016 17:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by manutremo »

Hi, just wanted to let you know that I just installed it on my Synology and it works perfect. Many thanks!
Logread
Posts: 229
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Logread »

manutremo wrote: Saturday 17 February 2018 8:18 Hi, just wanted to let you know that I just installed it on my Synology and it works perfect. Many thanks!
Thanks for the positive feedback 8-)
nmaster
Posts: 54
Joined: Saturday 16 August 2014 17:17
Target OS: Linux
Domoticz version: 3.6304
Contact:

Re: Python plugin: UPS Monitor

Post by nmaster »

Hi Logread,

I upgraded to the last plugin version, all is fine here with 4 UPS.
Velly
Posts: 20
Joined: Sunday 22 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Velly »

Help needed with EATON 9130 running on Windows 10:
EATON 9130
ip of Windows server : 192.168.1.107
port: 4679
Usp name in EATON Intelligent Power Manager: EATON9130

error:
2018-02-18 16:57:52.553 Error: (UPS EATON) Error reading UPS variables: HTTP/1.0 501 Not Implemented
2018-02-18 16:58:44.241 Error: (UPS EATON) Error reading UPS variables: HTTP/1.0 501 Not Implemented
2018-02-18 17:00:09.587 Error: (UPS EATON) Error reading UPS variables: HTTP/1.0 501 Not Implemented
2018-02-18 17:01:18.703 Error: (UPS EATON) Error reading UPS variables: HTTP/1.0 501 Not Implemented
2018-02-18 17:02:18.751 Error: (UPS EATON) Error reading UPS variables: HTTP/1.0 501 Not Implemented

Anybody with NUT on Windows Intelligent Power Manager?
Thank you!
Attachments
eaton 3.PNG
eaton 3.PNG (18.07 KiB) Viewed 8369 times
eaton.PNG
eaton.PNG (23.65 KiB) Viewed 8369 times
eaton2.PNG
eaton2.PNG (9.09 KiB) Viewed 8369 times
hamster
Posts: 42
Joined: Friday 28 April 2017 19:11
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: USA
Contact:

Re: Python plugin: UPS Monitor

Post by hamster »

Latest update working great for me on pi Logread. Thanks!
Logread
Posts: 229
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Logread »

Velly wrote: Sunday 18 February 2018 15:05 2018-02-18 16:57:52.553 Error: (UPS EATON) Error reading UPS variables: HTTP/1.0 501 Not Implemented
@Velly, looks like you are configuring the plugin to hit a http webserver (the Eaton intelligent power manager) rather than a NUT server... first make sure you have a NUT server up and running and adjust to the right IP/Port
jeecee
Posts: 5
Joined: Tuesday 27 February 2018 13:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by jeecee »

Tnx a lot, works perfectly!
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by febalci »

@Logread, thanks for the great work! Works perfectly with 2 APC BX950U-GR UPSes. One of them is installed on a Synology and the other one on ubuntu Domoticz Server Intel NUC. Everything works perfectly, i also set a notification on UPS Alert Sensor; If svalue is 'ONBATTERY DISCHARGING', send a notification as 'Power Cut!!!', If 'ONLINE CHARGING' send 'Power Back ON!'. However, as you have guessed the status change waits up to 1 minute for UPS Status update. Is there any way you can suggest for the status change to be reflected instantenously?

Thanks again...
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Python plugin: UPS monitoring

Post by Number8 »

I recently installed this plugin, it works like a charm. It happens that the NUT server is a Synology NAS that is shut down every night. Power resumes in the morning. I wonder whether the plugin could take that into account in order to avoid the flooding of the log.
Thank you
Debian buster on NUC and three RPi with buster.
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Python plugin: UPS monitoring

Post by Number8 »

For those that might be interested, I modified the script as follows:
In def __init__(self):
Added

Code: Select all

self.commerror = False
[/code]
And in the try section of I made this modification

Code: Select all

            except Exception as errorcode:
                if self.commerror == False:
                    Domoticz.Error("Cannot communicate with NUT Server at {}:{} due to {}".format(Parameters["Address"], Parameters["Port"], errorcode.args))
                    self.commerror = True
                self.error = True
                self.UpdateDevice("ups.status")  # we flag the error to the status device
            else:
                if self.commerror == True:
                    Domoticz.Log("Communication with NUT Server resumed at {}:{}))                    
                    self.commerror = False
So the communication error is reported once a day in the described scenario, and not every minutes, which is in my case useless and tend to spoil the log system. One could think the logic could be refined, that is take into account the periods when the NUT server (NAS Synology) is shutdown. I must admit I've been a bit lazy.
Last edited by Number8 on Saturday 14 April 2018 6:49, edited 1 time in total.
Debian buster on NUC and three RPi with buster.
Logread
Posts: 229
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: UPS monitoring

Post by Logread »

@Number8,

I assume you refer to the NUT UPS plugin I wrote... almost by definition a UPS works 24/7 and so does my own synology server... and I have had a DS710+ working 24/7 since 2010 with the same HDDs that I only replaced two months ago not because it died but because it’s DSM version was obsolete. But this is off topic...

I would not recommend adding the tweak you described to the plugin standard code because most of us immediately want to know when the reading of the UPS status is incorrect or impossible.

I’d rather suggest that if you really need/want to shut down the NAS at night, you connect your UPS to your Raspberry and install a NUT server on the Pi... then you get 24/7 monitoring by domoticz and can still have your NAS safe shutdown if it is on when a power failure happens (though this set up probably requires some linux skills as probably not off the shelf from DSM).
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: Python plugin: UPS monitoring

Post by Number8 »

First of all I'd like to thank you for this very handy and excellent plugin.
almost by definition a UPS works 24/7
This is an endless debate, I can't say I disagree, neither I agree, it depens. My professional experience on this matter says that disk failures do not depend on 24/7 operation or nightly shutdown, and all NAS are powered by UPS. I'm not referrring to big farms, but small professional operations.
So, yes I agree that it would be preferable to install the code on a RaspPI which is a bit more engaging, that this ready made one. On my side I don't have time to dig into that.
I just wanted to share this modification, which is perfect in my specific case, no intent to ask for a modification, whatsoever.
Again, thank you
Nicolas
Debian buster on NUC and three RPi with buster.
copernicnic
Posts: 3
Joined: Thursday 26 April 2018 10:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by copernicnic »

Hello, thanks for the plugins :D . I have a little worry with nut, my ups is directly plugged into my raspberry and the server nut is also on the raspberry. my problem is that i can not disable user / password access.
do you have an idea of ​​how?
Logread
Posts: 229
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Logread »

@copernicnic, authentication is not yet handled by the plugin. Not difficult to implement, bear with me for a few days and I’ll send you by pm a new version for testing.
copernicnic
Posts: 3
Joined: Thursday 26 April 2018 10:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by copernicnic »

hello, everything is ok now :D :D , just wait a moment that domoticz update the device.
do you know what value to put in the event to make interact?
screenshot 2018-04-27 à 10.54.41 1.jpg
screenshot 2018-04-27 à 10.54.41 1.jpg (34.77 KiB) Viewed 7899 times
Thank you very much for your work
copernicnic
Posts: 3
Joined: Thursday 26 April 2018 10:27
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by copernicnic »

@Logread,
I just tested the plugin you sent me, it does not work unfortunately. here is the log
The attachment screenshot 2018-04-27 à 11.28.57.jpg is no longer available
I just saw in the command that there is a story of master and slave
The attachment screenshot 2018-04-27 à 11.28.57.jpg is no longer available
Attachments
screenshot 2018-04-27 à 11.31.21.jpg
screenshot 2018-04-27 à 11.31.21.jpg (49.13 KiB) Viewed 7895 times
screenshot 2018-04-27 à 11.28.57.jpg
screenshot 2018-04-27 à 11.28.57.jpg (38.82 KiB) Viewed 7897 times
Logread
Posts: 229
Joined: Sunday 28 August 2016 7:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Logread »

@copernicnic, let’s debug this by private message rather than posting on the public thread, to avoid clogging it... in my last pm, I told you that the edits were not tested... since my own setup does not require a login. Let me do some investigations in the network ups tools code and docs but this will not be before several days.
In the meantime, if you have the knowledge to do this, please try to login from shell with a telnet session and post me the result by pm, not on the forum thread pls.
Post Reply