From b196eff2aceffef29c6532db308a7b2a33aa7c55 Mon Sep 17 00:00:00 2001 From: zap <> Date: Thu, 1 Jun 2023 17:52:19 +0000 Subject: [PATCH] HMCCU: Fixed scaling of non numeric reading values git-svn-id: https://svn.fhem.de/fhem/trunk@27641 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/88_HMCCU.pm | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 81455fabb..333a61069 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 88_HMCCU: Fixed scaling of non numeric reading values - bugfix: 74_AutomowerConnect: improved background image loading Commandref: Hint to connect application key with Automower Connect API in Developer Portal. diff --git a/fhem/FHEM/88_HMCCU.pm b/fhem/FHEM/88_HMCCU.pm index 19d12693a..583247e9f 100755 --- a/fhem/FHEM/88_HMCCU.pm +++ b/fhem/FHEM/88_HMCCU.pm @@ -9324,6 +9324,12 @@ sub HMCCU_ScaleValue ($$$$$;$) my $name = $hash->{NAME}; my $ioHash = HMCCU_GetHash ($hash); + if (!defined($value) || !HMCCU_IsFltNum($value)) { + my $logValue = $value // 'undef'; + HMCCU_Log ($hash, 5, "Value $logValue is not numeric. chn=$chnno, dpt=$dpt"); + return $value; + } + my $boundsChecking = ( $mode == 2 || ($mode == 0 && $dpt =~ /^LEVEL/ && ($value == -0.005 || $value == 1.005 || $value == 1.01)) || @@ -9981,11 +9987,11 @@ sub HMCCU_Min ($$) my ($a, $b) = @_; if (!defined($a) || !defined($b)) { - HMCCU_Log (undef, 2, "Argument not defined in HMCCU_Min ".stacktraceAsString(undef)); + HMCCU_Log (undef, 5, "Argument not defined in HMCCU_Min ".stacktraceAsString(undef)); return 0; } if (!HMCCU_IsFltNum($a) || !HMCCU_IsFltNum($b)) { - HMCCU_Log (undef, 2, "Argument $a or $b isn't numeric in HMCCU_Min ".stacktraceAsString(undef)); + HMCCU_Log (undef, 5, "Argument $a or $b isn't numeric in HMCCU_Min ".stacktraceAsString(undef)); return 0; } @@ -9997,11 +10003,11 @@ sub HMCCU_Max ($$) my ($a, $b) = @_; if (!defined($a) || !defined($b)) { - HMCCU_Log (undef, 2, "Argument not defined in HMCCU_Min ".stacktraceAsString(undef)); + HMCCU_Log (undef, 5, "Argument not defined in HMCCU_Min ".stacktraceAsString(undef)); return 0; } if (!HMCCU_IsFltNum($a) || !HMCCU_IsFltNum($b)) { - HMCCU_Log (undef, 2, "Argument $a or $b isn't numeric in HMCCU_Max ".stacktraceAsString(undef)); + HMCCU_Log (undef, 5, "Argument $a or $b isn't numeric in HMCCU_Max ".stacktraceAsString(undef)); return 0; }