From 6e5e0e72bd695d0e7dd546a24c3afba31ab32cae Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 24 Jan 2020 08:08:52 +0100 Subject: check-health: always calculate on the lower voltage value This makes sure an alert is triggered in both directions. Before we could have: 24.0V to 21.8V -> OK 21.8V to 24.0V -> Alert! --- check-health | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'check-health') diff --git a/check-health b/check-health index fb59740..95a92d7 100644 --- a/check-health +++ b/check-health @@ -22,7 +22,7 @@ :if ([ :typeof ($CheckHealthLast->$Voltage) ] = "num" && \ [ :typeof ($CheckHealthCurrent->$Voltage) ] = "num") do={ :if ($CheckHealthLast->$Voltage * (100 + $CheckHealthVoltagePercent) / 100 < $CheckHealthCurrent->$Voltage || \ - $CheckHealthLast->$Voltage * 100 / (100 + $CheckHealthVoltagePercent) > $CheckHealthCurrent->$Voltage) do={ + $CheckHealthLast->$Voltage > $CheckHealthCurrent->$Voltage * (100 + $CheckHealthVoltagePercent) / 100) do={ $SendNotification ("Health warning: " . $Voltage) \ ("The " . $Voltage . " on " . $Identity . " jumped more than " . $CheckHealthVoltagePercent . "%.\n\n" . \ "old value: " . [ $FormatVoltage ($CheckHealthLast->$Voltage) ] . "\n" . \ -- cgit v1.2.3-54-g00ecf