Page 2 of 2

Re: APC UPS Monitoring

Posted: Sunday 19 November 2017 19:51
by Kruu
I am getting communication lost often. Can I do something about it?

2017-11-14 17:35:16 +0100 Communications with UPS lost.

Re: APC UPS Monitoring

Posted: Tuesday 24 April 2018 19:55
by assenzuid
Rene wrote: Tuesday 13 January 2015 2:56 I made one too, this one is in Python script for whoever wants it, now with auto shutdown when battery power is down to 10%

Code: Select all

#!/usr/bin/python 
#
#		Script to read APC battery backups settings and voltages.
#   	And publish these to domoticz software.
#
#		(C)reated by Rtm-soft Jan 2015
#	
#		This code is Free Software and comes with absolutely
#		no warranty and may freely be modified and distributed.


#Modules used in this program

import subprocess	#For OS calls
import time
import requests		#For URL calls

#Install APC driver with:
#
#Read https://help.ubuntu.com/community/apcupsd or follow below lines
#
#Quick Install for USB-based APC units
#    install the daemon: apt-get install apcupsd
#    edit /etc/apcupsd/apcupsd.conf and change these lines
#        UPSNAME myownups
#        UPSCABLE usb
#        UPSTYPE usb
#        comment out DEVICE (it contains a TTY link, which will prevent it from working) 
#    edit /etc/default/apcupsd
#        change ISCONFIGURED from no to yes 
#    /etc/init.d/apcupsd start
#    apcaccess 

#Shutdown access to user without password:
#
#sudo visudo -f /etc/sudoers.d/myOverrides 
#
#<myusername>    ALL = NOPASSWD: /sbin/shutdown


#Constants (Modify these to match your own settings)

DOMOTICZ_URL = "http://localhost:8080"	#http://<username:password@>domoticz-ip<:port>
APCACCESS	= "/sbin/apcaccess"			#Location of apcaccess program
LINEV		= "40"							#Idx for Line Voltage
BATTV		= "44"							#Idx for Battery Voltage
LOADPCT		= "45"							#Idx for Load Percentage
BCHARGE		= "46"							#Idx for Battery Charge
MINBATT		= 10							#Shut down when battery power is at 10%

#Variables

def apc_probe() :
	batt = 100	#Needs to be >MINBATT to not do a false processor stop
	dict = {'LINEV' : LINEV, 'BATTV' : BATTV, 'LOADPCT' : LOADPCT, 'BCHARGE' : BCHARGE } #Convert Keyword to Domoticz index.
	while True :						#Endless loop
		res = subprocess.check_output(APCACCESS) 
		for line in res.split('\n') :
			(key,spl,val) = line.partition(': ')
			key = key.rstrip()			#Strip spaces right of text
			val = val.strip()			#Remove outside spaces
			if key == 'STATUS' and 'ONBATT' in val and batt < MINBATT : #If there is less then 10 percent battery power left and we are offline then shutdown
				subprocess.call("sudo shutdown -h now", shell=True)	#Edit /etc/sudoers.d/myOverrides to make shutdown without password work
			val = val.split(' ',1)[0] 	#Split using space and only take first part
			if key in dict : 			#Are we interested in this parameter?
				if key == 'BCHARGE' :
					batt = int(float(val))		#Save battery level for Offline mode.
				url= DOMOTICZ_URL+"/json.htm?type=command&param=udevice&idx="+dict[key]+"&nvalue=0&svalue="+val #Publish value to Domoitcz by means of json.
				requests.get(url)		#Print url
		time.sleep(60) #Take a minute break

#Main Loop
print "APC Probe running..."
apc_probe()					
Is there a way to see in an log file if it shutdowns the PI is batt. status is 10 min?

Re: APC UPS Monitoring

Posted: Monday 08 October 2018 13:01
by ausonius
Hello everyone

In relation to the script below I can not figure out where it is inserted? in the installation directory domoticz script? under what name?

excuse me for my english


assenzuid wrote: Saturday 21 October 2017 22:46
Rene wrote: Tuesday 13 January 2015 2:56 I made one too, this one is in Python script for whoever wants it, now with auto shutdown when battery power is down to 10%

Code: Select all

#!/usr/bin/python 
#
#		Script to read APC battery backups settings and voltages.
#   	And publish these to domoticz software.
#
#		(C)reated by Rtm-soft Jan 2015
#	
#		This code is Free Software and comes with absolutely
#		no warranty and may freely be modified and distributed.


