From d958fafa73dc4902a68083a8a6835a8fa73d454e Mon Sep 17 00:00:00 2001 From: vuffiraa <> Date: Tue, 9 Apr 2019 19:52:54 +0000 Subject: [PATCH] 70_BOTVAC.pm: fixed channel presets git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19151 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 1 + FHEM/70_BRAVIA.pm | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGED b/CHANGED index 7e3c18975..55a8ece64 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 70_BRAVIA: fix channel presets - bugfix: 49_SSCam: fix perl warnings, Forum: 45671.msg927912.html#msg927912 - new: 10_WS980: new module to control the WS980Wifi weather station - feature: 93_DbRep: the "explain" SQL-command is possible now in sqlCmd diff --git a/FHEM/70_BRAVIA.pm b/FHEM/70_BRAVIA.pm index cd937175f..09240fad4 100644 --- a/FHEM/70_BRAVIA.pm +++ b/FHEM/70_BRAVIA.pm @@ -564,8 +564,8 @@ sub Set($@) { return "No 2nd argument given" if ( !defined( $a[2] ) ); - shift(@a); shift(@a); - my $inputStr = join("#", @a); + shift(@a); shift(@a); + my $inputStr = join("#", @a); Log3($name, 2, "BRAVIA set $name input $inputStr"); # Resolve input uri @@ -1362,6 +1362,7 @@ sub ProcessCommandData ($$$) { my %contentKeys; my $channelName = "-"; my $channelNo = "-"; + my $channelUri; my $currentTitle = "-"; my $currentMedia = "-"; foreach ( keys %{ $hash->{READINGS} } ) { @@ -1424,6 +1425,7 @@ sub ProcessCommandData ($$$) { } } if ($uri) { + $channelUri = $uri; readingsBulkUpdateIfChanged($hash, "uri", $uri); foreach ( keys %{$hash->{helper}{device}{inputPreset}} ) { if ($hash->{helper}{device}{inputPreset}{$_}{uri} eq $uri) { @@ -1467,11 +1469,12 @@ sub ProcessCommandData ($$$) { readingsEndUpdate( $hash, 1 ); if ($channelName ne "-" && $channelNo ne "-") { - push(@$successor, ["getContentList", ReadingsVal($name, "input", "")]) - if (ReadingsVal($name, "requestFormat", "") eq "json" - && (!defined($hash->{helper}{device}{channelPreset}) || ReadingsVal($name, "state", "") ne "on")); +# push(@$successor, ["getContentList", ReadingsVal($name, "input", "")]) +# if (ReadingsVal($name, "requestFormat", "") eq "json" +# && (!defined($hash->{helper}{device}{channelPreset}) || ReadingsVal($name, "state", "") ne "on")); $hash->{helper}{device}{channelPreset}{ $channelNo }{id} = $channelNo; $hash->{helper}{device}{channelPreset}{ $channelNo }{name} = GetNormalizedName($channelName); + $hash->{helper}{device}{channelPreset}{ $channelNo }{uri} = $channelUri; } # get current system settings @@ -1572,7 +1575,11 @@ sub ProcessCommandData ($$$) { # increment index, because it starts with 0 if (++$channelIndex % InternalVal($name, "CHANNELCOUNT", 50) == 0) { # try next junk of channels - push(@$successor, ["getContentList", ReadingsVal($name, "input", "")."|".$channelIndex]); + my $source = $cmd; + if ($cmd =~ /^(.*)\|(\d+)$/){ + $source = $1; + } + push(@$successor, ["getContentList", $source."|".$channelIndex]); } } @@ -1618,6 +1625,7 @@ sub ProcessCommandData ($$$) { if (defined($source) and $source =~ /tv:dvb(.)/) { my $dvbName = GetNormalizedName("TV / DVB-".uc($1)); $hash->{helper}{device}{inputPreset}{$dvbName}{uri} = $source; + push(@$successor, ["getContentList", $source]); } } }