Python plugin: UPS Monitor

Python and python framework

Moderator: leecollings

Matthias
Posts: 12
Joined: Wednesday 09 January 2019 23:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Matthias »

Hi,

Thank you for this plugin.
It works perfectly.
But i have a problem with blocky.

What is the parameters i have to use for Status mode in a condition ?
I try "OL", "OB", "ONBATTERY DISCHARGING", panic, alarm...

Nothing works
Attachments
Capture.PNG
Capture.PNG (52.25 KiB) Viewed 1360 times
User avatar
madpatrick
Posts: 661
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python plugin: UPS Monitor

Post by madpatrick »

On my APC UPS the status is "ONLINE"
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.14b on Tab8" =-
Matthias
Posts: 12
Joined: Wednesday 09 January 2019 23:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by Matthias »

I d'ont understand why it doesn't work.

I try with everything in my blocky :
  • ONLINE CHARGING
  • ONLINE
  • OL
  • 0
  • 1
  • 2
  • 3
  • 4...
  • ON
  • OFF
  • OPEN
  • CLOSE
  • ALARM
  • PANIC...
What is the parameter to do a condition for my UPS EATON ?
Attachments
Capture1.PNG
Capture1.PNG (21.36 KiB) Viewed 1333 times
Capture2.PNG
Capture2.PNG (7.43 KiB) Viewed 1333 times
User avatar
madpatrick
Posts: 661
Joined: Monday 26 December 2016 12:17
Target OS: Linux
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python plugin: UPS Monitor

Post by madpatrick »

It appears that a text input is not working in Blocky
See also:
viewtopic.php?f=62&t=28388&p=217446&hil ... ly#p217438

You can better use a Dzvents script.

I've tried a simplte test script and this is working

Code: Select all

local scriptVar     = '-=# TEST #=-'
local testswitch    =   290

return
{
    on       = {
                devices         = {testswitch,},
                },

    logging = {
                level = domoticz.LOG_ERROR,
                marker = scriptVar,
                },

    execute = function(dz, item)
local UPS_status   = dz.devices(560)

            if UPS_status.text == 'ONLINE'  then
            dz.log('APS UPS is : ' ..UPS_status.text, dz.LOG_FORCE)
        end
    end
}

I think for your example it looks like this

You need to change the ID number of your devices (290 and 300) in this script

Code: Select all

local scriptVar     = '-=# TEST #=-'
local UPS_status    =   290  -- fill in your device ID of the EATON
local Light         =   300  -- fill in your device ID of the Le Bureau

return
{
    on       = {
                devices         = {UPS_status,},
                },

    logging = {
                level = domoticz.LOG_ERROR,
                marker = scriptVar,
                },

    execute = function(dz, item)
    local UPS_status   = dz.devices(UPS_status)
    local Light   		= dz.devices(Light)
    
            if UPS_status.text == 'ONLINE CHARGING'  or UPS_status.text == 'ONBATTERY DISCHARGING'  then
            Light.switchOn().checkFirst()
            dz.log('APS UPS is : ' ..UPS_status.text, dz.LOG_FORCE)
        end
    end
}
-= HP server GEN11 =- OZW -=- Toon2 (rooted) -=- Domoticz v2024.7 -=- Dashticz v3.14b on Tab8" =-
tarmacalastair
Posts: 95
Joined: Wednesday 30 October 2019 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Great Britain
Contact:

Re: Python plugin: UPS Monitor

Post by tarmacalastair »

Notifications

Well I've only just bought a UPS (Tecnoware) and installed this plugin so let's start by saying a big thanks to the author!

But, as others have reported here, I could not get notifications to work when power was lost/restored with the "NUT - UPS Status Mode" changing between ONLINE and ONBATTERY.

One of the recent comments mentioned using blockly so I started out by looking in there and I noticed (when you look at the current values of devices) that there is a column for the "State" and another for the "Value" for each device.

For my UPS the status mode shows the following:
State as "ONLINE" and Value as "1/ONLINE" when there is AC power (top line below):
Screenshot 2022-12-01 at 11-32-19 Domoticz.png
Screenshot 2022-12-01 at 11-32-19 Domoticz.png (36.54 KiB) Viewed 1250 times

or
State as "ONBATTERY" and Value as "4/ONBATTERY" when running on battery:
Screenshot 2022-12-01 at 11-39-47 Domoticz.png
Screenshot 2022-12-01 at 11-39-47 Domoticz.png (15.26 KiB) Viewed 1250 times
So, under the Domoticz "Utility" tab I went into the Notifications for the "UPS Status Mode" and tried using the numeric "Value" instead of the text status. I powered off my UPS and a minute or so later I powered it back on and both times I received a notification (Pushbullet and Telegram in my case). See screenshot and note below:
Screenshot 2022-12-01 at 11-41-32 Domoticz.png
Screenshot 2022-12-01 at 11-41-32 Domoticz.png (94.84 KiB) Viewed 1250 times
Important - Make sure you change the "Ignore Interval" to on (green) so that the status change will always send out a notification. (I forgot to show this in the above screenshot)
For testing purposes I lowered the polling interval by editing the plugin.py to 20 seconds but will now increase it back to 1 minute.
Just need to decide now whether to set this to ring the (battery) doorbell when power is lost and risk waking the household at night!

