Python plugin: UPS Monitor

Python and python framework

Moderator: leecollings

Logread
Posts: 228
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 »

legus49 wrote: Monday 05 November 2018 1:34 Hi,
I just installed UPS Monitor and it's working fine on Domoticz 3.7207, but I do not have the units for the sensors (Volt, %, W...) Any idea ?
Thanks a lot for this very usefull plugin.
Your version of Domoticz probably is too old... as said in the installation instructions it must be 3.7418 at a minimum. You should also disable the plugin (to delete its devices) before upgrading domoticz and re-enabling the plugin. Hopefully this should fix the issue you are having.
Skydesign
Posts: 7
Joined: Monday 31 December 2018 7:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Skydesign »

Hi.
Thank you for the plugin.
I installed a plugin that monitors UPS Power Walker with blazer_usb driver, in the terminal it displays a lot of information, eg input voltage, power, battery voltage, etc. Unfortunately, domoticz shows only a few data:
UPS status mode, UPS AC ferquency, UPS Charge %, UPS Load %, UPSAC Input.
How can I add more sensors eg battery voltage?
Logread
Posts: 228
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 »

Skydesign wrote: Monday 31 December 2018 7:44 Hi.
Thank you for the plugin.
I installed a plugin that monitors UPS Power Walker with blazer_usb driver, in the terminal it displays a lot of information, eg input voltage, power, battery voltage, etc. Unfortunately, domoticz shows only a few data:
UPS status mode, UPS AC ferquency, UPS Charge %, UPS Load %, UPSAC Input.
How can I add more sensors eg battery voltage?
The list of status variables handled by the plugin is embedded in the code:

Code: Select all

        self.variables = {
            # key:              [device label,         unit, value, device number, used by default]
            "ups.status":       ["UPS Status",          "",  0,     1, 1],
            "battery.charge":   ["UPS Charge",          "%", None,  2, 1],
            "battery.runtime":  ["UPS Backup Time",     "s", None,  3, 1],
            "input.voltage":    ["UPS AC Input",        "V", None,  4, 0],
            "ups.load":         ["UPS Load",            "%", None,  5, 0],
            "ups.realpower":    ["UPS Power",           "W", None,  6, 0],
            "input.frequency":  ["UPS AC Frequency",   "Hz", None,  7, 0]
        }
If your UPS server reports other variables that you want to capture, the above table needs to be expanded accordingly.
bob69740
Posts: 2
Joined: Tuesday 01 January 2019 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France - Lyon
Contact:

Re: Python plugin: UPS Monitor

Post by bob69740 »

Hello,

I just found your python plugin and i wanted to install it on my Domoticz Raspberry.
My UPS is an APC Back-UPS BX700.

I have installed your plugin in following this : https://www.domoticz.com/wiki/Plugins/NUT_UPS.html
But i think i have to install a nut server on my Raspberry, and i don't know where found tutorial to install it.

Can you please help me, or say me where i can found informations to install NUT server on the raspberry to use your plugin.

Thank you for your help :)
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 »

Skydesign
Posts: 7
Joined: Monday 31 December 2018 7:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Skydesign »

Logread wrote: Tuesday 01 January 2019 10:32 If your UPS server reports other variables that you want to capture, the above table needs to be expanded accordingly.
Thank you, it works great
bob69740
Posts: 2
Joined: Tuesday 01 January 2019 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: France - Lyon
Contact:

Re: Python plugin: UPS Monitor

Post by bob69740 »

hamster wrote: Tuesday 01 January 2019 17:31 http://lmgtfy.com/?q=raspberry+pi+nut+setup

top result
Thank you :)
I have succeed (almost).
Some information are now visible on domoticz.

But about all 2 days, the informations are not transmits to domoticz.
I have to restart "upsdrvctl" manually with putty "sudo upsdrvctl start" and it's good for 2 days approximatly. The raspberry is always online, and domoticz doesn't restart.


Image

Image

Have you somes ideas about this problem, or somes keywords with lmgtfy ;)

Thanks,
haden
Posts: 7
Joined: Sunday 28 February 2016 17:11
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by haden »

Thanks for nice plugin. works great

But for some reason i'm unable to see logs from any of the UPS devices on my Android phone using the lite app. It works fine for other sensors, and the UPS logs is working fine in a normal browser.
Logread
Posts: 228
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 »

haden wrote: Monday 14 January 2019 21:29 Thanks for nice plugin. works great

