Check thresholds for sensor override

Fix bug, which got introduced when moving override logic
to base class. This fixes to check thresholds for external set
(i.e. sensor override).

Tested:
1. Verified that threshold events are triggered, when updating
Value property more than the threshold value
2. Verified that threshold events are set to low when Value
property is updated to normal level

Change-Id: I6a3cb9c66ebdc38c793b6397eb98f88ad9e1be55
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 3d81f1f..19c3733 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -32,7 +32,7 @@
     std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceCritical;
     std::shared_ptr<sdbusplus::asio::dbus_interface> association;
     double value = std::numeric_limits<double>::quiet_NaN();
-    bool overridenState = false;
+    bool overriddenState = false;
     bool internalSet = false;
 
     int setSensorValue(const double& newValue, double& oldValue)
@@ -40,9 +40,12 @@
         if (!internalSet)
         {
             oldValue = newValue;
-            overridenState = true;
+            overriddenState = true;
+            // check thresholds for external set
+            value = newValue;
+            checkThresholds();
         }
-        else if (!overridenState)
+        else if (!overriddenState)
         {
             oldValue = newValue;
         }
@@ -136,11 +139,15 @@
 
     void updateValue(const double& newValue)
     {
-        // Indicate that it is internal set call
-        internalSet = true;
-        sensorInterface->set_property("Value", newValue);
-        internalSet = false;
-        value = newValue;
-        checkThresholds();
+        // Ignore if overriding is enabled
+        if (!overriddenState)
+        {
+            // Indicate that it is internal set call
+            internalSet = true;
+            sensorInterface->set_property("Value", newValue);
+            internalSet = false;
+            value = newValue;
+            checkThresholds();
+        }
     }
-};
\ No newline at end of file
+};