Hope this helps people like me who were struggling with notifications.
Running Domoticz and Dashticz beta on Raspberry Pi OS 32 bit - has anyone had success with 64 bit?

Desktop access from Ubuntu Linux
betogar
Posts: 6
Joined: Saturday 10 December 2022 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by betogar »

tarmacalastair wrote: Thursday 01 December 2022 12:54 Notifications

Well I've only just bought a UPS (Tecnoware) and installed this plugin so let's start by saying a big thanks to the author!

But, as others have reported here, I could not get notifications to work when power was lost/restored with the "NUT - UPS Status Mode" changing between ONLINE and ONBATTERY.

One of the recent comments mentioned using blockly so I started out by looking in there and I noticed (when you look at the current values of devices) that there is a column for the "State" and another for the "Value" for each device.

For my UPS the status mode shows the following:
State as "ONLINE" and Value as "1/ONLINE" when there is AC power (top line below):
Screenshot 2022-12-01 at 11-32-19 Domoticz.png


or
State as "ONBATTERY" and Value as "4/ONBATTERY" when running on battery:
Screenshot 2022-12-01 at 11-39-47 Domoticz.png

So, under the Domoticz "Utility" tab I went into the Notifications for the "UPS Status Mode" and tried using the numeric "Value" instead of the text status. I powered off my UPS and a minute or so later I powered it back on and both times I received a notification (Pushbullet and Telegram in my case). See screenshot and note below:
Screenshot 2022-12-01 at 11-41-32 Domoticz.png
Important - Make sure you change the "Ignore Interval" to on (green) so that the status change will always send out a notification. (I forgot to show this in the above screenshot)
For testing purposes I lowered the polling interval by editing the plugin.py to 20 seconds but will now increase it back to 1 minute.
Just need to decide now whether to set this to ring the (battery) doorbell when power is lost and risk waking the household at night!

Hope this helps people like me who were struggling with notifications.
Sorry for the question, where can I see that?
Attachments
Screenshot 2022-12-01 at 11-32-19 Domoticz.png
Screenshot 2022-12-01 at 11-32-19 Domoticz.png (36.54 KiB) Viewed 1225 times
tarmacalastair
Posts: 95
Joined: Wednesday 30 October 2019 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Great Britain
Contact:

Re: Python plugin: UPS Monitor

Post by tarmacalastair »

You get to it by clicking on Setup, More Options, Events. This takes you to the automation scripts page where you can see device statuses.

You can also get there with http or https://ipaddress:8080/#/Events (substitute your IP address and change the port if you don't use 8080).
Good luck. I found the device statuses by accident. I'd seen them before but completely forgotten.
Running Domoticz and Dashticz beta on Raspberry Pi OS 32 bit - has anyone had success with 64 bit?

Desktop access from Ubuntu Linux
betogar
Posts: 6
Joined: Saturday 10 December 2022 23:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by betogar »

tarmacalastair wrote: Sunday 11 December 2022 0:37 You get to it by clicking on Setup, More Options, Events. This takes you to the automation scripts page where you can see device statuses.

You can also get there with http or https://ipaddress:8080/#/Events (substitute your IP address and change the port if you don't use 8080).
Good luck. I found the device statuses by accident. I'd seen them before but completely forgotten.

oh i see, thanxs ;)
ssk17051980
Posts: 112
Joined: Thursday 08 December 2022 22:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: ROMANIA
Contact:

Re: Python plugin: UPS Monitor

Post by ssk17051980 »

Hi,

so, this plugin is working whit any UPS ?
i see that the plugin is for EATON, but another forum member use this for a UPS Tecnoware.
can i use any USB cable to monitor the UPS ?

thx
Attachments
AJ7W_1_201910101336456077.jpg
AJ7W_1_201910101336456077.jpg (54.76 KiB) Viewed 1155 times
barkerg
Posts: 2
Joined: Thursday 27 February 2025 0:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by barkerg »

The plugin works well using simple notifications sent out on Pushover, however I'm trying to write a Blocky script to report the UPS Backup Time whenever the UPS status mode is offline. When constructing an if statement, only the Backup Time device shows up when clicking Devices>Utility and not Status Mode. Both these devices as well as the UPS Charge device show up when I click the current states icon. Is this a bug or am I doing something wrong? I am using Domoticz 2024/7 on a Raspberry Pi 4B. The UPS is a Cyberpower 1500AVR.
User avatar
waltervl
Posts: 5737
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python plugin: UPS Monitor

Post by waltervl »

That UPS status device is probably a selector switch and can be found under light/switches.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
barkerg
Posts: 2
Joined: Thursday 27 February 2025 0:45
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: UPS Monitor

Post by barkerg »

Thanks for the quick reply. Nothing was found under switches but ironically it was under Zwave Alarms even though it is not a Zwave device. Sorry for the tunnel vision.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest