mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add kelvin to celcius conversion; as (liquid gas) coolant monitors report in Kelvin. (#15836)
This commit is contained in:
committed by
GitHub
parent
179c6e74c3
commit
f0934b53c5
@@ -735,6 +735,23 @@ function celsius_to_fahrenheit($value, $scale = 'celsius')
|
||||
return sprintf('%.02f', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts kelvin to fahrenheit (with 2 decimal places)
|
||||
* if $scale is not celsius, it assumes celsius and returns the value
|
||||
*
|
||||
* @param float $value
|
||||
* @param string $scale fahrenheit or celsius
|
||||
* @return string (containing a float)
|
||||
*/
|
||||
function kelvin_to_celsius($value, $scale = 'celsius')
|
||||
{
|
||||
if ($scale === 'celsius') {
|
||||
$value = $value - 273.15;
|
||||
}
|
||||
|
||||
return sprintf('%.02f', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts string to float
|
||||
*/
|
||||
|
@@ -67,6 +67,7 @@ if (! (Auth::user()->hasGlobalAdmin())) {
|
||||
<option value=""></option>
|
||||
<option value="celsius_to_fahrenheit">C to F</option>
|
||||
<option value="fahrenheit_to_celsius">F to C</option>
|
||||
<option value="kelvin_to_celsius">K to C</option>
|
||||
<option value="uw_to_dbm">uW to dBm</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@@ -15,6 +15,7 @@ foreach (dbFetchRows('SELECT * FROM `customoids` WHERE `customoid_passed` = 1 AN
|
||||
$user_funcs = [
|
||||
'celsius_to_fahrenheit',
|
||||
'fahrenheit_to_celsius',
|
||||
'kelvin_to_celsius',
|
||||
'uw_to_dbm',
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user