Merge pull request #6155 from ukleinek/humidity

luci-app-statistics: Generate graphs for humidity sensors
This commit is contained in:
Jo-Philipp Wich 2023-01-16 11:19:20 +01:00 committed by GitHub
commit 13903dc997
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 13 deletions

View file

@ -7,7 +7,11 @@ return baseclass.extend({
title: _('Sensors'),
rrdargs: function(graph, host, plugin, plugin_instance, dtype) {
return {
var rv = [];
var types = graph.dataTypes(host, plugin, plugin_instance);
if (types.indexOf('temperature') > -1) {
rv.push({
per_instance: true,
title: "%H: %pi - %di",
vlabel: "\xb0C",
@ -21,6 +25,26 @@ return baseclass.extend({
}
}
}
};
});
}
if (types.indexOf('humidity') > -1) {
rv.push({
per_instance: true,
title: "%H: %pi - %di",
vlabel: "%RH",
number_format: "%4.1lf %%RH",
data: {
types: [ "humidity" ],
options: {
humidity__value: {
color: "0000ff",
title: "Humidity"
}
}
}
});
}
return rv;
}
});

View file

@ -8,6 +8,7 @@ var sensorTypes = [
/^(?:ain|in|vccp|vdd|vid|vin|volt|voltbatt|vrm)[0-9]*$/, 'voltage',
/^(?:cpu_temp|remote_temp|temp)[0-9]*$/, 'temperature',
/^(?:fan)[0-9]*$/, 'fanspeed',
/^(?:humidity)[0-9]*$/, 'humidity',
/^(?:power)[0-9]*$/, 'power'
];