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 »

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

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

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

@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: 1745
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) :)
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 »

Hello,
I have installed this plugin to my RPi with Domoticz and local NUT installation.
In my home the UPS comes onbattery cca 2x per day for 1-2 seconds.
Seems the plugin is unable to detect these short power outages because plugin reads the actual UPS data every 60s.
I have an idea to use local NUT server script /usr/bin/upssched-cmd triggered after power status change to catch these short outages.
Can this python plugin be called somehow from upssched-cmd script to update Domoticz UPS sensors every time UPS status changes?

If i try to execute plugin manually from a shell i get an error:
root@OMV:/home/domoticz/plugins/NUT_UPS# python3 plugin.py
Traceback (most recent call last):
File "plugin.py", line 36, in <module>
import Domoticz
ModuleNotFoundError: No module named 'Domoticz'

Thanks in advance for help
Kyrille
Posts: 14
Joined: Sunday 19 January 2020 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.01
Location: France
Contact:

Re: Python plugin: UPS Monitor

Post by Kyrille »

Hello,

The plugin is working fine in my environment but I can't succeed in creating a notification for the Status.

When I set a condition for the value "ONBATTERY DISCHARGING" in order for Pushover to warn me about a power shutdown, nothing happen.

I noticed that when I come back to the corresponding notification, the field for Value is empty. It seems that my chain of characters was not accepted when creating it. I tried to put the text between " " but same (no) effect.

Any clue ?

Thank you in advance.Image

Envoyé de mon Pixel 4a en utilisant Tapatalk

Raspberry Pi 4 (8GB) & 3B+ (buster) / Conbee II / Z-Stick Gen 5 / RFXCOM 433 XL / Domoticz 2020.02
Pi zero 2 ordered
nico21311
Posts: 1
Joined: Thursday 20 December 2018 12:24
Target OS: Linux
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by nico21311 »

Hello

I have installed a fresh installation of Domoticz on the news debian bulleyes with python 3.9.2.

Domoticz works well. However when I installed the plugin NUT UPS or UPS monitor, Domoticz do not start.

According my investigation, the issue come form new python 3.9.2 and the script.

I am not enough skill to solved the issue.

I really appreciate if someone could help me.

Thanks in advance for your support
PieterS
Posts: 195
Joined: Wednesday 31 May 2017 16:06
Target OS: NAS (Synology & others)
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: UPS Monitor

Post by PieterS »

