Fix AOS 7 sensors (#12599)

* AOS7 WIP

* Fix AOS 7 sensors

* TX Bias -> TX Power

* Fixes
This commit is contained in:
Tony Murray
2021-03-08 22:50:34 -06:00
committed by GitHub
parent 9e10b757fa
commit 242b8747fb
12 changed files with 5864 additions and 1722 deletions

View File

@@ -1002,10 +1002,6 @@ function discovery_process(&$valid, $device, $sensor_class, $pre_cache)
}
}
echo "Cur $value, Low: $low_limit, Low Warn: $low_warn_limit, Warn: $warn_limit, High: $high_limit" . PHP_EOL;
$entPhysicalIndex = YamlDiscovery::replaceValues('entPhysicalIndex', $index, null, $data, $pre_cache) ?: null;
$entPhysicalIndex_measured = isset($data['entPhysicalIndex_measured']) ? $data['entPhysicalIndex_measured'] : null;
$sensor_name = $device['os'];
if ($sensor_class === 'state') {
@@ -1016,6 +1012,10 @@ function discovery_process(&$valid, $device, $sensor_class, $pre_cache)
$value = ($value / $divisor) * $multiplier;
}
echo "Cur $value, Low: $low_limit, Low Warn: $low_warn_limit, Warn: $warn_limit, High: $high_limit" . PHP_EOL;
$entPhysicalIndex = YamlDiscovery::replaceValues('entPhysicalIndex', $index, null, $data, $pre_cache) ?: null;
$entPhysicalIndex_measured = isset($data['entPhysicalIndex_measured']) ? $data['entPhysicalIndex_measured'] : null;
//user_func must be applied after divisor/multiplier
if (isset($user_function) && is_callable($user_function)) {
$value = $user_function($value);
@@ -1056,7 +1056,7 @@ function sensors($types, $device, $valid, $pre_cache = [])
}
}
discovery_process($valid, $device, $sensor_class, $pre_cache);
d_echo($valid['sensor'][$sensor_class]);
d_echo($valid['sensor'][$sensor_class] ?? []);
check_valid_sensors($device, $sensor_class, $valid['sensor']);
echo "\n";
}