2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 13:24:56 +00:00

MYSENSORS_DEVICE: fix mapping for types without valuemapping

git-svn-id: https://svn.fhem.de/fhem/trunk@6911 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-11-07 22:15:57 +00:00
parent 33e897e7ce
commit 3154dc373c

View File

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