I think as long as the APC UPS has a usb connection probably not. That would exclude some of the really small ones, but other then that any regular retail one should work. I think the ones I test on are like a 1300 kva and a 1500kva which aren't small but certainly nothing special either.
They are also close to 10 years old now.
The pallet in Node-Red I use is "node-red-contrib-apcaccess"
Below is the flow I setup in Node-Red
[{"id":"cd80d9d7c33771f4","type":"tab","label":"APC Status","disabled":false,"info":""},{"id":"3e889802411b9ba9","type":"apcrequest","z":"cd80d9d7c33771f4","name":"APC UPS on Unraid Server","server":"aded31d5.a078","x":160,"y":180,"wires":[["df7971a05250eaa1","bf7938e44cc3628f","8c34f301018c4cc4","0ae6e16126347dcc","0496ab40929b11e1","073eeed1dc8b7978","cc19b6d0d91695e5"]]},{"id":"35d783b4117ee6ec","type":"inject","z":"cd80d9d7c33771f4","name":"","props":[{"p":"payload"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"statusJson","payloadType":"str","x":130,"y":40,"wires":[["3e889802411b9ba9"]]},{"id":"acc99fc218e6fb2e","type":"debug","z":"cd80d9d7c33771f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":140,"wires":[]},{"id":"35880977ed8dd157","type":"hubitat command","z":"cd80d9d7c33771f4","deviceLabel":"Unraid Battery Backup","name":"","server":"37a6fe31.441bc2","deviceId":"1108","command":"","commandArgs":"","x":840,"y":140,"wires":[["acc99fc218e6fb2e"]]},{"id":"df7971a05250eaa1","type":"change","z":"cd80d9d7c33771f4","name":"Battery Charge Status","rules":[{"t":"set","p":"command","pt":"msg","to":"battery","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$number($split(payload.BCHARGE, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":80,"wires":[["5be35f9c1b996a52"]]},{"id":"bf7938e44cc3628f","type":"change","z":"cd80d9d7c33771f4","name":"Last Event Change","rules":[{"t":"set","p":"command","pt":"msg","to":"lastEvent","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.LASTXFER","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":120,"wires":[["e20d24728ce50385"]]},{"id":"8c34f301018c4cc4","type":"change","z":"cd80d9d7c33771f4","name":"UPS status Change","rules":[{"t":"set","p":"command","pt":"msg","to":"status","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.STATUS","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":160,"wires":[["b0c5c3539ff62255"]]},{"id":"24a464574030b971","type":"apcrequest","z":"cd80d9d7c33771f4","d":true,"name":"APC UPS on Argon ONE","server":"13fe8d9c.10e232","x":150,"y":500,"wires":[["b934cd78ab3c8535","0afb17be975c4432","ae4351e5b332d954","533b9748e52f825f","ccdf0e35fdf1c489","5fb8cfa6a8a78f75","9723a7bfd47c8ac2"]]},{"id":"2f2c26ae052cbaaa","type":"debug","z":"cd80d9d7c33771f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1010,"y":480,"wires":[]},{"id":"e241399d1a6f86c4","type":"hubitat command","z":"cd80d9d7c33771f4","deviceLabel":"UPS Argon One","name":"","server":"90e35fad.e75c1","deviceId":"55","command":"","commandArgs":"payload","x":820,"y":480,"wires":[["2f2c26ae052cbaaa"]]},{"id":"b934cd78ab3c8535","type":"change","z":"cd80d9d7c33771f4","name":"Battery Charge Status","rules":[{"t":"set","p":"command","pt":"msg","to":"battery","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$number($split(payload.BCHARGE, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":380,"wires":[["4b4f91506bd976fd"]]},{"id":"0afb17be975c4432","type":"change","z":"cd80d9d7c33771f4","name":"Last Event Change","rules":[{"t":"set","p":"command","pt":"msg","to":"lastEvent","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.LASTXFER","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":420,"wires":[["5bddc7f11a23a043"]]},{"id":"ae4351e5b332d954","type":"change","z":"cd80d9d7c33771f4","name":"UPS status Change","rules":[{"t":"set","p":"command","pt":"msg","to":"status","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.STATUS","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":460,"wires":[["b45d8aa70185368b"]]},{"id":"5be35f9c1b996a52","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":80,"wires":[["35880977ed8dd157"]]},{"id":"b0c5c3539ff62255","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":160,"wires":[["35880977ed8dd157"]]},{"id":"e20d24728ce50385","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":120,"wires":[["35880977ed8dd157"]]},{"id":"4b4f91506bd976fd","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":380,"wires":[["e241399d1a6f86c4"]]},{"id":"5bddc7f11a23a043","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":420,"wires":[["e241399d1a6f86c4"]]},{"id":"b45d8aa70185368b","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":460,"wires":[["e241399d1a6f86c4"]]},{"id":"0ae6e16126347dcc","type":"change","z":"cd80d9d7c33771f4","name":"Current Time on Battery","rules":[{"t":"set","p":"command","pt":"msg","to":"lifetimeOnBattery","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$number($split(payload.TONBATT, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":200,"wires":[["263e5eec28422949"]]},{"id":"263e5eec28422949","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":200,"wires":[["35880977ed8dd157"]]},{"id":"0496ab40929b11e1","type":"change","z":"cd80d9d7c33771f4","name":"Transfer to battery","rules":[{"t":"set","p":"command","pt":"msg","to":"lastPowerFail","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.XONBATT","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":240,"wires":[["109307b195c83db2"]]},{"id":"109307b195c83db2","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":240,"wires":[["35880977ed8dd157"]]},{"id":"61ddc36d46522287","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":280,"wires":[["35880977ed8dd157"]]},{"id":"073eeed1dc8b7978","type":"change","z":"cd80d9d7c33771f4","name":"Transfer to Mains Power","rules":[{"t":"set","p":"command","pt":"msg","to":"lastPowerRestore","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.XOFFBATT","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":280,"wires":[["61ddc36d46522287"]]},{"id":"533b9748e52f825f","type":"change","z":"cd80d9d7c33771f4","name":"Current Time on Battery","rules":[{"t":"set","p":"command","pt":"msg","to":"lifetimeOnBattery","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$number($split(payload.TONBATT, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":500,"wires":[["3f87720b687ce199"]]},{"id":"3f87720b687ce199","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":500,"wires":[["e241399d1a6f86c4"]]},{"id":"ccdf0e35fdf1c489","type":"change","z":"cd80d9d7c33771f4","name":"Transfer to battery","rules":[{"t":"set","p":"command","pt":"msg","to":"lastPowerFail","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.XONBATT","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":540,"wires":[["032756c326d314ea"]]},{"id":"032756c326d314ea","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":540,"wires":[["e241399d1a6f86c4"]]},{"id":"bc613a8e8379e7ec","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":580,"wires":[["e241399d1a6f86c4"]]},{"id":"5fb8cfa6a8a78f75","type":"change","z":"cd80d9d7c33771f4","name":"Transfer to Mains Power","rules":[{"t":"set","p":"command","pt":"msg","to":"lastPowerRestore","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"payload.XOFFBATT","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":580,"wires":[["bc613a8e8379e7ec"]]},{"id":"b0b78c85eebdce70","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":320,"wires":[["35880977ed8dd157"]]},{"id":"cc19b6d0d91695e5","type":"change","z":"cd80d9d7c33771f4","name":"Current Battery Voltage","rules":[{"t":"set","p":"command","pt":"msg","to":"batteryVoltage","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$number($split(payload.BATTV, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":320,"wires":[["b0b78c85eebdce70"]]},{"id":"6fe3d51cb43dbdc4","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"arguments","x":630,"y":620,"wires":[["e241399d1a6f86c4"]]},{"id":"9723a7bfd47c8ac2","type":"change","z":"cd80d9d7c33771f4","name":"Current Battery Voltage","rules":[{"t":"set","p":"command","pt":"msg","to":"batteryVoltage","tot":"str"},{"t":"set","p":"arguments","pt":"msg","to":"$number($split(payload.BATTV, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":620,"wires":[["6fe3d51cb43dbdc4"]]},{"id":"cceb0680fef5a58a","type":"debug","z":"cd80d9d7c33771f4","name":"Unraid Server Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1040,"y":880,"wires":[]},{"id":"d27cda191dab4cdd","type":"change","z":"cd80d9d7c33771f4","name":"UPS Load Level","rules":[{"t":"set","p":"topic","pt":"msg","to":"1","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$number($split(payload.LOADPCT, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":840,"wires":[["ce07845e5aa14c47"]]},{"id":"621ebcdd628465c7","type":"change","z":"cd80d9d7c33771f4","name":"Power used","rules":[{"t":"set","p":"topic","pt":"msg","to":"2","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$round((($number($split(payload.LOADPCT, \" \")[0]))/100)*($number($split(payload.NOMPOWER, \" \")[0])), 2)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":880,"wires":[["ce07845e5aa14c47"]]},{"id":"079e1edc3e62ab4f","type":"change","z":"cd80d9d7c33771f4","name":"Time Left on Battery","rules":[{"t":"set","p":"topic","pt":"msg","to":"3","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$number($split(payload.TIMELEFT, \" \")[0])","tot":"jsonata"},{"t":"set","p":"complete","pt":"msg","to":"end","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":920,"wires":[["ce07845e5aa14c47"]]},{"id":"ce07845e5aa14c47","type":"join","z":"cd80d9d7c33771f4","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":630,"y":860,"wires":[["8a4c910def7c4d46"]]},{"id":"8a4c910def7c4d46","type":"change","z":"cd80d9d7c33771f4","name":"","rules":[{"t":"set","p":"arguments","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"command","pt":"msg","to":"update","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":860,"wires":[["4edfd380fbbb0675"]]},{"id":"cb4d42bab094884b","type":"hubitat command","z":"cd80d9d7c33771f4","deviceLabel":"Unraid Battery Backup","name":"","server":"37a6fe31.441bc2","deviceId":"1108","command":"","commandArgs":"","x":860,"y":900,"wires":[["cceb0680fef5a58a"]]},{"id":"4edfd380fbbb0675","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":670,"y":900,"wires":[["cb4d42bab094884b"]]},{"id":"59777eb234cbfdf9","type":"debug","z":"cd80d9d7c33771f4","name":"Argon One Debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1050,"y":760,"wires":[]},{"id":"ab85855887f94375","type":"change","z":"cd80d9d7c33771f4","name":"UPS Load Level","rules":[{"t":"set","p":"topic","pt":"msg","to":"1","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$number($split(payload.LOADPCT, \" \")[0])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":720,"wires":[["db0dd73ecf334c4a"]]},{"id":"8566f5776aadd55a","type":"change","z":"cd80d9d7c33771f4","name":"Power used","rules":[{"t":"set","p":"topic","pt":"msg","to":"2","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$round((($number($split(payload.LOADPCT, \" \")[0]))/100)*($number($split(payload.NOMPOWER, \" \")[0])), 2)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":760,"wires":[["db0dd73ecf334c4a"]]},{"id":"8506a8f6404c6d1b","type":"change","z":"cd80d9d7c33771f4","name":"Time Left on Battery","rules":[{"t":"set","p":"topic","pt":"msg","to":"3","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"$number($split(payload.TIMELEFT, \" \")[0])","tot":"jsonata"},{"t":"set","p":"complete","pt":"msg","to":"end","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":800,"wires":[["db0dd73ecf334c4a"]]},{"id":"db0dd73ecf334c4a","type":"join","z":"cd80d9d7c33771f4","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":630,"y":740,"wires":[["7ce09c62c1f21028"]]},{"id":"7ce09c62c1f21028","type":"change","z":"cd80d9d7c33771f4","name":"","rules":[{"t":"set","p":"arguments","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"command","pt":"msg","to":"update","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":740,"wires":[["df47ba08b0772dcb"]]},{"id":"19674e807c34bcfb","type":"hubitat command","z":"cd80d9d7c33771f4","deviceLabel":"Unraid Battery Backup","name":"","server":"37a6fe31.441bc2","deviceId":"1108","command":"","commandArgs":"","x":860,"y":780,"wires":[["59777eb234cbfdf9"]]},{"id":"df47ba08b0772dcb","type":"rbe","z":"cd80d9d7c33771f4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":670,"y":780,"wires":[["19674e807c34bcfb"]]},{"id":"e607f589ea71e5d5","type":"inject","z":"cd80d9d7c33771f4","name":"","props":[{"p":"payload"}],"repeat":"60","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"statusJson","payloadType":"str","x":110,"y":680,"wires":[["15fa64c669d3d5f7","c37736e7e24a6152"]]},{"id":"c37736e7e24a6152","type":"apcrequest","z":"cd80d9d7c33771f4","name":"APC UPS on Unraid Server","server":"aded31d5.a078","x":160,"y":880,"wires":[["d27cda191dab4cdd","621ebcdd628465c7","079e1edc3e62ab4f"]]},{"id":"15fa64c669d3d5f7","type":"apcrequest","z":"cd80d9d7c33771f4","d":true,"name":"APC UPS on Argon ONE","server":"13fe8d9c.10e232","x":170,"y":760,"wires":[["ab85855887f94375","8566f5776aadd55a","8506a8f6404c6d1b"]]},{"id":"aded31d5.a078","type":"apcconfig","name":"Unraid","host":"192.168.86.10","port":"3551"},{"id":"37a6fe31.441bc2","type":"hubitat config","name":"Main Hub","usetls":false,"host":"192.168.86.35","port":"80","appId":"563","nodeRedServer":"http://192.168.86.10:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#ace043"},{"id":"13fe8d9c.10e232","type":"apcconfig","d":true,"name":"APC UPS on Argon One","host":"192.168.86.18","port":"3551"},{"id":"90e35fad.e75c1","type":"hubitat config","name":"HubitatC4","usetls":false,"host":"192.168.86.47","port":"80","appId":"6","nodeRedServer":"http://node-red:1880","webhookPath":"/hubitat/c4webhook_","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#ace043"}]
Below here is the code for the Virtual UPS device driver
/**
* Virtual UPS to recieve commands from Node-red
*
* Copyright 2016
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
import groovy.json.JsonSlurper
metadata
{
definition (name: "Virtual UPS", namespace: "mavrrick", author: "Mavrrick")
{
capability "Battery"
capability "Voltage Measurement"
capability "Power Source"
capability "Power Meter"
// capability "Timed Session"
capability "Refresh"
attribute "loadPercent", "number"
attribute "model", "string"
attribute "serial", "string"
attribute "upsStatus", "string"
attribute "batteryVoltage", "number"
attribute "loadPercent", "number"
attribute "timeOnBattery", "number"
attribute "lifetimeOnBattery", "string"
attribute "lowTransVolts", "string"
attribute "highTransVolts", "string"
attribute "nomPower", "string"
attribute "sensitivity", "string"
attribute "lastUpdate", "string"
attribute "batteryDate", "string"
attribute "lastPowerFail", "string"
attribute "lastPowerRestore", "string"
attribute "lastPowerFailReason", "string"
attribute "batteryRuntime", "string"
attribute "lastEvent", "string"
attribute "battery", 'NUMBER'
command "status", [[name: 'Status data of UPS', type: 'STRING']]
command "battery", [[name: "Battery Level", type: "NUMBER", description: "Battery Percent full(0 to 100)"]]
command "loadPercent", [[name: "Percent Load of UPS", type: "NUMBER", description: "Load Capacity of UPS"]]
command "lastEvent", [[name: "Last Event ", type: "STRING", description: "What occured at last event"]]
command "lastPowerFail", [[name: "Transfer to Battery ", type: "STRING", description: "What occured at last event"]]
command "lastPowerRestore", [[name: "Transfer to Main Power ", type: "STRING", description: "What occured at last event"]]
command "power", [[name: "Power Used", type: "NUMBER", description: "Watts currently consumed"]]
command "timeOnBattery", [[name: "Battery runtime left", type: "NUMBER", description: "Time left to run on Battery"]]
command "lifetimeOnBattery", [[name: "Current time on battery", type: "NUMBER", description: "Current time on battery"]]
command "batteryVoltage", [[name: "Current battery voltage", type: "NUMBER", description: "Current battery Voltage"]]
/* command "update", [[name: "Battery runtime left", type: "NUMBER", description: "Time left to run on Battery"],
[name: "Battery Level", type: "NUMBER", description: "Battery Percent full(0 to 100)"],
[name: "Percent Load of UPS", type: "NUMBER", description: "Load Capacity of UPS"],
[name: "Transfer to Battery ", type: "STRING", description: "What occured at last event"],
[name: 'Status data of UPS', type: 'STRING'],
[name: "Power Used", type: "NUMBER", description: "Watts currently consumed"],
[name: "Current time on battery", type: "NUMBER", description: "Current time on battery"],
[name: "Transfer to Battery ", type: "STRING", description: "What occured at last event"],
[name: "Transfer to Main Power ", type: "STRING", description: "What occured at last event"],
[name: "Current battery voltage", type: "NUMBER", description: "Current battery Voltage"]] */
command "update", [[name: "Percent Load of UPS", type: "NUMBER", description: "Load Capacity of UPS"],
[name: "Power Used", type: "NUMBER", description: "Watts currently consumed"],
[name: "Battery runtime left", type: "NUMBER", description: "Time left to run on Battery"]]
}
preferences
{
/* section("Device")
{
input("ip", "string", title:"IP Address of apcupsd host system (Windows computer)", defaultValue: "192.168.nnn.nnn" ,required: true)
input("port", "number", title:"Port Number used by optional Windows EventGhost web server", defaultValue: 80, range: 1..65535, required: true)
}
section
{
input "prefEventGhost", "bool", required: true, defaultValue: false,
title: "ON: EventGhost is installed on Windows, enables commands Refresh and rebootWindows, and optional Hub controlled statistics updates<br />OFF (Default): Use Windows Task Scheduler for statistics, Refresh command disabled"
if (prefEventGhost)
input("prefRefreshMinutes", "number", title:"EventGhost update time in minutes, zero disables EventGhost updates, however Refresh is active. When using Windows Scheduler for updates, set to 0", defaultValue: 5, range: 0..20, required: true)
} */
section
{
input "enableDebug", "bool", title: "Enables debug logging for 30 minutes", defaultValue: false, required: false
}
}
}
def installed()
{
log.info "UPS Virtual Driver is loaded. Waiting for updates from Node Red"
settingsInitialize()
refresh()
}
def updated()
{
log.info "UPS Virtual Driver is loaded. Waiting for updates from Node Red"
settingsInitialize()
refresh()
}
def settingsInitialize()
{
unschedule()
if (enableDebug)
{
log.info "Verbose logging has been enabled for the next 30 minutes."
runIn(1800, logsOff)
}
}
// runs when HUB boots, starting the device refresh cycle, if any
void initialize()
{
log.info "UPS Virtual Drivers is restarting"
refresh()
}
/*
Set battery level
*/
def battery(parm){
sendEvent(name: "battery", value: parm)
}
/*
/*
Set UPS Load level
*/
def loadPercent(parm){
sendEvent(name: "loadPercent", value: parm)
}
/*
/*
Set Last Event
*/
def lastEvent(parm){
sendEvent(name: "lastEvent", value: parm)
}
/*
/*
Set Status of UPS Device
*/
def status(parm){
sendEvent(name: "upsStatus", value: parm)
}
/*
Set Watts Used
*/
def power(parm){
sendEvent(name: "power", value: parm)
}
/*
Set Time left on Battery
*/
def timeOnBattery(parm){
sendEvent(name: "timeOnBattery", value: parm)
}
/*
Set Time left on Battery
*/
def lifetimeOnBattery(parm){
sendEvent(name: "lifetimeOnBattery", value: parm)
}
/*
Set Time left on Battery
*/
def lastPowerFail(parm){
sendEvent(name: "lastPowerFail", value: parm)
}
/*
Set Time left on Battery
*/
def lastPowerRestore(parm){
sendEvent(name: "lastPowerRestore", value: parm)
}
/*
Set current battery voltage
*/
def batteryVoltage(parm){
sendEvent(name: "batteryVoltage", value: parm)
}
/*
Set current battery voltage
*/
def update( loadPerc, watts, timeOnBat ){
// sendEvent(name: "battery", value: batlevel)
sendEvent(name: "loadPercent", value: loadPerc)
// sendEvent(name: "lastEvent", value: lastEvt)
// sendEvent(name: "upsStatus", value: upsStat)
sendEvent(name: "power", value: watts)
sendEvent(name: "timeOnBattery", value: timeOnBat)
// sendEvent(name: "lifetimeOnBattery", value: lifetimeOnBat)
// sendEvent(name: "lastPowerFail", value: lastPowerF)
// sendEvent(name: "lastPowerRestore", value: lastPowerRest)
// sendEvent(name: "batteryVoltage", value: batteryVolt)
}
/*
logsOff
Disables debug logging.
*/
def logsOff()
{
log.warn "debug logging disabled..."
device.updateSetting("enableDebug", [value:"false",type:"bool"])
}