Python plugin: UPS Monitor

Python and python framework

Moderator: leecollings

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: 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 »

@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"
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 »

Kender wrote: Friday 24 May 2019 11:15 I can't update :shock:
git command give me: error: "cannot open .git/FETCH_HEAD: Permission denied"
You may want to delete the plugin folder and reinstall from scratch ?
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 solved downlading only the plugin.py from the web page of Git.
I can tell you that the versione 2.3 work prefectly !!
Thank you very much ! :) :)
Dim33
Posts: 11
Joined: Monday 05 March 2018 22:54
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Dim33 »

Hello,

I use version 0.2.3 of UPS monitor plugin with Domoticz 4.9701.
My UPS server is on NAS DS214+ DSM 6.2.2-24922.

Without user/mdp, I read in domoticz logs : "Error: (Onduleur) Error reading UPS variables: ERR ACCESS-DENIED"
With user/mdp (monuser/secret or xxxxx), I read in domoticz logs "Error: (Onduleur) Authentication error: ('ERR ACCESS-DENIED')"

An idea ? I don't see the problem.
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 »

Dim33 wrote: Wednesday 19 June 2019 0:36 Hello,

I use version 0.2.3 of UPS monitor plugin with Domoticz 4.9701.
My UPS server is on NAS DS214+ DSM 6.2.2-24922.

Without user/mdp, I read in domoticz logs : "Error: (Onduleur) Error reading UPS variables: ERR ACCESS-DENIED"
With user/mdp (monuser/secret or xxxxx), I read in domoticz logs "Error: (Onduleur) Authentication error: ('ERR ACCESS-DENIED')"

An idea ? I don't see the problem.
Did you add the IP address of the domoticz host to the whitelist in DSM (UPS tab in config) ?
Dim33
Posts: 11
Joined: Monday 05 March 2018 22:54
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Dim33 »

Logread wrote: Wednesday 19 June 2019 7:39
Dim33 wrote: Wednesday 19 June 2019 0:36 Hello,

I use version 0.2.3 of UPS monitor plugin with Domoticz 4.9701.
My UPS server is on NAS DS214+ DSM 6.2.2-24922.

Without user/mdp, I read in domoticz logs : "Error: (Onduleur) Error reading UPS variables: ERR ACCESS-DENIED"
With user/mdp (monuser/secret or xxxxx), I read in domoticz logs "Error: (Onduleur) Authentication error: ('ERR ACCESS-DENIED')"

An idea ? I don't see the problem.
Did you add the IP address of the domoticz host to the whitelist in DSM (UPS tab in config) ?
Yes
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 »

@Dim33,

I cannot replicate the error you are seeing (I am running same version of DSM than yours, version 0.2.3 of the plugin and domoticz 4.10717 - the latest stable - on a Raspberry Pi). You may want to test using CLI NUT tools (upsc client if you are on linux) and see if you can connect ?
Dim33
Posts: 11
Joined: Monday 05 March 2018 22:54
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Dim33 »

Thanks Logread.

NUT Client is installed on my NUC (with Domoticz) and can't connect to UPS server.

Output of sudo upsc [email protected]

Code: Select all

Init SSL without certificate database
Error: Access denied
WinNUT is also installed on my PC and no problem !

:shock: :shock: :shock: :shock:
blackie
Posts: 5
Joined: Tuesday 19 November 2019 14:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by blackie »

Hi,
I consider to use this plugin, I have a local NUT installation on RPi->USB->APC UPS.
In my home the UPS comes onbattery maybe 2xday for 1-2s - short outages.
Can I use this plugin to get long-term statistics of such short outages or the plugin just reads the actual NUT data every 60s?
If not, I would like to use the local NUT server script triggered when outage occurres to update the UPS sensors. Can this be done somehow with the plugin sensors?
xavbzh
Posts: 3
Joined: Sunday 15 November 2020 1:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by xavbzh »

Hello,

I try to use this plugin, but I don't manage.
Fresh installation of pi 3, latest raspios :
root@raspberrypi:/# cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Latest domoticz stable release :
Version: 2020.2
Build Hash: b63341bc0
Compile Date: 2020-04-26 13:47:55
dzVents Version: 3.0.2
Python Version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
The plugin is in the plugin directory, I restart domoticz, everything is OK. I add the hardware, UPS Monitor type, correct credentials, then the user interface crash. When I check the service :
root@raspberrypi:/usr/domoticz/plugins/NUT_UPS# /etc/init.d/domoticz.sh status
● domoticz.service - LSB: Home Automation System
Loaded: loaded (/etc/init.d/domoticz.sh; generated)
Active: active (exited) since Sun 2020-11-15 20:56:53 CET; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 25177 ExecStart=/etc/init.d/domoticz.sh start (code=exited, status=0/SUCCESS)