#Modules used in this program

import subprocess	#For OS calls
import time
import requests		#For URL calls

#Install APC driver with:
#
#Read https://help.ubuntu.com/community/apcupsd or follow below lines
#
#Quick Install for USB-based APC units
#    install the daemon: apt-get install apcupsd
#    edit /etc/apcupsd/apcupsd.conf and change these lines
#        UPSNAME myownups
#        UPSCABLE usb
#        UPSTYPE usb
#        comment out DEVICE (it contains a TTY link, which will prevent it from working) 
#    edit /etc/default/apcupsd
#        change ISCONFIGURED from no to yes 
#    /etc/init.d/apcupsd start
#    apcaccess 

#Shutdown access to user without password:
#
#sudo visudo -f /etc/sudoers.d/myOverrides 
#
#<myusername>    ALL = NOPASSWD: /sbin/shutdown


#Constants (Modify these to match your own settings)

DOMOTICZ_URL = "http://localhost:8080"	#http://<username:password@>domoticz-ip<:port>
APCACCESS	= "/sbin/apcaccess"			#Location of apcaccess program
LINEV		= "40"							#Idx for Line Voltage
BATTV		= "44"							#Idx for Battery Voltage
LOADPCT		= "45"							#Idx for Load Percentage
BCHARGE		= "46"							#Idx for Battery Charge
MINBATT		= 10							#Shut down when battery power is at 10%

#Variables

def apc_probe() :
	batt = 100	#Needs to be >MINBATT to not do a false processor stop
	dict = {'LINEV' : LINEV, 'BATTV' : BATTV, 'LOADPCT' : LOADPCT, 'BCHARGE' : BCHARGE } #Convert Keyword to Domoticz index.
	while True :						#Endless loop
		res = subprocess.check_output(APCACCESS) 
		for line in res.split('\n') :
			(key,spl,val) = line.partition(': ')
			key = key.rstrip()			#Strip spaces right of text
			val = val.strip()			#Remove outside spaces
			if key == 'STATUS' and 'ONBATT' in val and batt < MINBATT : #If there is less then 10 percent battery power left and we are offline then shutdown
				subprocess.call("sudo shutdown -h now", shell=True)	#Edit /etc/sudoers.d/myOverrides to make shutdown without password work
			val = val.split(' ',1)[0] 	#Split using space and only take first part
			if key in dict : 			#Are we interested in this parameter?
				if key == 'BCHARGE' :
					batt = int(float(val))		#Save battery level for Offline mode.
				url= DOMOTICZ_URL+"/json.htm?type=command&param=udevice&idx="+dict[key]+"&nvalue=0&svalue="+val #Publish value to Domoitcz by means of json.
				requests.get(url)		#Print url
		time.sleep(60) #Take a minute break

#Main Loop
print "APC Probe running..."
apc_probe()					
I'm using this great script, but how to be sure that its running after a reboot op my PI?

Re: APC UPS Monitoring

Posted: Tuesday 09 October 2018 21:37
by NiCOOLaS
Hello all.

I set up monitoring of remote APC UPS SMT3000 using SNMP on the server (windows) connected to the UPS.
Here is the instruction:

On a server running an OS, for example Windows, to which UPS APC is connected, you must install / start the SNMP service. It will collect statistics on the operation of the UPS and provide information to customers.
The Domoticz management server (SNMP service client) will request information from the / UPS server for further processing.
Install / configure the SNMP service in Windows

Install/configure the SNMP service in Windows
Programs -> Programs and Components -> Windows Components (choose SNMP)
Start the service control and select the SNMP service
On the “Security” tab, add the community name “Public” with “read only” rights and select the “Receive SNMP packets from any node” option (it is possible to specify only specific addresses of clients).
On the “SNMP Agent” tab, fill in the data as you wish:
You also need to add a “trap” as in the picture, the ip address is Domoticz

image5.png

2. Install APC PowerChute
On the manufacturer's website, download the APC PowerChute suitable for your UPS
https://www.apc.com/shop/ru/ru/categori ... /N-13kn0i4
I used the version - PowerChute Business Edition v9.2, it does not support SNMP v3 and settings are easier.

During installation, the system will automatically query the ports and configure the connection to the UPS(USB), and also request a password for the UPS Web Management Interface.
After installation, you must go to the Web interface at: https://localhost:6547 . Most likely, the browser will block the transition and write that we’ll ignore the “connection is not protected” and proceed.
On the “PowerChute” tab, select “SNMP Settings” and activate “SNMPv1”

image3.png

Reboot.
The server is ready to transfer the UPS parameters, now we will configure Domoticz to read them.

Install SNMP on Raspberry Pi

Code: Select all

sudo apt-get install snmpd
sudo apt-get install snmp
Reboot the Pi

Code: Select all

sudo reboot
Run to check:

Code: Select all

snmpget -v 1 -c public -O qv IPserver 1.3.6.1.4.1.318.1.1.1.1.1.1.0
Where is the “public” community that you specified when configuring SNMP,, “IPserver ” - is the IP address of the server with UPS
We will get a response with the name:

Code: Select all

"Smart-UPS 3000"

Now creating in Domoticz 1 virtual switch and several sensors (3 for voltage, 2 for %, 1 text and 1 temperature)
The script itself is created here:
UPS_APC.sh in the /domoticz/scripts/ folder
script

#!/bin/bash

Code: Select all

# Settings
UPSIP="192.x.x.x"                   # UPS (SNMP server) IP Address
PASSWORD="public"                   # SNMP Password
DOMO_IP="192.x.x.x"                # Domoticz IP Address
DOMO_PORT="8080"                    # Domoticz Port

# Monitoring parameters
UPS_IDX="53"                                   # UPS Switch IDX (ON/OFF State)
upsAdvInputLineVoltage_IDX="50"                # APC UPS Input Voltage (V AC)
upsAdvBatteryTemperature_IDX="52"              # APC UPS Internal Temperature (C)
upsAdvBatteryCapacity_IDX="54"                 # APC UPS Battery Capacity (%)
upsAdvBatteryRunTimeRemaining_IDX="55"         # APC UPS Battery Runtime Remaining (TimeTicks)
upsAdvBatteryActualVoltage_IDX="56"            # APC UPS Battery Voltage (V DC)
upsAdvOutputLoad_IDX="57"                      # APC UPS Output Load (%) VA
upsAdvOutputVoltage_IDX="58"                   # APC UPS Output Voltage (V AC)
 
# Check if UPS in online 
PINGTIME=`ping -c 1 -q $UPSIP | awk -F"/" '{print $5}' | xargs`
echo $PINGTIME
if expr "$PINGTIME" '>' 0
then

    curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=devices&rid=$UPS_IDX" | grep "Status" | grep "On" > /dev/null
    if [ $? -eq 0 ] ; then
        echo "UPS already ON"
    else
        echo "UPS ON"
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=switchlight&idx=$UPS_IDX&switchcmd=On"
    fi
    
    # UPS Input Voltage (V AC)
    UPSInVolt=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.3.2.1.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvInputLineVoltage_IDX&nvalue=0&svalue=$UPSInVolt"

    # UPS Battery Temperature 
    UPSBattemp=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.2.2.2.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvBatteryTemperature_IDX&nvalue=0&svalue=$UPSBattemp"

    # UPS Battery Capacity (%)
    UPSBatCapst=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.2.2.1.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvBatteryCapacity_IDX&nvalue=0&svalue=$UPSBatCapst"

    # UPS Battery Runtime Remaining (TimeTicks)
    UPSTimeRem=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.2.2.3.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvBatteryRunTimeRemaining_IDX&nvalue=0&svalue=$UPSTimeRem"

    # UPS Battery Voltage (V DC)
    UPSBatVolt=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.2.2.8.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvBatteryActualVoltage_IDX&nvalue=0&svalue=$UPSBatVolt"

    # UPS Output Load (%) VA
    UPSOutLoad=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.4.2.3.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvOutputLoad_IDX&nvalue=0&svalue=$UPSOutLoad"

    # UPS Output Voltage (V AC)
    UPSOutVolt=`snmpget -v 1 -c $PASSWORD -O qv $UPSIP 1.3.6.1.4.1.318.1.1.1.4.2.1.0`
    # Send data
    curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=udevice&idx=$upsAdvOutputVoltage_IDX&nvalue=0&svalue=$UPSOutVolt"


else
    
    curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=devices&rid=$UPS_IDX" | grep "Status" | grep "Off" > /dev/null
    if [ $? -eq 0 ] ; then
        echo "UPS already OFF"
    else
        echo "UPS OFF"
        # Send data
        curl -s -i -H "Accept: application/json" "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command&param=switchlight&idx=$UPS_IDX&switchcmd=Off"
    fi
fi

In the script IP addresses and identifiers (№ IDX) replace with your own.
If Domoticz is password protected, you need to add 2 variables:

Code: Select all

DOMO_LOGIN="yourusername"
DOMO_PASS="yourpassword"
And change the link in the request to this view:

Code: Select all

http://$DOMO_LOGIN:$DOMO_PASS@$DOMO_IP:$DOMO_PORT 
Instead:

Code: Select all

 http://$DOMO_IP:$DOMO_PORT

Making the script executable:
In the folder with the script type:

Code: Select all

 sudo chmod +x UPS_APC.sh
Run to check:

Code: Select all

 ./UPS_APC.sh
Configure the scheduler

Code: Select all

 crontab -e
Updating once a minute:

Code: Select all

 */1 * * * * /home/pi/domoticz/scripts/UPS_APC.sh
Done!
image3.png

p.s. sorry for my english :roll:

Re: APC UPS Monitoring

Posted: Sunday 16 December 2018 20:47
by dzjr
Hello everybody;

I also have an APC UPS for my domoticz server, and I manage to read the data from the UPS in domoticz.

Only I have two problems; 1; if I run the script with

Code: Select all

~/domoticz/scripts $ ./readapc.sh
, then I get as output:

Code: Select all

curl: (7) Failed to connect to 12.0 port 80: Verbinding is verlopen
this is the content of readapc.sh

Code: Select all


#!/bin/bash
#Script to grab APC status and update domoticz vars

SERVER='127.0.0.1:8080/'
SERVER_CMD='json.htm?type=command&param=udevice&'
SWITCH_CMD='json.htm?type=command&param=switchlight&'
cap_data=`apcaccess status`

#apc_total = "apcaccess status"

#echo "$cap_data"

apc_stat=`awk '/STATUS / {print $3}' <<< "$cap_data"`
apc_volts=`awk '/LINEV / {print $3}' <<< "$cap_data"`
apc_load=`awk '/LOADPCT / {print $3}' <<< "$cap_data"`
apc_bcharge=`awk '/BCHARGE / {print $3}' <<< "$cap_data"`
apc_batt=`awk '/BATTV / {print $3}' <<< "$cap_data"`



#echo $apc_stat
#echo $apc_volts
#echo $apc_load
#echo $apc_bcharge
#echo $apc_batt

hostcmd="http://${SERVER}${SERVER_CMD}idx=171&nvalue=0&svalue=${apc_volts}"
curlres=`curl -sS $hostcmd`
hostcmd="http://${SERVER}${SERVER_CMD}idx=174&nvalue=0&svalue=${apc_load}"
curlres=`curl -sS $hostcmd`
hostcmd="http://${SERVER}${SERVER_CMD}idx=175&nvalue=0&svalue=${apc_bcharge}"
curlres=`curl -sS $hostcmd`
hostcmd="http://${SERVER}${SERVER_CMD}idx=173&nvalue=0&svalue=${apc_batt}"
curlres=`curl -sS $hostcmd`


if  [ "$apc_stat" = "ONLINE" ]; then
#echo "APC SYSTEM IS ONLINE"
hostcmd="http://${SERVER}${SWITCH_CMD}idx=178&switchcmd=On&level=0"
curlres=`curl -sS $hostcmd`

else
#echo "APC SYSTEM IS OFFLINE"
hostcmd="http://${SERVER}${SWITCH_CMD}idx=178&switchcmd=Off&level=0"
curlres=`curl -sS $hostcmd`

fi


2; I have tried to create the crontab, only I do not know where to make it, and what the exact content should be, I found a crontab in " /etc/crontab " and modified it, only then will the data be not updated in domoticz, in apcupsd i get the actual reading.

Can someone help me with this?

Re: APC UPS Monitoring

Posted: Sunday 23 December 2018 14:55
by dzjr
I tried everything but did not get it through the script.

Now I have used the Phyton from @rene, just on the PI, and that works!
I start it up via a separate script that is started by crontab when starting the PI.

Sometimes the script stops, but I've only seen it once!

Re: APC UPS Monitoring

Posted: Sunday 13 January 2019 19:46
by kimhav
How is the monitoring of the apcupsd working out on your side; asking since I'm looking at adding similar statistics gathering to Domoticz; so curious how it's working out?

Re: APC UPS Monitoring

Posted: Monday 14 January 2019 21:08
by dzjr
kimhav wrote: Sunday 13 January 2019 19:46 How is the monitoring of the apcupsd working out on your side; asking since I'm looking at adding similar statistics gathering to Domoticz; so curious how it's working out?
for me it is working fine, but only with the Python script, i read the input voltage, Battery voltage, load %, Charge %, and online/battery state.

The only thing i have to figure out is how ik can adjust APCUPSD to restart when the battery is charged for 25% or more.

Re: APC UPS Monitoring

Posted: Wednesday 06 February 2019 17:54
by sach
Python script works for me, but how do i get it to run automatically when the server starts?

Any chance of this becoming a Python Plugin?

Re: APC UPS Monitoring

Posted: Friday 20 September 2019 21:48
by f14driver
I created a simple script to test the connection when the pi boots.

Explanation of the script:
The first command halts the process apcupsd
The second command tests the configuration of your apcupsconfig file located at /etc/apcupsd/apcupsd.conf
The third command lets the system wait for 5 seconds to complet the test.
The fourth command enables the process apcupsd again.


The script is called apcautotest.sh
Step 1
create the script in the directory /domoticz/scripts/
touch apcautotest.sh

It's a bash script that you will have to create;

Step 2
copy the lines underneath into the script:

#!/bin/bash

sudo systemctl stop apcupsd
sudo apctest
sleep 5
sudo systemctl start apcupsd

Step 3
Save the script.

Step 4
Make the script executable:
chmod +x apcautotest.sh

Step 5 test the script:
from the /domoticz/scripts directory
sudo ./apcautotest.sh

After that the proces is automaticly running and the apcaccess status command wil give you a full printout of the APC ups
Without doing the apctest command it will give you a shortend version (ommiting for instance wheter or not the UPS Is online).

Step 6
Add the script to /etc/rc.local:

sudo /home/pi/domoticz/scripts/apcautotest.sh

step 7 reboot the Pi and check if you get a full printout from the APC UPS:
apcaccess status
If this is the case it will run the script every time on boot of the Pi.

Re: APC UPS Monitoring

Posted: Wednesday 10 June 2020 18:52
by erem
you can put a cron entry like this

@reboot /path/to/shell.script

make sure script is executable

Re: APC UPS Monitoring

Posted: Wednesday 05 January 2022 17:57
by jgaalen
I've made a domoticz plugin for the APC UPS monitoring. It can be found here: https://github.com/jgaalen/domoticz-apc-ups-plugin

Also, here's a dzVents script that I use to alert myself when it starts running on battery:

Code: Select all

return {
	on = {
		devices = {
			'APC - Status'
		}
	},
	execute = function(domoticz, device)

        lastValue = domoticz.variables('lastApcStatus').value
        
        if (device.text == 'ONBATT' and lastValue == 'ONLINE') then
            domoticz.notify('Power failure! Server running on battery now!' ) 
        end
        
        if (device.text == 'ONLINE' and lastValue == 'ONBATT') then
            domoticz.notify('Power back online! Server running on net power now!' ) 
        end
        
        
        if (device.text ~= lastValue) then
            domoticz.variables('lastApcStatus').set(device.text)
        end

	end
}

Re: APC UPS Monitoring

Posted: Wednesday 05 January 2022 18:31
by user4563
Thank you. I'm already using apcupsd so I'll have to try this for the Domoticz integration

Re: APC UPS Monitoring

Posted: Tuesday 11 January 2022 23:06
by Hiero
jgaalen wrote: Wednesday 05 January 2022 17:57 I've made a domoticz plugin for the APC UPS monitoring. It can be found here: https://github.com/jgaalen/domoticz-apc-ups-plugin

Also, here's a dzVents script that I use to alert myself when it starts running on battery:

Code: Select all

return {
	on = {
		devices = {
			'APC - Status'
		}
	},
	execute = function(domoticz, device)

        lastValue = domoticz.variables('lastApcStatus').value
        
        if (device.text == 'ONBATT' and lastValue == 'ONLINE') then
            domoticz.notify('Power failure! Server running on battery now!' ) 
        end
        
        if (device.text == 'ONLINE' and lastValue == 'ONBATT') then
            domoticz.notify('Power back online! Server running on net power now!' ) 
        end
        
        
        if (device.text ~= lastValue) then
            domoticz.variables('lastApcStatus').set(device.text)
        end

	end
}
Your plugin works like a charm! couple of minutes and it was running. Thanks :)

