Sensors remove reliance on global variable (#16344)

* Sensors remove reliance on global variable

* Apply fixes from StyleCI

* Clear the instance instead of reset.
Remove $valid['sensors'] from docs

---------

Co-authored-by: Tony Murray <murrant@users.noreply.github.com>
This commit is contained in:
Tony Murray
2024-09-03 21:04:34 -05:00
committed by GitHub
parent 4efad1ae69
commit f15f8fa63a
381 changed files with 991 additions and 932 deletions

View File

@@ -28,6 +28,6 @@ foreach ($pre_cache['cooling_unit_analog'] as $index => $data) {
$scale = $data['coolingUnitStatusAnalogScale'] ?? null;
$value = $data['coolingUnitStatusAnalogValue'] ?? null;
if (preg_match('/Fan Speed/', $descr) && $data['coolingUnitStatusAnalogUnits'] == '%' && $value >= 0) {
discover_sensor($valid['sensor'], 'fanspeed', $device, $cur_oid, $cur_oid, 'apc', $descr, $scale, 1, null, null, null, null, $value);
discover_sensor(null, 'fanspeed', $device, $cur_oid, $cur_oid, 'apc', $descr, $scale, 1, null, null, null, null, $value);
}
}