hardware: get exceeded threshold values
We want to report the exceeded threshold value for sensors. To do this,
we must know not only the state of the threshold watcher, but also the
value it exceeded.
Change-Id: I2ad57edb352b10c598a7dc63b14c64cea4d90b3f
diff --git a/src/ietf-hardware/IETFHardware.cpp b/src/ietf-hardware/IETFHardware.cpp
index e6d37a0..c67b73f 100644
--- a/src/ietf-hardware/IETFHardware.cpp
+++ b/src/ietf-hardware/IETFHardware.cpp
@@ -124,9 +124,9 @@
newValue = std::nullopt;
}
- if (auto newState = thresholdsWatcher.update(newValue)) {
- m_log->debug("threshold: {} {}", sensorXPath, *newState);
- alarms.emplace(sensorXPath, *newState);
+ if (auto update = thresholdsWatcher.update(newValue)) {
+ m_log->debug("threshold: {} {}", sensorXPath, update->newState);
+ alarms.emplace(sensorXPath, update->newState);
}
}