But for some reason i'm unable to see logs from any of the UPS devices on my Android phone using the lite app. It works fine for other sensors, and the UPS logs is working fine in a normal browser.
Probably because the UPS devices created in domoticz are of « custom » type and I suspect these devices are not fully handled by the mobile app... but this is just a guess
renevb
Posts: 3
Joined: Sunday 03 March 2019 22:35
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python plugin: UPS Monitor

Post by renevb »

Thanks for this great plugin. works great. The only problem i have is getting the actual status notification "like online"and running on battery etc send as an email alert or push. I can get it to send the status change via notifications or blockly but i cant not get it to send also the actual text i see in the logs like charging or on battery etc. The value is always 0? Anybody have a clue how to send the actual text data with it?

René
droop7
Posts: 2
Joined: Monday 03 July 2017 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Belgium
Contact:

Re: Python plugin: UPS Monitor

Post by droop7 »

Hello everybody

I try to word with this script but i'm a little bit blocked.

2019-04-09 15:51:14.549 Error: (APC) 'onStart' failed 'KeyError'.
2019-04-09 15:51:14.549 Error: (APC) ----> Line 199 in /home/pi/domoticz/plugins/NUT_UPS/plugin.py, function onStart
2019-04-09 15:51:14.549 Error: (APC) ----> Line 89 in /home/pi/domoticz/plugins/NUT_UPS/plugin.py, function onStart

2019-04-09 16:00:34.501 (APC) Processing 'onHeartbeatCallback' message
2019-04-09 16:00:34.501 (APC) Calling message handler 'onHeartbeat'.
2019-04-09 16:00:34.558 (APC) Variable UPS Load = 7
2019-04-09 16:00:34.558 (APC) Creating device 'UPS Load'.
2019-04-09 16:00:34.558 (APC) Variable UPS Backup Time = 5226
2019-04-09 16:00:34.559 (APC) Creating device 'UPS Backup Time'.
2019-04-09 16:00:34.559 (APC) Variable UPS Power = None
2019-04-09 16:00:34.559 (APC) Variable UPS Charge = 100
2019-04-09 16:00:34.559 (APC) Creating device 'UPS Charge'.
2019-04-09 16:00:34.559 (APC) Variable UPS AC Input = 230.0
2019-04-09 16:00:34.560 (APC) Creating device 'UPS AC Input'.
2019-04-09 16:00:34.560 (APC) Variable UPS AC Frequency = None
2019-04-09 16:00:34.560 (APC) Variable UPS Status = OL
2019-04-09 16:00:44.455 (APC) Pushing 'onHeartbeatCallback' on to queue
2019-04-09 16:00:44.479 (APC) Processing 'onHeartbeatCallback' message
2019-04-09 16:00:44.480 (APC) Calling message handler 'onHeartbeat'.

Can anybody explain me where is the problem?
Logread
Posts: 228
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 »

droop7 wrote: Tuesday 09 April 2019 16:07 Hello everybody

I try to word with this script but i'm a little bit blocked.

2019-04-09 15:51:14.549 Error: (APC) 'onStart' failed 'KeyError'.
2019-04-09 15:51:14.549 Error: (APC) ----> Line 199 in /home/pi/domoticz/plugins/NUT_UPS/plugin.py, function onStart
2019-04-09 15:51:14.549 Error: (APC) ----> Line 89 in /home/pi/domoticz/plugins/NUT_UPS/plugin.py, function onStart

Can anybody explain me where is the problem?
Seems the plugin was not able to create the devices.
Try changing the domoticz settings to enable device creation. This should solve your issue
Skwi
Posts: 18
Joined: Thursday 10 May 2018 9:37
Target OS: Windows
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Skwi »

Hi, I have an eaton protection station 800 but I don't have all the devices created in domoticz, I'd like to see the power but it stays at None.
Domoticz runs on a synology ds218+

2019-04-20 10:23:38.462 (EATON) Variable UPS Status = OL CHRG
2019-04-20 10:23:38.463 (EATON) Variable UPS Backup Time = 1140
2019-04-20 10:23:38.465 (EATON) Variable UPS AC Frequency = None
2019-04-20 10:23:38.465 (EATON) Variable UPS Charge = 100
2019-04-20 10:23:38.466 (EATON) Variable UPS Power = None
2019-04-20 10:23:38.467 (EATON) Variable UPS AC Input = None
2019-04-20 10:23:38.467 (EATON) Variable UPS Load = 13

Is it normal the state is 'OL CHRG' while the charge is 100? (because offline ups?)

Thanks
Logread
Posts: 228
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 »

Skwi wrote: Saturday 20 April 2019 10:29 Hi, I have an eaton protection station 800 but I don't have all the devices created in domoticz, I'd like to see the power but it stays at None.

