From 3154dc373c1e3d8644846f6596e283f6d5ca7f06 Mon Sep 17 00:00:00 2001 From: ntruchsess <> Date: Fri, 7 Nov 2014 22:15:57 +0000 Subject: [PATCH] MYSENSORS_DEVICE: fix mapping for types without valuemapping git-svn-id: https://svn.fhem.de/fhem/trunk@6911 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_MYSENSORS_DEVICE.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/10_MYSENSORS_DEVICE.pm b/fhem/FHEM/10_MYSENSORS_DEVICE.pm index 0ac23468e..07a51ee28 100644 --- a/fhem/FHEM/10_MYSENSORS_DEVICE.pm +++ b/fhem/FHEM/10_MYSENSORS_DEVICE.pm @@ -376,7 +376,7 @@ sub onPresentationMessage($$) { my $readingMappings = $hash->{readingMappings}; my $typeMappings = $hash->{typeMappings}; if (my $sensorMappings = $hash->{sensorMappings}->{$nodeType}) { - my $idStr = ($id > 1 ? $id : ""); + my $idStr = ($id > 0 ? $id : ""); my @ret = (); foreach my $type (@{$sensorMappings->{sends}}) { next if (defined $readingMappings->{$id}->{$type}); @@ -524,10 +524,8 @@ sub rawToMappedReading($$$$) { my $name; if (defined (my $mapping = $hash->{readingMappings}->{$childId}->{$type})) { - if(defined (my $val = $mapping->{val} // $hash->{typeMappings}->{$type}->{val})) { - return ($mapping->{name},$val->{$value} // $value); - } - die "no type-mapping for type ".variableTypeToStr($type); + my $val = $mapping->{val} // $hash->{typeMappings}->{$type}->{val}; + return ($mapping->{name},defined $val ? ($val->{$value} // $value) : $value); } die "no reading-mapping for childId $childId, type ".($hash->{typeMappings}->{$type}->{type} ? $hash->{typeMappings}->{$type}->{type} : variableTypeToStr($type)); }