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