nov. 15 20:56:53 raspberrypi systemd[1]: Starting LSB: Home Automation System...
nov. 15 20:56:53 raspberrypi domoticz.sh[25177]: 2020-11-15 20:56:53.754 Status: Domoticz V2020.2 (c)2012-20…izMoCuz
nov. 15 20:56:53 raspberrypi domoticz.sh[25177]: 2020-11-15 20:56:53.754 Status: Build Hash: b63341bc0, Date…3:47:55
nov. 15 20:56:53 raspberrypi domoticz.sh[25177]: 2020-11-15 20:56:53.754 Status: Startup Path: /usr/domoticz/
nov. 15 20:56:53 raspberrypi domoticz.sh[25177]: domoticz: Domoticz is starting up....
nov. 15 20:56:53 raspberrypi domoticz[25183]: Domoticz is starting up....
nov. 15 20:56:53 raspberrypi domoticz[25184]: Domoticz running...
nov. 15 20:56:53 raspberrypi systemd[1]: Started LSB: Home Automation System.
Hint: Some lines were ellipsized, use -l to show in full.
I delete the NUT plugin directory then restart domoticz, it's OK. In the log :
2020-11-15 20:57:38.198 Error: (NUT_UPS) failed to load 'plugin.py', Python Path used was ':/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2020-11-15 20:57:38.198 Error: (onduleur) Module Import failed, exception: 'ModuleNotFoundError'
2020-11-15 20:57:38.198 Error: (onduleur) Module Import failed: ' Name: plugin'
2020-11-15 20:57:38.198 Error: (onduleur) Error Line details not available.
After an alternative python3.4 install, I tried to modify this path adding in the plugin.py :
import sys
sys.path.append('/usr/lib/python3.4')
No success... same error in log.

If anyone could help...
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 »

@xavbzh,

Did you try other python plugins ? This looks to me as a python issue rather than a plugin issue... some search might help you as I think there are many posts on similar issues on the forum
ikkezelf
Posts: 5
Joined: Thursday 01 October 2020 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by ikkezelf »

I had to install the python-dev for the hardware tot popup in the pull-down list.
I'm using a APC-UPS

it's working fine now, If I want to show more variables, I just have to edit the .py script ?
ikkezelf
Posts: 5
Joined: Thursday 01 October 2020 12:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by ikkezelf »

expanding the plugin script succeeded.
However I have installed all on my slave pi. Now as I want to make the devices visible on the master pi, they don't seem to be adde as new devices on the master.
Any idea why these are not recognised as devices from the slave? (and yes I included them as available for the logged in user).
User avatar
Antori91
Posts: 136
Joined: Sunday 12 February 2017 17:12
Target OS: NAS (Synology & others)
Domoticz version: 4.10717
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Antori91 »

ikkezelf wrote: Wednesday 23 December 2020 18:43 Any idea why these are not recognised as devices from the slave? (and yes I included them as available for the logged in user).
Hi,
It's a known issue. Domoticz feature for synchronization (Domoticz remote server) doesn't work for devices created and updated by a plugin. As you, I've installed this plugin on my backup server. To synchronize my main server, I use my own replication system (see viewtopic.php?f=38&t=24088)
Domoticz High Availability Cluster: Synology Dz V4.10693 (Main) - Raspberry Dz V4.10717 (Backup) - Scripts Node.js
Alarm server: Raspberry - motionEye - iot_ALARM-SVR Node.js
Sensors/Actuators: ESP8266-Arduino
https://github.com/Antori91/Home_Automation
ilex
Posts: 12
Joined: Friday 26 June 2020 23:14
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by ilex »

Hi to All,

I succefully use UPS Monitor Plugin but there is one thing I would like to change which is the UPS runtime information from seconds to minutes.

Can anyone give ma a hint what to change in plugin.py file ?

BR.
Last edited by ilex on Monday 10 May 2021 14:24, edited 1 time in total.
User avatar
FireWizard
Posts: 1979
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Python plugin: UPS Monitor

Post by FireWizard »

Hi, @ilex

You can change line 49, in plugin.py
(self.pollinterval = 60 #Time in seconds between two polls)
Currently the pollinterval = 60 seconds.
You can change that to another value, but it has to be in seconds.

Regards
ilex
Posts: 12
Joined: Friday 26 June 2020 23:14
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by ilex »

I am not sure if I have made myself clear.

I want in Domoticz the UPS runtime to be displayed in minutes (not in seconds as it is now) :)
Post Reply