Python plugin: UPS monitoring

Python and python framework

Moderator: leecollings

Post Reply
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: 228
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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest