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

70_PIONEERAVR.pm: more input presets (spotify, mhl, hdmi7, hdmi8), inputs are now queried from 1 - 59

71_PIONEERAVRZONE.pm: bugfix:logging, set input

git-svn-id: https://svn.fhem.de/fhem/trunk@6171 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
hofrichter 2014-06-28 00:06:17 +00:00
parent d3812b1094
commit 98e22547e4
3 changed files with 45 additions and 16 deletions

View File

@ -5,7 +5,8 @@
check every 120s if the data connection to the Pioneer AV receiver is still up
check if we get a reply from the Pioneer AV receiver not later than 3s after a command was sent
fix for alias names of inputs
70_PIONEERAVRZONE.pm: bugfix in logging
more input presets (spotify, mhl, hdmi7, hdmi8), inputs are now queried from 1 - 59
71_PIONEERAVRZONE.pm: bugfix:logging, set input
- change: 00_RPII2C.pm: hardware access changed to ioctl and syswrite/read
SMBus module not needed anymore but still usable, see attribute useHWLib
possibility to swap I2C-0 to P5 for Rev. B raspberries via attribute swap_i2c0 (not tested yet)

View File

@ -181,9 +181,10 @@ PIONEERAVR_Define($$) {
"03" => {"name" => "cdrTape", "aliasName" => "", "enabled" => "1"},
"04" => {"name" => "dvd", "aliasName" => "", "enabled" => "1"},
"05" => {"name" => "tvSat", "aliasName" => "", "enabled" => "1"},
"06" => {"name" => "CblSat", "aliasName" => "", "enabled" => "1"},
"06" => {"name" => "cblSat", "aliasName" => "", "enabled" => "1"},
"10" => {"name" => "video1", "aliasName" => "", "enabled" => "1"},
"12" => {"name" => "multiChIn", "aliasName" => "", "enabled" => "1"},
"13" => {"name" => "usbDac", "aliasName" => "", "enabled" => "1"},
"14" => {"name" => "video2", "aliasName" => "", "enabled" => "1"},
"15" => {"name" => "dvrBdr", "aliasName" => "", "enabled" => "1"},
"17" => {"name" => "iPodUsb", "aliasName" => "", "enabled" => "1"},
@ -193,12 +194,21 @@ PIONEERAVR_Define($$) {
"21" => {"name" => "hdmi3", "aliasName" => "", "enabled" => "1"},
"22" => {"name" => "hdmi4", "aliasName" => "", "enabled" => "1"},
"23" => {"name" => "hdmi5", "aliasName" => "", "enabled" => "1"},
"24" => {"name" => "hdmi6", "aliasName" => "", "enabled" => "1"},
"25" => {"name" => "bd", "aliasName" => "", "enabled" => "1"},
"26" => {"name" => "homeMediaGallery", "aliasName" => "", "enabled" => "1"},
"27" => {"name" => "sirius", "aliasName" => "", "enabled" => "1"},
"31" => {"name" => "hdmiCyclic", "aliasName" => "", "enabled" => "1"},
"33" => {"name" => "adapterPort", "aliasName" => "", "enabled" => "1"}
};
"33" => {"name" => "adapterPort", "aliasName" => "", "enabled" => "1"},
"34" => {"name" => "hdmi7", "aliasName" => "", "enabled" => "1"},
"35" => {"name" => "hdmi8", "aliasName" => "", "enabled" => "1"},
"38" => {"name" => "internetRadio", "aliasName" => "", "enabled" => "1"},
"41" => {"name" => "pandora", "aliasName" => "", "enabled" => "1"},
"44" => {"name" => "mediaServer", "aliasName" => "", "enabled" => "1"},
"45" => {"name" => "favorites", "aliasName" => "", "enabled" => "1"},
"48" => {"name" => "mhl", "aliasName" => "", "enabled" => "1"},
"53" => {"name" => "spotify", "aliasName" => "", "enabled" => "1"}
};
# ----------------Human Readable command mapping table-----------------------
$hash->{helper}{SETS} = {
'main' => {
@ -684,7 +694,7 @@ PIONEERAVR_Set($@)
my $arg = ($a[2] ? $a[2] : "");
my @args= @a; shift @args; shift @args;
my @setsPlayer= ("play","pause","stop","repeat","shuffle"); # available commands for certain inputs (@playerInputNr)
my @playerInputNr= ("13","17","18","26","27","33","38","41","44","45","48"); # Input number for usbDac, ipodUsb, xmRadio, homeMediaGallery, sirius, adapterPort, internetRadio, pandora, mediaServer, Favorites, mhl
my @playerInputNr= ("13","17","18","26","27","33","38","41","44","45","48","53"); # Input number for usbDac, ipodUsb, xmRadio, homeMediaGallery, sirius, adapterPort, internetRadio, pandora, mediaServer, Favorites, mhl, spotify
my @setsTuner = ("channelUp","channelDown","channelStraight","channel"); # available commands for input tuner
my @setsWithoutArg= ("off","toggle","volumeUp","volumeDown","muteOn","muteOff","muteToggle","inputUp","inputDown"); # set commands without arguments
my $playerCmd= "";
@ -787,8 +797,8 @@ PIONEERAVR_Set($@)
$playerCmd= $cmd."Ipod";
} elsif ($inputNr eq "33") {
$playerCmd= $cmd."AdapterPort";
#### homeMediaGallery, sirius, internetRadio, pandora, mediaServer, favorites
} elsif (($inputNr eq "26") ||($inputNr eq "27") || ($inputNr eq "38") || ($inputNr eq "41") || ($inputNr eq "44") || ($inputNr eq "45")) {
#### homeMediaGallery, sirius, internetRadio, pandora, mediaServer, favorites, spotify
} elsif (($inputNr eq "26") ||($inputNr eq "27") || ($inputNr eq "38") || ($inputNr eq "41") || ($inputNr eq "44") || ($inputNr eq "45") || ($inputNr eq "53")) {
$playerCmd= $cmd."Network";
#### 'random' and 'repeat' are not available on input mhl
} elsif (($inputNr eq "48") && (( $cmd eq "play") || ( $cmd eq "pause") ||( $cmd eq "stop"))) {
@ -824,6 +834,7 @@ PIONEERAVR_Set($@)
Log3 $name, 5, "PIONEERAVR $name: sending raw command ".dq($allArgs);
PIONEERAVR_Write($hash, $allArgs);
return undef;
####Input (all available Inputs of the Pioneer AV receiver -> see 'get $name loadInputNames')
#### according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
#### first try the aliasName (only if this fails try the default input name)
@ -1454,9 +1465,9 @@ sub PIONEERAVR_askForInputNames($$) {
my $name = $hash->{NAME};
my $comstr = '';
# we ask for the inputs 1 to 49 if an input name exists (command: ?RGB00 ... ?RGB49)
# and if the input is disabled (command: ?SSC0003 ... ?SSC4903)
for ( my $i=0; $i<50; $i++ ) {
# we ask for the inputs 1 to 59 if an input name exists (command: ?RGB00 ... ?RGB59)
# and if the input is disabled (command: ?SSC0003 ... ?SSC5903)
for ( my $i=0; $i<60; $i++ ) {
select(undef, undef, undef, 0.1);
$comstr = sprintf '?RGB%02d', $i;
PIONEERAVR_Write($hash,$comstr);

View File

@ -120,7 +120,7 @@ PIONEERAVRZONE_Set($@)
my @setsWithoutArg= ("off","toggle","volumeUp","volumeDown","muteOn","muteOff","muteToggle","inputUp","inputDown");
Log3 $name, 5, "PIONEERAVRZONE $name: called function PIONEERAVR_Set()";
Log3 $name, 5, "PIONEERAVRZONE $name: called function PIONEERAVR_Set($cmd)";
return "No Argument given" if ( !defined( $cmd ) );
@ -206,12 +206,28 @@ PIONEERAVRZONE_Set($@)
####Input (all available Inputs of the Pioneer Avr -> see 'get $name loadInputNames')
####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
if ( $cmd eq "input" ) {
Log3 $name, 5, "PIONEERAVRZONE $name: set $cmd ".dq($arg);
foreach my $key ( keys %{$IOhash->{helper}{INPUTNAMES}} ) {
if ( $IOhash->{helper}{INPUTNAMES}->{$key}{name} eq $arg ) {
IOWrite($hash, sprintf "%02dFN", $key);
readingsSingleUpdate($hash, "input", $arg, 1 );
if ( $IOhash->{helper}{INPUTNAMES}->{$key}{aliasName} eq $arg ) {
if ( $zone eq "zone2" ) {
IOWrite($hash, sprintf "%02dZS", $key);
} elsif ($zone eq "zone3") {
IOWrite($hash, sprintf "%02dZT", $key);
} elsif ($zone eq "hdZone") {
IOWrite($hash, sprintf "%02dZEA", $key);
}
} elsif ( $IOhash->{helper}{INPUTNAMES}->{$key}{name} eq $arg ) {
if ( $zone eq "zone2" ) {
IOWrite($hash, sprintf "%02dZS", $key);
} elsif ($zone eq "zone3") {
IOWrite($hash, sprintf "%02dZT", $key);
} elsif ($zone eq "hdZone") {
IOWrite($hash, sprintf "%02dZEA", $key);
}
}
}
return undef;
#####VolumeStraight (-80.5 - 12) in dB
####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
@ -316,10 +332,11 @@ PIONEERAVRZONE_Parse($$)
} elsif ($msg =~ m/^Z2F(\d\d)$/ ) {
my $inputNr = $1;
Log3 $hash,5,"PIONEERAVRZONE $name: ".dq($msg) ." interpreted as: Zone2 - Input is set to inputNr: $inputNr ";
if ( defined ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName}) ) {
if ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} ne "") {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone2 - Input aliasName for input $inputNr is " . $IOhash->{helper}{INPUTNAMES}{$inputNr}{aliasName};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} );
} elsif ( defined ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name}) ) {
} elsif ( $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name} ne "" ) {
Log3 $hash,5,"PIONEERAVRZONE $name: Zone2 - Input Name for input $inputNr is " . $IOhash->{helper}{INPUTNAMES}{$inputNr}{name};
readingsBulkUpdate($hash, "input", $IOhash->{helper}{INPUTNAMES}->{$inputNr}{name} );
} else {