Re: APC UPS Monitoring

Posted: Thursday 19 May 2022 22:09
by madpatrick
Nice plugin. Good job

Re: APC UPS Monitoring

Posted: Monday 18 July 2022 10:50
by Darkneo
Hi there,

Just adding my2cents there. I am using the dedicated plugin to monitor my UPS connected to my Domoticz through USB since years now, and have no issues (viewtopic.php?t=18154)

Nothing special, everything is well explained and documented and working properly.

On my side, I added an CM180+ sensor, that gives me my real time consumption for my house .

Just a tricky thing: the CM180 only gives the current, thus I made a custom event to translate it to real power consumption:

Code: Select all

local idx = 96 --idx of device virtual to show power consumption
local cm180 = 'Wattmeter' --name of the CM180+ sensor preventing issue if IDX changes
local tension = otherdevices['EDF Voltage'] --Voltage taken from the UPS devices using its name to prevent issues if IDX changes
function round(num, dec)
   if num == 0 then
	 return 0
   else
	 local mult = 10^(dec or 2)
	 return math.floor(num * mult + 0.5) / mult
   end
end

commandArray = {}


if (devicechanged[cm180]) then
    --Computing current
    --print('Valeur '..otherdevices[cm180])
    p1, p2 = string.match(otherdevices_svalues[cm180], "(%d+.%d*);(%d+.%d*)")
    --on les transforme en Ampere
	intensite = p1 / tension
	--0.01 precision only
	intensite = round(intensite, 2)
	commandArray[#commandArray+1]={['UpdateDevice'] = idx..'|0|'..intensite} ---- updating power dummy sensor
end
return commandArray

Re: APC UPS Monitoring

Posted: Monday 26 December 2022 17:23
by JanAtHome
Hello all
Just installed an APC ups, a BE550G-GR, this is a simple ups without network connection, on the PC it works with PowerChute version-3.0.2 and a USB cable is present.
Now I have tried to install it in domoticz via the Plugin (discussed above above) but this does not work because there is no network connection. My question Can I adjust this plugin, or should I use the separate script that has already been discussed.
Please respond what to do.
Jan

Hallo Allemaal
Heb net een APC ups geinstalleerd, een BE550G-GR, dit is een eenvoudige ups zonder netwerk aansluiting, op de pc werkt deze wel met PowerChute versie-3.0.2 en er is een USB kabel aanwezig.
Nu heb ik deze geprobeerd in domoticz te installeren via de Plugin (jgaalen boven eerder besproken) maar dit werkt niet omdat er geen netwerk aansluiting is. Mijn vraag Kan ik deze plugin aanpassen, of kan ik beter de losse script gebruiken die ook al besproken is.
Gaarne respons wat to do.
Jan

Re: APC UPS Monitoring

Posted: Saturday 06 January 2024 12:30
by kimhav
JanAtHome wrote: Monday 26 December 2022 17:23Just installed an APC ups, a BE550G-GR, this is a simple ups without network connection, on the PC it works with PowerChute version-3.0.2 and a USB cable is present.
Now I have tried to install it in domoticz via the Plugin (discussed above above) but this does not work because there is no network connection. My question Can I adjust this plugin, or should I use the separate script that has already been discussed.
Please respond what to do.
Hi Jan,
See that this is an old posting and don't sure whether you got it to work or not, but the Domoticz plugin requires that 1) that the APC UPS is connected to the host using the USB-cable that came along to the system that you're running your Domoticz installation on, and 2) that you have apcupsd installed as the script is making use of the command 'apcaccess' to retrieve the data from the APC UPS.

Re: APC UPS Monitoring

Posted: Saturday 06 January 2024 12:41
by madpatrick
You can use the plugin on a different system as your UPS is connected.
The only thing is you need to install apcupsd on the system where the uPS is connected and your domoticz system
On your domoticz system the chane the config file apcupsd.conf with the following parametesrs

Code: Select all

UPSCABLE ether
DEVICE 192.168.1.1:3551
192.168.1.1 is the IP of the system with UPS connected

I think you can also put in Domoticz hardware setup the IP of the host instead of local IP
Then you don't have to install APCUPSD