For a while (maybe since running Domoticz in Docker??) I am not able to monitor my APC UPS which is connected by USB to my Synology. The error in the logfile: Error reading UPS variables: ERR ACCESS-DENIED
This is the (filtered) logfile:
Spoiler: show
2022-07-13 14:52:20.500 APC UPS: Worker thread started.
2022-07-13 14:52:20.611 APC UPS: Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
2022-07-13 14:52:20.611 APC UPS: 'HardwareID':'39'
2022-07-13 14:52:20.611 APC UPS: 'HomeFolder':'/opt/domoticz/userdata/plugins/NUT_UPS/'
2022-07-13 14:52:20.611 APC UPS: 'StartupFolder':'/opt/domoticz/'
2022-07-13 14:52:20.611 APC UPS: 'UserDataFolder':'/opt/domoticz/userdata/'
2022-07-13 14:52:20.611 APC UPS: 'Database':'/opt/domoticz/userdata/domoticz.db'
2022-07-13 14:52:20.611 APC UPS: 'Language':'nl'
2022-07-13 14:52:20.611 APC UPS: 'Version':'0.2.1'
2022-07-13 14:52:20.611 APC UPS: 'Author':'logread'
2022-07-13 14:52:20.611 APC UPS: 'Name':'APC UPS'
2022-07-13 14:52:20.611 APC UPS: 'Address':'192.168.1.18'
2022-07-13 14:52:20.611 APC UPS: 'Port':'3493'
2022-07-13 14:52:20.611 APC UPS: 'Key':'NUT_UPS'
2022-07-13 14:52:20.611 APC UPS: 'Mode1':'ups'
2022-07-13 14:52:20.611 APC UPS: 'Mode6':'Debug'
2022-07-13 14:52:20.611 APC UPS: 'DomoticzVersion':'2022.1 (build 14369)'
2022-07-13 14:52:20.611 APC UPS: 'DomoticzHash':'00c5d7861'
2022-07-13 14:52:20.611 APC UPS: 'DomoticzBuildTime':'2022-06-27 10:39:10'
2022-07-13 14:52:20.611 APC UPS: Device count: 5
2022-07-13 14:52:20.611 APC UPS: Device: 1 - ID: 961, Name: 'APC UPS - UPS Status Mode', nValue: 0, sValue: 'COMMUNICATION ERROR'
2022-07-13 14:52:20.611 APC UPS: Device ID: '961'
2022-07-13 14:52:20.611 APC UPS: Device Name: 'APC UPS - UPS Status Mode'
2022-07-13 14:52:20.611 APC UPS: Device nValue: 0
2022-07-13 14:52:20.611 APC UPS: Device sValue: 'COMMUNICATION ERROR'
2022-07-13 14:52:20.611 APC UPS: Device LastLevel: 0
2022-07-13 14:52:20.612 APC UPS: Device: 2 - ID: 867, Name: 'APC UPS - UPS Charge', nValue: 0, sValue: '100'
2022-07-13 14:52:20.612 APC UPS: Device ID: '867'
2022-07-13 14:52:20.612 APC UPS: Device Name: 'APC UPS - UPS Charge'
2022-07-13 14:52:20.612 APC UPS: Device nValue: 0
2022-07-13 14:52:20.612 APC UPS: Device sValue: '100'
2022-07-13 14:52:20.612 APC UPS: Device LastLevel: 0
2022-07-13 14:52:20.612 APC UPS: Device: 3 - ID: 868, Name: 'APC UPS - UPS Backup Time', nValue: 0, sValue: '2670'
2022-07-13 14:52:20.612 APC UPS: Device ID: '868'
2022-07-13 14:52:20.612 APC UPS: Device Name: 'APC UPS - UPS Backup Time'
2022-07-13 14:52:20.612 APC UPS: Device nValue: 0
2022-07-13 14:52:20.612 APC UPS: Device sValue: '2670'
2022-07-13 14:52:20.612 APC UPS: Device LastLevel: 0
2022-07-13 14:52:20.612 APC UPS: Device: 4 - ID: 866, Name: 'APC UPS - UPS AC Input', nValue: 0, sValue: '226.0'
2022-07-13 14:52:20.612 APC UPS: Device ID: '866'
2022-07-13 14:52:20.612 APC UPS: Device Name: 'APC UPS - UPS AC Input'
2022-07-13 14:52:20.612 APC UPS: Device nValue: 0
2022-07-13 14:52:20.612 APC UPS: Device sValue: '226.0'
2022-07-13 14:52:20.612 APC UPS: Device LastLevel: 0
2022-07-13 14:52:20.612 APC UPS: Device: 5 - ID: 865, Name: 'APC UPS - UPS Load', nValue: 0, sValue: '21'
2022-07-13 14:52:20.612 APC UPS: Device ID: '865'
2022-07-13 14:52:20.612 APC UPS: Device Name: 'APC UPS - UPS Load'
2022-07-13 14:52:20.612 APC UPS: Device nValue: 0
2022-07-13 14:52:20.612 APC UPS: Device sValue: '21'
2022-07-13 14:52:20.612 APC UPS: Device LastLevel: 0
2022-07-13 14:52:20.612 APC UPS: Acquiring GIL for 'onStartCallback'
2022-07-13 14:52:20.501 Status: APC UPS: Started.
2022-07-13 14:52:20.500 Status: APC UPS: Entering work loop.
2022-07-13 14:52:20.607 Status: APC UPS: Initialized version 0.2.1, author 'logread'
2022-07-13 14:52:30.034 APC UPS: Pushing 'onHeartbeatCallback' on to queue
2022-07-13 14:52:30.084 APC UPS: Processing 'onHeartbeatCallback' message
2022-07-13 14:52:30.085 APC UPS: Acquiring GIL for 'onHeartbeatCallback'
2022-07-13 14:52:30.085 APC UPS: Calling message handler 'onHeartbeat' on 'module' type object.
2022-07-13 14:52:30.100 APC UPS: Variable UPS Status = 0
2022-07-13 14:52:30.100 APC UPS: Variable UPS Charge = None
2022-07-13 14:52:30.100 APC UPS: Variable UPS Backup Time = None
2022-07-13 14:52:30.100 APC UPS: Variable UPS AC Input = None
2022-07-13 14:52:30.100 APC UPS: Variable UPS Load = None
2022-07-13 14:52:30.100 APC UPS: Variable UPS Power = None
2022-07-13 14:52:30.100 APC UPS: Variable UPS AC Frequency = None
2022-07-13 14:52:30.100 APC UPS: Acquiring GIL for 'onHeartbeatCallback'
2022-07-13 14:52:30.100 Error: APC UPS: Error reading UPS variables: ERR ACCESS-DENIED
2022-07-13 14:52:40.013 APC UPS: Pushing 'onHeartbeatCallback' on to queue
2022-07-13 14:52:40.090 APC UPS: Processing 'onHeartbeatCallback' message
2022-07-13 14:52:40.090 APC UPS: Acquiring GIL for 'onHeartbeatCallback'
2022-07-13 14:52:40.090 APC UPS: Calling message handler 'onHeartbeat' on 'module' type object.
2022-07-13 14:52:40.090 APC UPS: Acquiring GIL for 'onHeartbeatCallback'
The services for UPS are up and running on my Synology and use port 3493...
In Docker I have installed the plugin as described in https://www.domoticz.com/wiki/Plugins/NUT_UPS.html
In the configuration of the container of Domoticz (V14369) I have a problem I cannot solve:

When I fill in port 3493 for the host I get an error because that port is in use by the host...

Image

This is a part of the portsettings of the container of Domoticz in Docker:

Image

So how to configure the software of Docker that port 3493 (which is used by the host) can talk to the plugin in Domoticz??
Synology with Domoticz build (V2024.7) in Docker
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest