70_BOTVAC.pm: fixed channel presets

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19151 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
vuffiraa 2019-04-09 19:52:54 +00:00
parent 5ca2e2cc0d
commit d958fafa73
2 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # 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 - bugfix: 49_SSCam: fix perl warnings, Forum: 45671.msg927912.html#msg927912
- new: 10_WS980: new module to control the WS980Wifi weather station - new: 10_WS980: new module to control the WS980Wifi weather station
- feature: 93_DbRep: the "explain" SQL-command is possible now in sqlCmd - feature: 93_DbRep: the "explain" SQL-command is possible now in sqlCmd

View File

@ -564,8 +564,8 @@ sub Set($@) {
return "No 2nd argument given" if ( !defined( $a[2] ) ); return "No 2nd argument given" if ( !defined( $a[2] ) );
shift(@a); shift(@a); shift(@a); shift(@a);
my $inputStr = join("#", @a); my $inputStr = join("#", @a);
Log3($name, 2, "BRAVIA set $name input $inputStr"); Log3($name, 2, "BRAVIA set $name input $inputStr");
# Resolve input uri # Resolve input uri
@ -1362,6 +1362,7 @@ sub ProcessCommandData ($$$) {
my %contentKeys; my %contentKeys;
my $channelName = "-"; my $channelName = "-";
my $channelNo = "-"; my $channelNo = "-";
my $channelUri;
my $currentTitle = "-"; my $currentTitle = "-";
my $currentMedia = "-"; my $currentMedia = "-";
foreach ( keys %{ $hash->{READINGS} } ) { foreach ( keys %{ $hash->{READINGS} } ) {
@ -1424,6 +1425,7 @@ sub ProcessCommandData ($$$) {
} }
} }
if ($uri) { if ($uri) {
$channelUri = $uri;
readingsBulkUpdateIfChanged($hash, "uri", $uri); readingsBulkUpdateIfChanged($hash, "uri", $uri);
foreach ( keys %{$hash->{helper}{device}{inputPreset}} ) { foreach ( keys %{$hash->{helper}{device}{inputPreset}} ) {
if ($hash->{helper}{device}{inputPreset}{$_}{uri} eq $uri) { if ($hash->{helper}{device}{inputPreset}{$_}{uri} eq $uri) {
@ -1467,11 +1469,12 @@ sub ProcessCommandData ($$$) {
readingsEndUpdate( $hash, 1 ); readingsEndUpdate( $hash, 1 );
if ($channelName ne "-" && $channelNo ne "-") { if ($channelName ne "-" && $channelNo ne "-") {
push(@$successor, ["getContentList", ReadingsVal($name, "input", "")]) # push(@$successor, ["getContentList", ReadingsVal($name, "input", "")])
if (ReadingsVal($name, "requestFormat", "") eq "json" # if (ReadingsVal($name, "requestFormat", "") eq "json"
&& (!defined($hash->{helper}{device}{channelPreset}) || ReadingsVal($name, "state", "") ne "on")); # && (!defined($hash->{helper}{device}{channelPreset}) || ReadingsVal($name, "state", "") ne "on"));
$hash->{helper}{device}{channelPreset}{ $channelNo }{id} = $channelNo; $hash->{helper}{device}{channelPreset}{ $channelNo }{id} = $channelNo;
$hash->{helper}{device}{channelPreset}{ $channelNo }{name} = GetNormalizedName($channelName); $hash->{helper}{device}{channelPreset}{ $channelNo }{name} = GetNormalizedName($channelName);
$hash->{helper}{device}{channelPreset}{ $channelNo }{uri} = $channelUri;
} }
# get current system settings # get current system settings
@ -1572,7 +1575,11 @@ sub ProcessCommandData ($$$) {
# increment index, because it starts with 0 # increment index, because it starts with 0
if (++$channelIndex % InternalVal($name, "CHANNELCOUNT", 50) == 0) { if (++$channelIndex % InternalVal($name, "CHANNELCOUNT", 50) == 0) {
# try next junk of channels # 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(.)/) { if (defined($source) and $source =~ /tv:dvb(.)/) {
my $dvbName = GetNormalizedName("TV / DVB-".uc($1)); my $dvbName = GetNormalizedName("TV / DVB-".uc($1));
$hash->{helper}{device}{inputPreset}{$dvbName}{uri} = $source; $hash->{helper}{device}{inputPreset}{$dvbName}{uri} = $source;
push(@$successor, ["getContentList", $source]);
} }
} }
} }