Is it normal the state is 'OL CHRG' while the charge is 100? (because offline ups?)

Thanks
It is probable that your UPS NUT implementation does not report power usage. The plugin will not create devices for variables that do not have values (as shown by your debug log).

Regarding the status showing CHRG while battery is 100% charged, this has nothing to do with the plugin as it only reads the NUT variables (and I do not see what’s wrong with it... the charge current might be minimal but not zero).
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,

I was using UPS Monitor plugin for some time, i have 1 APC UPS on domoticz ubuntu server, and 1 APC UPS on Synology 916+. It was working nicely for some months. All of a sudden the connection for the Synology UPS started "ACCESS_DENIED" error. Could be since i upgraded Synology firmware, it deleted some settings, who knows. Now i try to telnet port 3493 on Synology, it connects well, but "LIST VAR ups" gives Error: Access Denied. If i enter upsd.users details as as USERNAME monuser and PASSWORD xxxxx on telnet, then i can get LIST VAR ups response. Since you mentioned that we should not use username and password on NUT installation, i still couldn't found out how to use NUT without username and password. Any help?

Thanks...
Logread
Posts: 228
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 »

febalci wrote: Tuesday 07 May 2019 18:44 @logread,

I was using UPS Monitor plugin for some time, i have 1 APC UPS on domoticz ubuntu server, and 1 APC UPS on Synology 916+. It was working nicely for some months. All of a sudden the connection for the Synology UPS started "ACCESS_DENIED" error. Could be since i upgraded Synology firmware, it deleted some settings, who knows. Now i try to telnet port 3493 on Synology, it connects well, but "LIST VAR ups" gives Error: Access Denied. If i enter upsd.users details as as USERNAME monuser and PASSWORD xxxxx on telnet, then i can get LIST VAR ups response. Since you mentioned that we should not use username and password on NUT installation, i still couldn't found out how to use NUT without username and password. Any help?

Thanks...
OOPS... I forgot to update the plugin repository with a version I worked on more than one year ago and that implemented access control: Version 0.2.2 is now available from Github and the wiki page has been updated accordingly !

In case this still does not work, you may also want to check your domoticz system's IP is white-listed in the Synology UPS monitor setup ?
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,

WOW! I read your comment, wrote a response and when i came back here your response magically changed :lol:
I will check it out and inform you. Thank you very much for your fast response...

EDIT: I tried it and it works perfectly... You are the best !!!
Kender
Posts: 10
Joined: Tuesday 03 January 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Kender »

