Page 6 of 6

Re: Python plugin: UPS Monitor

Posted: Saturday 03 September 2022 10:41
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

Re: Python plugin: UPS Monitor

Posted: Saturday 03 September 2022 19:36
by madpatrick
On my APC UPS the status is "ONLINE"

Re: Python plugin: UPS Monitor

Posted: Saturday 03 September 2022 21:33
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 ?

Re: Python plugin: UPS Monitor

Posted: Sunday 04 September 2022 21:46
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
}

Re: Python plugin: UPS Monitor

Posted: Thursday 01 December 2022 12:54
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 1553 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 1553 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 1553 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.

Re: Python plugin: UPS Monitor

Posted: Saturday 10 December 2022 23:55
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?

Re: Python plugin: UPS Monitor

Posted: Sunday 11 December 2022 0:37
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.

Re: Python plugin: UPS Monitor

Posted: Sunday 11 December 2022 0:55
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 ;)

Re: Python plugin: UPS Monitor

Posted: Sunday 19 February 2023 15:58
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

Re: Python plugin: UPS Monitor

Posted: Wednesday 05 March 2025 17:24
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.

Re: Python plugin: UPS Monitor

Posted: Wednesday 05 March 2025 18:49
by waltervl
That UPS status device is probably a selector switch and can be found under light/switches.

Re: Python plugin: UPS Monitor

Posted: Wednesday 05 March 2025 19:38
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.