This is the UPS definition I'm using. It doesn't track all values, only interesting ones. And the load is express as power and not as percentage.
ups_def = { -- Values for my Cyber Power 1500 AVR url = 'bPI.local', port = 3493, -- Server to connect to name = 'onduleur', values = { ['load (watt)'] = { "ups.load", function( clt, ups_name, var) clt:send("GET VAR ".. ups_name .." ups.load\n") local percentage = string.match( clt:receive("*l"), "%d+" ) clt:send("GET VAR ".. ups_name .." ups.realpower.nominal\n") local maxp = string.match( clt:receive("*l"), "%d+" ) return maxp * percentage / 100, tonumber(percentage) > 90 end }, ['battery %'] = { "battery.charge", function( clt, ups_name, var ) clt:send("GET VAR ".. ups_name .." battery.charge\n") local charge = string.match( clt:receive("*l"), "%d+" ) clt:send("GET VAR ".. ups_name .." battery.charge.warning\n") local wrnprc = string.match( clt:receive("*l"), "%d+" ) return charge, tonumber(charge) < tonumber(wrnprc) end }, ['input (volt)'] = { "input.voltage", function( clt, ups_name, var ) clt:send("GET VAR ".. ups_name .." input.voltage\n") local v = tonumber( string.match( clt:receive("*l"), "%d+" ) ) clt:send("GET VAR ".. ups_name .." input.transfer.high\n") local ith = tonumber( string.match( clt:receive("*l"), "%d+" ) ) clt:send("GET VAR ".. ups_name .." input.transfer.low\n") local itl = tonumber( string.match( clt:receive("*l"), "%d+" ) ) return v, v < itl and v > ith end } } }
Log in to post a comment.
This is the UPS definition I'm using. It doesn't track all values, only interesting ones. And the load is express as power and not as percentage.
Last edit: destroyedlolo 2014-10-28