2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-21 07:56:03 +00:00

MYSENSORS_DEVICE: don't append -1 to autocreated reading if is 1

git-svn-id: https://svn.fhem.de/fhem/trunk@6808 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
ntruchsess 2014-10-25 12:10:23 +00:00
parent 9c3e655aee
commit 2b77e01eec

View File

@ -366,12 +366,13 @@ sub onPresentationMessage($$) {
my $readingMappings = $hash->{readingMappings}; my $readingMappings = $hash->{readingMappings};
my $typeMappings = $hash->{typeMappings}; my $typeMappings = $hash->{typeMappings};
if (my $sensorMappings = $hash->{sensorMappings}->{$nodeType}) { if (my $sensorMappings = $hash->{sensorMappings}->{$nodeType}) {
my $idStr = ($id > 1 ? $id-1 : "");
my @ret = (); my @ret = ();
foreach my $type (@{$sensorMappings->{sends}}) { foreach my $type (@{$sensorMappings->{sends}}) {
next if (defined $readingMappings->{$id}->{$type}); next if (defined $readingMappings->{$id}->{$type});
my $typeStr = $typeMappings->{$type}->{type}; my $typeStr = $typeMappings->{$type}->{type};
if ($hash->{IODev}->{'inclusion-mode'}) { if ($hash->{IODev}->{'inclusion-mode'}) {
if (my $ret = CommandAttr(undef,"$name mapReading_$typeStr$id $id $typeStr")) { if (my $ret = CommandAttr(undef,"$name mapReading_$typeStr$idStr $id $typeStr")) {
push @ret,$ret; push @ret,$ret;
} }
} else { } else {
@ -381,9 +382,9 @@ sub onPresentationMessage($$) {
foreach my $type (@{$sensorMappings->{receives}}) { foreach my $type (@{$sensorMappings->{receives}}) {
my $typeMapping = $typeMappings->{$type}; my $typeMapping = $typeMappings->{$type};
my $typeStr = $typeMapping->{type}; my $typeStr = $typeMapping->{type};
next if (defined $hash->{sets}->{"$typeStr$id"}); next if (defined $hash->{sets}->{"$typeStr$idStr"});
if ($hash->{IODev}->{'inclusion-mode'}) { if ($hash->{IODev}->{'inclusion-mode'}) {
if (my $ret = CommandAttr(undef,"$name setReading_$typeStr$id".($typeMapping->{val} ? " ".join (",",values %{$typeMapping->{val}}) : ""))) { if (my $ret = CommandAttr(undef,"$name setReading_$typeStr$idStr".($typeMapping->{val} ? " ".join (",",values %{$typeMapping->{val}}) : ""))) {
push @ret,$ret; push @ret,$ret;
} }
} else { } else {