2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

collectord: fixing RSSI readings (Forum: #54482)

git-svn-id: https://svn.fhem.de/fhem/trunk@14798 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2017-07-26 21:47:18 +00:00
parent 8b3bd4abed
commit 0162f7d80b

View File

@ -863,6 +863,7 @@ sub aggregateRooms
my $previous = "absence";
my %rssi_results = ();
my $hroom;
my @rooms;
my $key;
@ -939,20 +940,22 @@ sub aggregateRooms
if($rssi_available and defined($highest_key))
{
Log 2, "successful RSSI comparisation (highest $rssi_addon_data_key value $highest_value found in room $highest_key" if(@rooms > 1);
@rooms = ($highest_key);
$hroom = $highest_key;
}
}
if(@rooms > 0)
{
my $rssi_data = join(";", map { "rssi_".$_."='".$rssi_results{$_}."'" } map { s/\s+/_/g } grep {$rssi_results{$_}} keys %rssi_results);
return "present;room='".join(",",sort @rooms).
(defined($hash->{$rooms[0]}{data}) ? "';".$hash->{$rooms[0]}{data} : "").
my $rssi_data = join(";", map("rssi_".$_."='".$rssi_results{$_}."'", map {s/\s+/_/rg } keys %rssi_results)));
my $ret = "present".
(defined($hroom) ? ";room='".$hroom."'" : "").
"rooms='".join(",",sort @rooms)."'".
(defined($hroom) ? ";".$hash->{$hroom}{data} : (defined($hash->{$rooms[0]}{data}) ? "';".$hash->{$rooms[0]}{data} : "")).
(defined($rssi_data) ? ";".$rssi_data : "");
}
else
{
return "absence";
return "absence;room=;rooms=;rssi=;";
}
}