Hello,
I have a problem: after the lasts updates (Raspbian and Domoticz beta) the plugin stopped to work :cry:
if i check the status of the UPS via cli with upsc i can see all the parameter, but the plugin just give me a "comunication error" and do nothing more :o
here is the log of the plugin:
2019-05-10 11:45:30.627 Status: (Monitor APC) Started.
2019-05-10 11:45:30.935 Status: (Monitor APC) Entering work loop.
2019-05-10 11:45:30.935 Status: (Monitor APC) Initialized version 0.2.1, author 'logread'
2019-05-10 11:51:52.056 (Monitor APC) Pushing 'onHeartbeatCallback' on to queue
2019-05-10 11:51:52.099 (Monitor APC) Processing 'onHeartbeatCallback' message
2019-05-10 11:51:52.099 (Monitor APC) Calling message handler 'onHeartbeat'.
2019-05-10 11:52:02.058 (Monitor APC) Pushing 'onHeartbeatCallback' on to queue
2019-05-10 11:52:02.090 (Monitor APC) Processing 'onHeartbeatCallback' message
2019-05-10 11:52:02.091 (Monitor APC) Calling message handler 'onHeartbeat'.
2019-05-10 11:52:12.060 (Monitor APC) Pushing 'onHeartbeatCallback' on to queue
2019-05-10 11:52:12.063 (Monitor APC) Processing 'onHeartbeatCallback' message
2019-05-10 11:52:12.063 (Monitor APC) Calling message handler 'onHeartbeat'.
2019-05-10 11:52:22.062 (Monitor APC) Pushing 'onHeartbeatCallback' on to queue
2019-05-10 11:52:22.089 (Monitor APC) Processing 'onHeartbeatCallback' message
2019-05-10 11:52:22.090 (Monitor APC) Calling message handler 'onHeartbeat'.
2019-05-10 11:52:28.761 (Monitor APC) Pushing 'onStopCallback' on to queue
2019-05-10 11:52:28.803 (Monitor APC) Processing 'onStopCallback' message
2019-05-10 11:52:28.804 (Monitor APC) Calling message handler 'onStop'.
2019-05-10 11:52:28.804 (Monitor APC) onStop called
2019-05-10 11:52:28.804 (Monitor APC) Debug logging mask set to: NONE
2019-05-10 11:52:28.761 Status: (Monitor APC) Stop directive received.
2019-05-10 11:52:28.761 Status: (Monitor APC) Exiting work loop.
2019-05-10 11:52:29.153 (Monitor APC) requeuing 'onHeartbeatCallback' message for 'SmartTherm Camera'
2019-05-10 11:52:29.153 (Monitor APC) requeuing 'onHeartbeatCallback' message for 'Monitoraggio RBPiDomoticz'
2019-05-10 11:52:29.982 (Monitor APC) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2019-05-10 11:52:29.982 (Monitor APC) 'Port':'3493'
2019-05-10 11:52:29.982 (Monitor APC) 'Mode6':'Debug'
2019-05-10 11:52:29.982 (Monitor APC) 'Key':'NUT_UPS'
2019-05-10 11:52:29.983 (Monitor APC) 'Name':'Monitor APC'
2019-05-10 11:52:29.983 (Monitor APC) 'DomoticzBuildTime':'2019-05-09 13:04:08'
2019-05-10 11:52:29.983 (Monitor APC) 'Database':'/home/pi/old-domoticz/domoticz.db'
2019-05-10 11:52:29.983 (Monitor APC) 'Language':'en'
2019-05-10 11:52:29.983 (Monitor APC) 'Author':'logread'
2019-05-10 11:52:29.983 (Monitor APC) 'HardwareID':'50'
2019-05-10 11:52:29.983 (Monitor APC) 'Version':'0.2.1'
2019-05-10 11:52:29.983 (Monitor APC) 'DomoticzVersion':'4.10717'
2019-05-10 11:52:29.983 (Monitor APC) 'Address':'192.168.3.253'
2019-05-10 11:52:29.984 (Monitor APC) 'StartupFolder':'/home/pi/old-domoticz/'
2019-05-10 11:52:29.984 (Monitor APC) 'DomoticzHash':'b38b49e5'
2019-05-10 11:52:29.984 (Monitor APC) 'Mode1':'apc'
2019-05-10 11:52:29.984 (Monitor APC) 'HomeFolder':'/home/pi/old-domoticz/plugins/NUT_UPS/'
2019-05-10 11:52:29.984 (Monitor APC) 'UserDataFolder':'/home/pi/old-domoticz/'
2019-05-10 11:52:29.984 (Monitor APC) Device count: 1
2019-05-10 11:52:29.984 (Monitor APC) Device: 1 - ID: 4685, Name: 'Monitor APC - UPS Status Mode', nValue: 0, sValue: 'COMMUNICATION ERROR'
2019-05-10 11:52:29.984 (Monitor APC) Device ID: '4685'
2019-05-10 11:52:29.984 (Monitor APC) Device Name: 'Monitor APC - UPS Status Mode'
2019-05-10 11:52:29.984 (Monitor APC) Device nValue: 0
2019-05-10 11:52:29.984 (Monitor APC) Device sValue: 'COMMUNICATION ERROR'
2019-05-10 11:52:29.985 (Monitor APC) Device LastLevel: 0
2019-05-10 11:52:29.162 Status: (Monitor APC) Stopping threads.
2019-05-10 11:52:29.165 Status: (Monitor APC) Stopped.
2019-05-10 11:52:29.166 Status: (Monitor APC) Started.
2019-05-10 11:52:29.976 Status: (Monitor APC) Entering work loop.
2019-05-10 11:52:29.976 Status: (Monitor APC) Initialized version 0.2.1, author 'logread'
2019-05-10 11:52:39.978 (Monitor APC) Pushing 'onHeartbeatCallback' on to queue
2019-05-10 11:52:40.007 (Monitor APC) Processing 'onHeartbeatCallback' message
2019-05-10 11:52:40.008 (Monitor APC) Calling message handler 'onHeartbeat'.
Logread
Posts: 228
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 »

@Kender,

Apologies for the delayed response.
This may have to do with a bug in version 0.2.2 of the plugin, where when no authentication is set up the plugin did not update any child devices.
Can you please check if this error persists with version 0.2.3 that I just pushed to GitHub ?
Kender
Posts: 10
Joined: Tuesday 03 January 2017 17:18
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Kender »

I can't update :shock:
git command give me: error: "cannot open .git/FETCH_HEAD: Permission denied"
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests