2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-09 20:57:11 +00:00

HMCCU: Fixed scaling of non numeric reading values

git-svn-id: https://svn.fhem.de/fhem/trunk@27641 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2023-06-01 17:52:19 +00:00
parent 910118df80
commit 33806e6ab7
2 changed files with 11 additions and 4 deletions

View File

@ -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.

View File

@ -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;
}