I understand your point, but still it's OpenWrt based, so I think it would be easier to find a solution here than on the "I don't know" kind of answers of GL.iNet forum.
In the meantime I've found a file on /overlay/upper/usr/lib/lua/luci/statistics/rrdtool/definitions
that looks similar to what I want to modify. Here a part of nut.lua
:
module("luci.statistics.rrdtool.definitions.nut",package.seeall)
function rrdargs( graph, plugin, plugin_instance, dtype )
local voltages = {
title = "%H: Voltages on UPS \"%pi\"",
vlabel = "V",
number_format = "%5.1lfV",
data = {
instances = {
voltage = { "battery", "input", "output" }
},
options = {
voltage_output = { color = "00e000", title = "Output voltage", noarea=true, overlay=true },
voltage_battery = { color = "0000ff", title = "Battery voltage", noarea=true, overlay=true },
voltage_input = { color = "ffb000", title = "Input voltage", noarea=true, overlay=true }
}
}
}
And here the equivalent part of the nut.js
I want to backport:
'use strict';
'require baseclass';
return baseclass.extend({
title: _('UPS'),
rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
var definitions = [];
var instances;
function find_instances(dtype, wanted) {
var matching = graph.dataInstances(host, plugin, plugin_instance, dtype).filter(function(instance) {
return wanted.indexOf(instance) > -1;
});
return matching.length ? { [dtype]: matching } : null;
}
if ((instances = find_instances('voltage', [ 'input', 'output' ])) != null) {
definitions.push({
title: "%H: AC voltages on UPS \"%pi\"",
vlabel: "Vac",
y_min: "90",
y_max: "140",
alt_autoscale_max: true,
number_format: "%5.1lfV",
data: {
instances: instances,
options: {
voltage_output : { color: "00e000", title: "Output voltage", noarea: true, overlay: true },
voltage_input : { color: "ffb000", title: "Input voltage", noarea: true, overlay: true }
}
}
});
}
if ((instances = find_instances('voltage', [ 'battery' ])) != null) {
definitions.push({
title: "%H: Battery voltage on UPS \"%pi\"",
vlabel: "Vdc",
y_min: "10",
y_max: "14",
alt_autoscale_max: true,
number_format: "%5.1lfV",
data: {
instances: instances,
options: {
voltage: { color: "0000ff", title: "Battery voltage", noarea: true, overlay: true }
}
}
});
}
I'm not familiar on .lua, so I'm not sure on how to proceed.