mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
MYSENSORS_DEVICE: fix readingMapping for multiple sensors of same type
git-svn-id: https://svn.fhem.de/fhem/trunk@6923 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d07d62fd95
commit
358ea9e7c1
@ -311,7 +311,7 @@ sub Attr($$$$) {
|
||||
FIND: foreach my $id (keys %$readingMappings) {
|
||||
my $readingsForId = $readingMappings->{$id};
|
||||
foreach my $type (keys %$readingsForId) {
|
||||
if ($readingsForId->{$type}->{name} // "" eq $1) {
|
||||
if (($readingsForId->{$type}->{name} // "") eq $1) {
|
||||
delete $readingsForId->{$type};
|
||||
unless (keys %$readingsForId) {
|
||||
delete $readingMappings->{$id};
|
||||
@ -325,11 +325,9 @@ sub Attr($$$$) {
|
||||
my $typeMappings = $hash->{typeMappings};
|
||||
if (my @match = grep {$typeMappings->{$_}->{type} eq $typeStr} keys %$typeMappings) {
|
||||
my $type = shift @match;
|
||||
$hash->{readingMappings}->{$id}->{$type} = {
|
||||
name => $1,
|
||||
};
|
||||
$readingMappings->{$id}->{$type}->{name} = $1;
|
||||
if (@values) {
|
||||
$hash->{readingMappings}->{$id}->{$type}->{val} = {map {$_ =~ /^(.+):(.+)$/; $1 => $2} @values}; #TODO range?
|
||||
$readingMappings->{$id}->{$type}->{val} = {map {$_ =~ /^(.+):(.+)$/; $1 => $2} @values}; #TODO range?
|
||||
}
|
||||
} else {
|
||||
return "unknown reading type $typeStr";
|
||||
|
Loading…
Reference in New Issue
Block a user