mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
ENIGMA2: fix XML parsing for tuner information
git-svn-id: https://svn.fhem.de/fhem/trunk@8122 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
de99ae42d8
commit
ba1f1352a8
@ -1486,40 +1486,45 @@ sub ENIGMA2_ReceiveCommand($$$) {
|
||||
|
||||
# Tuner
|
||||
if ( defined( $return->{e2about}{e2tunerinfo}{e2nim} ) ) {
|
||||
my %tuner = %{ $return->{e2about}{e2tunerinfo}{e2nim} };
|
||||
|
||||
# single
|
||||
if ( defined( $tuner{type} ) ) {
|
||||
my $tunerRef = \%tuner;
|
||||
my $tuner_name = lc( $$tunerRef{name} );
|
||||
$tuner_name =~ s/\s/_/g;
|
||||
|
||||
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
||||
|| $hash->{READINGS}{$tuner_name}{VAL} ne
|
||||
$$tunerRef{type} )
|
||||
{
|
||||
readingsBulkUpdate( $hash, $tuner_name,
|
||||
$$tunerRef{type} );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# multiple
|
||||
else {
|
||||
for ( keys %tuner ) {
|
||||
my $tuner_name = lc($_);
|
||||
if (
|
||||
ref( $return->{e2about}{e2tunerinfo}{e2nim} ) eq
|
||||
"ARRAY" )
|
||||
{
|
||||
foreach my $tuner (
|
||||
@{ $return->{e2about}{e2tunerinfo}{e2nim} } )
|
||||
{
|
||||
my $tuner_name = lc( $tuner->{name} );
|
||||
$tuner_name =~ s/\s/_/g;
|
||||
my $tuner_type = $tuner{$_}{type};
|
||||
|
||||
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
||||
|| $hash->{READINGS}{$tuner_name}{VAL} ne
|
||||
$tuner_type )
|
||||
$tuner->{type} )
|
||||
{
|
||||
readingsBulkUpdate( $hash, $tuner_name,
|
||||
$tuner_type );
|
||||
$tuner->{type} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# single
|
||||
elsif (
|
||||
ref( $return->{e2about}{e2tunerinfo}{e2nim} ) eq
|
||||
"HASH" )
|
||||
{
|
||||
my $tuner_name =
|
||||
lc( $return->{e2about}{e2tunerinfo}{e2nim}{name} );
|
||||
$tuner_name =~ s/\s/_/g;
|
||||
|
||||
if ( !defined( $hash->{READINGS}{$tuner_name}{VAL} )
|
||||
|| $hash->{READINGS}{$tuner_name}{VAL} ne
|
||||
$return->{e2about}{e2tunerinfo}{e2nim}{type} )
|
||||
{
|
||||
readingsBulkUpdate( $hash, $tuner_name,
|
||||
$return->{e2about}{e2tunerinfo}{e2nim}{type} );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user