mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Correct PowerConsumed SI Units in Overview (#14425)
* Correct PowerConsumed SI Units in Overview Workaround to convert PowerConsumed SI Display Units from kkWh to MWh. Better way would be to directly save the data in Wh instead of kWh. But we don't know the impact jet. * Fix style
This commit is contained in:
@@ -1100,10 +1100,14 @@ function get_sensor_label_color($sensor, $type = 'sensors')
|
||||
|
||||
return "<span class='label $label_style'>" . trim($sensor['sensor_current']) . '</span>';
|
||||
}
|
||||
|
||||
if ($sensor['sensor_class'] == 'frequency' && $sensor['sensor_type'] == 'openwrt') {
|
||||
return "<span class='label $label_style'>" . trim($sensor['sensor_current']) . ' ' . $unit . '</span>';
|
||||
}
|
||||
|
||||
if ($sensor['sensor_class'] == 'power_consumed') {
|
||||
return "<span class='label $label_style'>" . trim(Number::formatSi($sensor['sensor_current'] * 1000, 5, 5, 'Wh')) . '</span>';
|
||||
}
|
||||
if (in_array($sensor['rrd_type'], ['COUNTER', 'DERIVE', 'DCOUNTER', 'DDERIVE'])) {
|
||||
//compute and display an approx rate for this sensor
|
||||
return "<span class='label $label_style'>" . trim(Number::formatSi(max(0, $sensor['sensor_current'] - $sensor['sensor_prev']) / Config::get('rrd.step', 300), 2, 3, $unit)) . '</span>';
|
||||
|
Reference in New Issue
Block a user