Merge pull request #6536 from c-spiess/app-statistics-missing-sensors

luci-app-statistics: missing sensor types added
This commit is contained in:
Jo-Philipp Wich 2023-08-23 14:27:20 +02:00 committed by GitHub
commit 727c0895a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 0 deletions

View file

@ -44,6 +44,74 @@ return baseclass.extend({
}
});
}
if (types.indexOf('voltage') > -1) {
rv.push({
per_instance: true,
title: "%H: %pi - %di",
vlabel: "V",
number_format: "%4.1lf V",
data: {
types: [ "voltage" ],
options: {
voltage__value: {
color: "0000ff",
title: "Voltage"
}
}
}
});
}
if (types.indexOf('current') > -1) {
rv.push({
per_instance: true,
title: "%H: %pi - %di",
vlabel: "A",
number_format: "%4.1lf A",
data: {
types: [ "current" ],
options: {
current__value: {
color: "00ff00",
title: "Current"
}
}
}
});
}
if (types.indexOf('power') > -1) {
rv.push({
per_instance: true,
title: "%H: %pi - %di",
vlabel: "W",
number_format: "%4.1lf W",
data: {
types: [ "power" ],
options: {
power__value: {
color: "ff0000",
title: "Power"
}
}
}
});
}
if (types.indexOf('fanspeed') > -1) {
rv.push({
per_instance: true,
title: "%H: %pi - %di",
vlabel: "rpm",
number_format: "%4lf rpm",
data: {
types: [ "fanspeed" ],
options: {
fanspeed__value: {
color: "0000ff",
title: "Fan speed"
}
}
}
});
}
return rv;
}

View file

@ -9,6 +9,7 @@ var sensorTypes = [
/^(?:cpu_temp|remote_temp|temp)[0-9]*$/, 'temperature',
/^(?:fan)[0-9]*$/, 'fanspeed',
/^(?:humidity)[0-9]*$/, 'humidity',
/^(?:curr)[0-9]*$/, 'current',
/^(?:power)[0-9]*$/, 'power'
];