70_PIONEERAVR.pm 173 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905
  1. ##############################################
  2. # $Id: 70_PIONEERAVR.pm 17618 2018-10-25 06:40:49Z 50watt $
  3. #
  4. # 70_PIONEERAVR.pm
  5. #
  6. # This file is part of Fhem.
  7. #
  8. # Fhem is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation, either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # Fhem is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with Fhem. If not, see <http://www.gnu.org/licenses/>.
  20. #
  21. ##############################################################################
  22. #
  23. # This module handles the communication with a Pioneer AV receiver and controls the main zone. Tests are done with a Pioneer VSX923
  24. # this is the module for the communication interface and to control the main zone -
  25. # it opens the device (via rs232 or TCP), and its ReadFn is called after the global select reports, that data is available.
  26. # - on Windows select does not work for devices not connected via TCP, here is a ReadyFn function necessary, which polls the device 10 times
  27. # a second, and returns true if data is available.
  28. # - ReadFn makes sure, that a message is complete and correct, and calls the global Dispatch() with one message
  29. # - Dispatch() searches for a matching logical module (by checking $hash->{Clients} or $hash->{MatchList} in this device, and
  30. # $hash->{Match} in all matching zone devices), and calls the ParseFn of the zone devices
  31. # (This mechanism is used to pass information to the PIONEERAVRZONE device(s) )
  32. #
  33. # See also:
  34. # Elite & Pioneer FY14AVR IP & RS-232 7-31-13.xlsx
  35. #
  36. # TODO:
  37. # match for devices/Dispatch() ???
  38. # random/repeat attributes
  39. # remote control layout (dynamic depending on available/current input?)
  40. # suppress the "on" command if networkStandby = "off"
  41. #
  42. package main;
  43. use strict;
  44. use warnings;
  45. use SetExtensions;
  46. use Time::HiRes qw(gettimeofday);
  47. # use DevIo;
  48. no if $] >= 5.017011, warnings => 'experimental::smartmatch';
  49. #########################
  50. # Forward declaration
  51. sub PIONEERAVR_Set($@);
  52. sub PIONEERAVR_Get($$$);
  53. sub PIONEERAVR_Define($$);
  54. sub PIONEERAVR_Undef($$);
  55. sub PIONEERAVR_Read($);
  56. sub PIONEERAVR_Write($$);
  57. sub PIONEERAVR_Parse($$$);
  58. sub RC_layout_PioneerAVR();
  59. sub PIONEERAVR_RCmakenotify($$);
  60. #####################################
  61. #Die Funktion wird von Fhem.pl nach dem Laden des Moduls aufgerufen
  62. # und bekommt einen Hash für das Modul als zentrale Datenstruktur übergeben.
  63. # Dieser Hash wird im globalen Hash %modules gespeichert - hier $modules{PIONEERAVR}
  64. # Es handelt sich also nicht um den oben beschriebenen Hash der Geräteinstanzen sondern einen Hash,
  65. # der je Modul Werte enthält, beispielsweise auch die Namen der Funktionen, die das Modul implementiert
  66. # und die fhem.pl aufrufen soll. Die Initialize-Funktion setzt diese Funktionsnamen, in den Hash des Moduls
  67. #
  68. # Darüber hinaus sollten die vom Modul unterstützen Attribute definiert werden
  69. # In Fhem.pl werden dann die entsprechenden Werte beim Aufruf eines attr-Befehls in die
  70. # globale Datenstruktur $attr{$name}, z.B. $attr{$name}{header} für das Attribut header gespeichert.
  71. # Falls im Modul weitere Aktionen oder Prüfungen beim Setzen eines Attributs nötig sind, dann kann
  72. # die Funktion X_Attr implementiert und in der Initialize-Funktion bekannt gemacht werden.
  73. #
  74. # Die Variable $readingFnAttributes, die an die Liste der unterstützten Attribute angefügt wird, definiert Attributnamen,
  75. # die dann verfügbar werden, wenn das Modul zum Setzen von Readings die Funktionen
  76. # readingsBeginUpdate, readingsBulkUpdate, readingsEndUpdate oder readingsSingleUpdate verwendet.
  77. # In diesen Funktionen werden Attribute wie event-min-interval oder auch event-on-change-reading ausgewertet
  78. sub PIONEERAVR_Initialize($) {
  79. my ( $hash) = @_;
  80. Log3 $hash, 5, "PIONEERAVR_Initialize: Entering";
  81. require "$attr{global}{modpath}/FHEM/DevIo.pm";
  82. # Provider
  83. $hash->{ReadFn} = "PIONEERAVR_Read";
  84. $hash->{WriteFn} = "PIONEERAVR_Write";
  85. $hash->{ReadyFn} = "PIONEERAVR_Ready";
  86. $hash->{Clients} = ":PIONEERAVRZONE:";
  87. $hash->{ClearFn} = "PIONEERAVR_Clear";
  88. $hash->{NotifyFn} = "PIONEERAVR_Notify";
  89. # Normal devices
  90. $hash->{DefFn} = "PIONEERAVR_Define";
  91. $hash->{UndefFn} = "PIONEERAVR_Undef";
  92. $hash->{GetFn} = "PIONEERAVR_Get";
  93. $hash->{SetFn} = "PIONEERAVR_Set";
  94. $hash->{AttrFn} = "PIONEERAVR_Attr";
  95. $hash->{parseParams} = 1;
  96. no warnings 'qw';
  97. my @attrList = qw(
  98. logTraffic:0,1,2,3,4,5
  99. statusUpdateReconnect:enable,disable
  100. statusUpdateStart:enable,disable
  101. volumeLimitStraight
  102. disable:0,1
  103. connectionCheck:off,30,45,60,75,90,105,120
  104. timeout:1,2,3,4,5,7,10,15
  105. );
  106. use warnings 'qw';
  107. $hash->{AttrList} = join( " ", @attrList ) . " " . $readingFnAttributes;
  108. # remotecontrol
  109. $data{RC_layout}{pioneerAvr} = "RC_layout_PioneerAVR";
  110. # 98_powerMap.pm support
  111. $hash->{powerMap} = {
  112. model => {
  113. 'VSX-923' => {
  114. rname_E => 'energy',
  115. rname_P => 'consumption',
  116. map => {
  117. stateAV => {
  118. absent => 0,
  119. off => 0,
  120. muted => 85,
  121. '*' => 140,
  122. },
  123. },
  124. },
  125. },
  126. };
  127. }
  128. ######################################
  129. #Die Define-Funktion eines Moduls wird von Fhem aufgerufen wenn der Define-Befehl für ein Geräte ausgeführt wird
  130. # und das Modul bereits geladen und mit der Initialize-Funktion initialisiert ist. Sie ist typischerweise dazu da,
  131. # die übergebenen Parameter zu prüfen und an geeigneter Stelle zu speichern sowie
  132. # einen Kommunikationsweg zum Pioneer AV Receiver zu öffnen (TCP-Verbindung bzw. RS232-Schnittstelle)
  133. #Als Übergabeparameter bekommt die Define-Funktion den Hash der Geräteinstanz sowie den Rest der Parameter, die im Befehl angegeben wurden.
  134. #
  135. # Damit die übergebenen Werte auch anderen Funktionen zur Verfügung stehen und an die jeweilige Geräteinstanz gebunden sind,
  136. # werden die Werte typischerweise als Internals im Hash der Geräteinstanz gespeichert
  137. sub PIONEERAVR_Define($$) {
  138. my ( $hash, $a, $h ) = @_;
  139. my $name = $hash->{NAME};
  140. Log3 $name, 5, "PIONEERAVR $name: called function PIONEERAVR_Define()";
  141. my $protocol = @$a[2];
  142. Log3 $name, 5, "PIONEERAVR $name: called function PIONEERAVR_Define()";
  143. if( int(@$a) != 4 || (($protocol ne "telnet") && ($protocol ne "serial"))) {
  144. my $msg = "Wrong syntax: define <name> PIONEERAVR telnet <ipaddress[:port]> or define <name> PIONEERAVR serial <devicename[\@baudrate]>";
  145. Log3 $name, 3, "PIONEERAVR $name: " . $msg;
  146. return $msg;
  147. }
  148. RemoveInternalTimer( $hash);
  149. DevIo_CloseDev( $hash);
  150. delete $hash->{NEXT_OPEN} if ( defined( $hash->{NEXT_OPEN} ) );
  151. # set default attributes
  152. if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
  153. fhem 'attr ' . $name . ' stateFormat stateAV';
  154. fhem 'attr ' . $name
  155. . ' cmdIcon muteT:rc_MUTE previous:rc_PREVIOUS next:rc_NEXT play:rc_PLAY pause:rc_PAUSE stop:rc_STOP shuffleT:rc_SHUFFLE repeatT:rc_REPEAT';
  156. fhem 'attr ' . $name . ' webCmd volume:mute:input';
  157. fhem 'attr ' . $name
  158. . ' devStateIcon on:rc_GREEN@green:off off:rc_STOP:on absent:rc_RED:reopen playing:rc_PLAY@green:pause paused:rc_PAUSE@green:play muted:rc_MUTE@green:muteT fast-rewind:rc_REW@green:play fast-forward:rc_FF@green:play interrupted:rc_PAUSE@yellow:play';
  159. }
  160. # $hash->{DeviceName} is needed for DevIo_OpenDev()
  161. $hash->{Protocol}= $protocol;
  162. my $devicename= @$a[3];
  163. $hash->{DeviceName} = $devicename;
  164. # connect using serial connection (old blocking style)
  165. if ( $hash->{Protocol} eq "serial" )
  166. {
  167. my $ret = DevIo_OpenDev( $hash, 0, undef);
  168. return $ret;
  169. }
  170. # connect using TCP connection (non-blocking style)
  171. else {
  172. # add missing port if required
  173. $hash->{DeviceName} = $hash->{DeviceName} . ":8102"
  174. if ( $hash->{DeviceName} !~ m/^(.+):([0-9]+)$/ );
  175. DevIo_OpenDev(
  176. $hash, 0,
  177. "PIONEERAVR_DevInit",
  178. sub() {
  179. my ( $hash, $err ) = @_;
  180. Log3 $name, 4, "PIONEERAVR $name: devName: $devicename HashDevName $hash->{DeviceName}";
  181. }
  182. );
  183. }
  184. $hash->{helper}{receiver} = undef;
  185. unless ( exists( $hash->{helper}{AVAILABLE} ) and ( $hash->{helper}{AVAILABLE} == 0 ))
  186. {
  187. $hash->{helper}{AVAILABLE} = 1;
  188. readingsSingleUpdate( $hash, "presence", "present", 1 );
  189. }
  190. # $hash->{helper}{INPUTNAMES} lists the default input names and their inputNr as provided by Pioneer.
  191. # This module tries to read those names and the alias names from the AVR receiver and tries to check if this input is enabled or disabled
  192. # So this list is just a fall back if the module can't read the names ...
  193. # InputNr with player functions (play,pause,...) ("13","17","18","26","27","33","38","41","44","45","48","49","53");
  194. # Input number for usbDac, ipodUsb, xmRadio, homeMediaGallery, sirius, adapterPort, internetRadio, pandora, mediaServer, Favorites, mhl, spotify
  195. # Additionally this module tries to get information from the Pioneer AVR
  196. # - about the input level adjust
  197. # - to which connector each input is connected.
  198. # There are 3 groups of connectors:
  199. # - Audio connectors (possible values are: ANALOG, COAX 1...3, OPT 1...3)
  200. # - Component connectors (anaolog video, possible values: COMPONENT 1...3)
  201. # - HDMI connectors (possible values are hdmi 1 ... hdmi 8)
  202. $hash->{helper}{INPUTNAMES} = {
  203. "00" => {"name" => "phono", "aliasName" => "", "enabled" => "1", "playerCommands" => "0", "audioTerminal" => "No Assign", "componentTerminal" => "No Assign", "hdmiTerminal" => "No Assign", "inputLevelAdjust" => 1},
  204. "01" => {"name" => "cd", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  205. "02" => {"name" => "tuner", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  206. "03" => {"name" => "cdrTape", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  207. "04" => {"name" => "dvd", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  208. "05" => {"name" => "tvSat", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  209. "06" => {"name" => "cblSat", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  210. "10" => {"name" => "video1", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  211. "12" => {"name" => "multiChIn", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  212. "13" => {"name" => "usbDac", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  213. "14" => {"name" => "video2", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  214. "15" => {"name" => "dvrBdr", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  215. "17" => {"name" => "iPodUsb", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  216. "18" => {"name" => "xmRadio", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  217. "19" => {"name" => "hdmi1", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  218. "20" => {"name" => "hdmi2", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  219. "21" => {"name" => "hdmi3", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  220. "22" => {"name" => "hdmi4", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  221. "23" => {"name" => "hdmi5", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  222. "24" => {"name" => "hdmi6", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  223. "25" => {"name" => "bd", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  224. "26" => {"name" => "homeMediaGallery", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  225. "27" => {"name" => "sirius", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  226. "31" => {"name" => "hdmiCyclic", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  227. "33" => {"name" => "adapterPort", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  228. "34" => {"name" => "hdmi7", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  229. "35" => {"name" => "hdmi8", "aliasName" => "", "enabled" => "1", "playerCommands" => "0"},
  230. "38" => {"name" => "internetRadio", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  231. "41" => {"name" => "pandora", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  232. "44" => {"name" => "mediaServer", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  233. "45" => {"name" => "favorites", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  234. "46" => {"name" => "airplay", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  235. "47" => {"name" => "dmr", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  236. "48" => {"name" => "mhl", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  237. "49" => {"name" => "game", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"},
  238. "53" => {"name" => "spotify", "aliasName" => "", "enabled" => "1", "playerCommands" => "1"}
  239. };
  240. # ----------------Human Readable command mapping table for "set" commands-----------------------
  241. $hash->{helper}{SETS} = {
  242. 'main' => {
  243. 'on' => 'PO',
  244. 'off' => 'PF',
  245. 'toggle' => 'PZ',
  246. 'volumeUp' => 'VU',
  247. 'volumeDown' => 'VD',
  248. 'volume' => 'VL',
  249. 'muteOn' => 'MO',
  250. 'muteOff' => 'MF',
  251. 'muteToggle' => 'MZ',
  252. 'bassUp' => 'BI',
  253. 'bassDown' => 'BD',
  254. 'trebleUp' => 'TI',
  255. 'trebleDown' => 'TD',
  256. 'input' => 'FN',
  257. 'inputUp' => 'FU',
  258. 'inputDown' => 'FD',
  259. 'channelUp' => 'TPI',
  260. 'channelDown' => 'TPD',
  261. '0Network' => '00NW',
  262. '1Network' => '01NW',
  263. '2Network' => '02NW',
  264. '3Network' => '03NW',
  265. '4Network' => '04NW',
  266. '5Network' => '05NW',
  267. '6Network' => '06NW',
  268. '7Network' => '07NW',
  269. '8Network' => '08NW',
  270. '9Network' => '09NW',
  271. 'prevNetwork' => '12NW',
  272. 'nextNetwork' => '13NW',
  273. 'revNetwork' => '14NW',
  274. 'fwdNetwork' => '15NW',
  275. 'upNetwork' => '26NW',
  276. 'downNetwork' => '27NW',
  277. 'rightNetwork' => '28NW',
  278. 'leftNetwork' => '29NW',
  279. 'enterNetwork' => '30NW',
  280. 'returnNetwork' => '31NW',
  281. 'menuNetwork' => '36NW',
  282. 'playNetwork' => '10NW',
  283. 'pauseNetwork' => '11NW',
  284. 'stopNetwork' => '20NW',
  285. 'repeatNetwork' => '34NW',
  286. 'shuffleNetwork' => '35NW',
  287. 'updateScreenNetwork' => '?GAH',
  288. 'selectLine01Network' => '01GFH',
  289. 'selectLine02Network' => '02GFH',
  290. 'selectLine03Network' => '03GFH',
  291. 'selectLine04Network' => '04GFH',
  292. 'selectLine05Network' => '05GFH',
  293. 'selectLine06Network' => '06GFH',
  294. 'selectLine07Network' => '07GFH',
  295. 'selectLine08Network' => '08GFH',
  296. 'selectScreenPageNetwork'=> 'GGH',
  297. 'playIpod' => '00IP',
  298. 'pauseIpod' => '01IP',
  299. 'stopIpod' => '02IP',
  300. 'repeatIpod' => '07IP',
  301. 'shuffleIpod' => '08IP',
  302. 'prevIpod' => '03IP',
  303. 'nextIpod' => '04IP',
  304. 'revIpod' => '05IP',
  305. 'fwdIpod' => '06IP',
  306. 'upIpod' => '13IP',
  307. 'downIpod' => '14IP',
  308. 'rightIpod' => '15IP',
  309. 'leftIpod' => '16IP',
  310. 'enterIpod' => '17IP',
  311. 'returnIpod' => '18IP',
  312. 'menuIpod' => '19IP',
  313. 'updateScreenIpod' => '?GAI',
  314. 'selectLine01Ipod' => '01GFI',
  315. 'selectLine02Ipod' => '02GFI',
  316. 'selectLine03Ipod' => '03GFI',
  317. 'selectLine04Ipod' => '04GFI',
  318. 'selectLine05Ipod' => '05GFI',
  319. 'selectLine06Ipod' => '06GFI',
  320. 'selectLine07Ipod' => '07GFI',
  321. 'selectLine08Ipod' => '08GFI',
  322. 'selectScreenPageIpod' => 'GGI',
  323. 'playAdapterPort' => '10BT',
  324. 'pauseAdapterPort' => '11BT',
  325. 'stopAdapterPort' => '12BT',
  326. 'repeatAdapterPort' => '17BT',
  327. 'shuffleAdapterPort' => '18BT',
  328. 'prevAdapterPort' => '13BT',
  329. 'nextAdapterPort' => '14BT',
  330. 'revAdapterPort' => '15BT',
  331. 'fwdAdapterPort' => '16BT',
  332. 'upAdapterPort' => '21BT',
  333. 'downAdapterPort' => '22BT',
  334. 'rightAdapterPort' => '23BT',
  335. 'leftAdapterPort' => '24BT',
  336. 'enterAdapterPort' => '25BT',
  337. 'returnAdapterPort' => '26BT',
  338. 'menuAdapterPort' => '27BT',
  339. 'playMhl' => '23MHL',
  340. 'pauseMhl' => '25MHL',
  341. 'stopMhl' => '24MHL',
  342. '0Mhl' => '07MHL',
  343. '1Mhl' => '08MHL',
  344. '2Mhl' => '09MHL',
  345. '3Mhl' => '10MHL',
  346. '4Mhl' => '11MHL',
  347. '5Mhl' => '12MHL',
  348. '6Mhl' => '13MHL',
  349. '7Mhl' => '14MHL',
  350. '8Mhl' => '15MHL',
  351. '9Mhl' => '16MHL',
  352. 'prevMhl' => '31MHL',
  353. 'nextMhl' => '30MHL',
  354. 'revMhl' => '27MHL',
  355. 'fwdMhl' => '28MHL',
  356. 'upMhl' => '01MHL',
  357. 'downMhl' => '02MHL',
  358. 'rightMhl' => '04MHL',
  359. 'leftMhl' => '03MHL',
  360. 'enterMhl' => '17MHL',
  361. 'returnMhl' => '06MHL',
  362. 'menuMhl' => '05MHL'
  363. },
  364. 'zone2' => {
  365. 'on' => 'APO',
  366. 'off' => 'APF',
  367. 'toggle' => 'APZ',
  368. 'volumeUp' => 'ZU',
  369. 'volumeDown' => 'ZD',
  370. 'muteOn' => 'Z2MO',
  371. 'muteOff' => 'Z2MF',
  372. 'muteToggle' => 'Z2MZ',
  373. 'inputUp' => 'ZSFU',
  374. 'inputDown' => 'ZSFD'
  375. },
  376. 'zone3' => {
  377. 'on' => 'BPO',
  378. 'off' => 'BPF',
  379. 'toggle' => 'BPZ',
  380. 'volumeUp' => 'YU',
  381. 'volumeDown' => 'YD',
  382. 'muteOn' => 'Z3MO',
  383. 'muteOff' => 'Z3MF',
  384. 'muteToggle' => 'Z3MZ',
  385. 'inputUp' => 'ZTFU',
  386. 'inputDown' => 'ZTFD'
  387. },
  388. 'hdZone' => {
  389. 'on' => 'ZEO',
  390. 'off' => 'ZEF',
  391. 'toggle' => 'ZEZ',
  392. 'inputUp' => 'ZEC',
  393. 'inputDown' => 'ZEB'
  394. }
  395. };
  396. # ----------------Human Readable command mapping table for "get" commands-----------------------
  397. $hash->{helper}{GETS} = {
  398. 'main' => {
  399. 'audioInfo' => '?AST',
  400. 'avrModel' => '?RGD',
  401. 'bass' => '?BA',
  402. 'channel' => '?PR',
  403. 'currentListIpod' => '?GAI',
  404. 'currentListNetwork' => '?GAH',
  405. 'display' => '?FL',
  406. 'eq' => '?ATC',
  407. 'hdmiOut' => '?HO',
  408. 'input' => '?F',
  409. 'listeningMode' => '?S',
  410. 'listeningModePlaying' => '?L',
  411. 'macAddress' => '?SVB',
  412. 'mcaccMemory' => '?MC',
  413. 'mute' => '?M',
  414. 'networkPort1' => '?STM',
  415. 'networkPort2' => '?STN',
  416. 'networkPort3' => '?STO',
  417. 'networkPort4' => '?STP',
  418. 'networkPorts' => '?SUM',
  419. 'networkSettings' => '?SUL',
  420. 'networkStandby' => '?STJ',
  421. 'power' => '?P',
  422. 'signalSelect' => '?DSA',
  423. 'softwareVersion' => '?SSI',
  424. 'speakers' => '?SPK',
  425. 'speakerSystem' => '?SSF',
  426. 'standingWave' => '?ATD',
  427. 'tone' => '?TO',
  428. 'tunerFrequency' => '?FR',
  429. 'tunerChannelNames' => '?TQ',
  430. 'treble' => '?TR',
  431. 'videoInfo' => '?VST',
  432. 'volume' => '?V'
  433. },
  434. 'zone2' => {
  435. 'bass' => '?ZGB',
  436. 'input' => '?ZS',
  437. 'mute' => '?Z2M',
  438. 'power' => '?AP',
  439. 'treble' => '?ZGC',
  440. 'volume' => '?ZV'
  441. },
  442. 'zone3' => {
  443. 'input' => '?ZT',
  444. 'mute' => '?Z3M',
  445. 'power' => '?BP',
  446. 'volume' => '?YV'
  447. },
  448. 'hdZone' => {
  449. 'input' => '?ZEA',
  450. 'power' => '?ZEP'
  451. }
  452. };
  453. # ----------------Human Readable command mapping table for the remote control-----------------------
  454. $hash->{helper}{REMOTECONTROL} = {
  455. "cursorUp" => "CUP",
  456. "cursorDown" => "CDN",
  457. "cursorRight" => "CRI",
  458. "cursorLeft" => "CLE",
  459. "cursorEnter" => "CEN",
  460. "cursorReturn" => "CRT",
  461. "statusDisplay" => "STS",
  462. "audioParameter" => "APA",
  463. "hdmiOutputParameter" => "HPA",
  464. "videoParameter" => "VPA",
  465. "homeMenu" => "HM"
  466. };
  467. # ----------------Human Readable command mapping table for the remote control-----------------------
  468. # Audio input signal type
  469. $hash->{helper}{AUDIOINPUTSIGNAL} = {
  470. "00"=>"ANALOG",
  471. "01"=>"ANALOG",
  472. "02"=>"ANALOG",
  473. "03"=>"PCM",
  474. "04"=>"PCM",
  475. "05"=>"DOLBY DIGITAL",
  476. "06"=>"DTS",
  477. "07"=>"DTS-ES Matrix",
  478. "08"=>"DTS-ES Discrete",
  479. "09"=>"DTS 96/24",
  480. "10"=>"DTS 96/24 ES Matrix",
  481. "11"=>"DTS 96/24 ES Discrete",
  482. "12"=>"MPEG-2 AAC",
  483. "13"=>"WMA9 Pro",
  484. "14"=>"DSD (HDMI or File via DSP route)",
  485. "15"=>"HDMI THROUGH",
  486. "16"=>"DOLBY DIGITAL PLUS",
  487. "17"=>"DOLBY TrueHD",
  488. "18"=>"DTS EXPRESS",
  489. "19"=>"DTS-HD Master Audio",
  490. "20"=>"DTS-HD High Resolution",
  491. "21"=>"DTS-HD High Resolution",
  492. "22"=>"DTS-HD High Resolution",
  493. "23"=>"DTS-HD High Resolution",
  494. "24"=>"DTS-HD High Resolution",
  495. "25"=>"DTS-HD High Resolution",
  496. "26"=>"DTS-HD High Resolution",
  497. "27"=>"DTS-HD Master Audio",
  498. "28"=>"DSD (HDMI or File via DSD DIRECT route)",
  499. "64"=>"MP3",
  500. "65"=>"WAV",
  501. "66"=>"WMA",
  502. "67"=>"MPEG4-AAC",
  503. "68"=>"FLAC",
  504. "69"=>"ALAC(Apple Lossless)",
  505. "70"=>"AIFF",
  506. "71"=>"DSD (USB-DAC)"
  507. };
  508. # Audio input frequency
  509. $hash->{helper}{AUDIOINPUTFREQUENCY} = {
  510. "00"=>"32kHz",
  511. "01"=>"44.1kHz",
  512. "02"=>"48kHz",
  513. "03"=>"88.2kHz",
  514. "04"=>"96kHz",
  515. "05"=>"176.4kHz",
  516. "06"=>"192kHz",
  517. "07"=>"---",
  518. "32"=>"2.8MHz",
  519. "33"=>"5.6MHz"
  520. };
  521. # Audio output frequency
  522. $hash->{helper}{AUDIOOUTPUTFREQUENCY} = {
  523. "00"=>"32kHz",
  524. "01"=>"44.1kHz",
  525. "02"=>"48kHz",
  526. "03"=>"88.2kHz",
  527. "04"=>"96kHz",
  528. "05"=>"176.4kHz",
  529. "06"=>"192kHz",
  530. "07"=>"---",
  531. "32"=>"2.8MHz",
  532. "33"=>"5.6MHz"
  533. };
  534. # working PQLS
  535. $hash->{helper}{PQLSWORKING} = {
  536. "0"=>"PQLS OFF",
  537. "1"=>"PQLS 2ch",
  538. "2"=>"PQLS Multi ch",
  539. "3"=>"PQLS Bitstream"
  540. };
  541. # Translation table for the possible speaker systems
  542. $hash->{helper}{SPEAKERSYSTEMS} = {
  543. "10"=>"9.1ch FH/FW",
  544. "00"=>"Normal(SB/FH)",
  545. "01"=>"Normal(sb/FW)",
  546. "02"=>"Speaker B",
  547. "03"=>"Front Bi-Amp",
  548. "04"=>"ZONE 2",
  549. "11"=>"7.1ch + Speaker B",
  550. "12"=>"7.1ch Front Bi-Amp",
  551. "13"=>"7.1ch + ZONE2",
  552. "14"=>"7.1ch FH/FW + ZONE2",
  553. "15"=>"5.1ch Bi-Amp + ZONE2",
  554. "16"=>"5.1ch + ZONE 2+3",
  555. "17"=>"5.1ch + SP-B Bi-Amp",
  556. "18"=>"5.1ch F+Surr Bi-Amp",
  557. "19"=>"5.1ch F+C Bi-Amp",
  558. "20"=>"5.1ch C+Surr Bi-Amp"
  559. };
  560. # In some Pioneer AVR models you can give tuner presets a name -> e.g. instead of "A1" it writes in the display "BBC1"
  561. # This modules tries to read those tuner preset names and write them into this list
  562. $hash->{helper}{TUNERCHANNELNAMES} = {
  563. "A1"=>""
  564. };
  565. # Translation table for all available ListeningModes - provided by Pioneer
  566. $hash->{helper}{LISTENINGMODES} = {
  567. "0001"=>"stereoCyclic",
  568. "0010"=>"standard",
  569. "0009"=>"stereoDirectSet",
  570. "0011"=>"2chSource",
  571. "0013"=>"proLogic2movie",
  572. "0018"=>"proLogic2xMovie",
  573. "0014"=>"proLogic2music",
  574. "0019"=>"proLogic2xMusic",
  575. "0015"=>"proLogic2game",
  576. "0020"=>"proLogic2xGame",
  577. "0031"=>"proLogic2zHeight",
  578. "0032"=>"wideSurroundMovie",
  579. "0033"=>"wideSurroundMusic",
  580. "0012"=>"proLogic",
  581. "0016"=>"neo6cinema",
  582. "0017"=>"neo6music",
  583. "0028"=>"xmHdSurround",
  584. "0029"=>"neuralSurround",
  585. "0037"=>"neoXcinema",
  586. "0038"=>"neoXmusic",
  587. "0039"=>"neoXgame",
  588. "0040"=>"neuralSurroundNeoXcinema",
  589. "0041"=>"neuralSurroundNeoXmusic",
  590. "0042"=>"neuralSurroundNeoXgame",
  591. "0021"=>"multiChSource",
  592. "0022"=>"multiChSourceDolbyEx",
  593. "0023"=>"multiChSourceProLogic2xMovie",
  594. "0024"=>"multiChSourceProLogic2xMusic",
  595. "0034"=>"multiChSourceProLogic2zHeight",
  596. "0035"=>"multiChSourceWideSurroundMovie",
  597. "0036"=>"multiChSourceWideSurroundMusic",
  598. "0025"=>"multiChSourceDtsEsNeo6",
  599. "0026"=>"multiChSourceDtsEsMatrix",
  600. "0027"=>"multiChSourceDtsEsDiscrete",
  601. "0030"=>"multiChSourceDtsEs8chDiscrete",
  602. "0043"=>"multiChSourceNeoXcinema",
  603. "0044"=>"multiChSourceNeoXmusic",
  604. "0045"=>"multiChSourceNeoXgame",
  605. "0100"=>"advancedSurroundCyclic",
  606. "0101"=>"action",
  607. "0103"=>"drama",
  608. "0102"=>"sciFi",
  609. "0105"=>"monoFilm",
  610. "0104"=>"entertainmentShow",
  611. "0106"=>"expandedTheater",
  612. "0116"=>"tvSurround",
  613. "0118"=>"advancedGame",
  614. "0117"=>"sports",
  615. "0107"=>"classical",
  616. "0110"=>"rockPop",
  617. "0109"=>"unplugged",
  618. "0112"=>"extendedStereo",
  619. "0003"=>"frontStageSurroundAdvanceFocus",
  620. "0004"=>"frontStageSurroundAdvanceWide",
  621. "0153"=>"retrieverAir",
  622. "0113"=>"phonesSurround",
  623. "0050"=>"thxCyclic",
  624. "0051"=>"prologicThxCinema",
  625. "0052"=>"pl2movieThxCinema",
  626. "0053"=>"neo6cinemaThxCinema",
  627. "0054"=>"pl2xMovieThxCinema",
  628. "0092"=>"pl2zHeightThxCinema",
  629. "0055"=>"thxSelect2games",
  630. "0068"=>"thxCinemaFor2ch",
  631. "0069"=>"thxMusicFor2ch",
  632. "0070"=>"thxGamesFor2ch",
  633. "0071"=>"pl2musicThxMusic",
  634. "0072"=>"pl2xMusicThxMusic",
  635. "0093"=>"pl2zHeightThxMusic",
  636. "0073"=>"neo6musicThxMusic",
  637. "0074"=>"pl2gameThxGames",
  638. "0075"=>"pl2xGameThxGames",
  639. "0094"=>"pl2zHeightThxGames",
  640. "0076"=>"thxUltra2games",
  641. "0077"=>"prologicThxMusic",
  642. "0078"=>"prologicThxGames",
  643. "0201"=>"neoXcinemaThxCinema",
  644. "0202"=>"neoXmusicThxMusic",
  645. "0203"=>"neoXgameThxGames",
  646. "0056"=>"thxCinemaForMultiCh",
  647. "0057"=>"thxSurroundExForMultiCh",
  648. "0058"=>"pl2xMovieThxCinemaForMultiCh",
  649. "0095"=>"pl2zHeightThxCinemaForMultiCh",
  650. "0059"=>"esNeo6thxCinemaForMultiCh",
  651. "0060"=>"esMatrixThxCinemaForMultiCh",
  652. "0061"=>"esDiscreteThxCinemaForMultiCh",
  653. "0067"=>"es8chDiscreteThxCinemaForMultiCh",
  654. "0062"=>"thxSelect2cinemaForMultiCh",
  655. "0063"=>"thxSelect2musicForMultiCh",
  656. "0064"=>"thxSelect2gamesForMultiCh",
  657. "0065"=>"thxUltra2cinemaForMultiCh",
  658. "0066"=>"thxUltra2musicForMultiCh",
  659. "0079"=>"thxUltra2gamesForMultiCh",
  660. "0080"=>"thxMusicForMultiCh",
  661. "0081"=>"thxGamesForMultiCh",
  662. "0082"=>"pl2xMusicThxMusicForMultiCh",
  663. "0096"=>"pl2zHeightThxMusicForMultiCh",
  664. "0083"=>"exThxGamesForMultiCh",
  665. "0097"=>"pl2zHeightThxGamesForMultiCh",
  666. "0084"=>"neo6thxMusicForMultiCh",
  667. "0085"=>"neo6thxGamesForMultiCh",
  668. "0086"=>"esMatrixThxMusicForMultiCh",
  669. "0087"=>"esMatrixThxGamesForMultiCh",
  670. "0088"=>"esDiscreteThxMusicForMultiCh",
  671. "0089"=>"esDiscreteThxGamesForMultiCh",
  672. "0090"=>"es8chDiscreteThxMusicForMultiCh",
  673. "0091"=>"es8chDiscreteThxGamesForMultiCh",
  674. "0204"=>"neoXcinemaThxCinemaForMultiCh",
  675. "0205"=>"neoXmusicThxMusicForMultiCh",
  676. "0206"=>"neoXgameThxGamesForMultiCh",
  677. "0005"=>"autoSurrStreamDirectCyclic",
  678. "0006"=>"autoSurround",
  679. "0151"=>"autoLevelControlAlC",
  680. "0007"=>"direct",
  681. "0008"=>"pureDirect",
  682. "0152"=>"optimumSurround"
  683. };
  684. # Translation table for all available playing ListeningModes - provided by Pioneer
  685. $hash->{helper}{LISTENINGMODESPLAYING} = {
  686. "0101"=>"[)(]PLIIx MOVIE",
  687. "0102"=>"[)(]PLII MOVIE",
  688. "0103"=>"[)(]PLIIx MUSIC",
  689. "0104"=>"[)(]PLII MUSIC",
  690. "0105"=>"[)(]PLIIx GAME",
  691. "0106"=>"[)(]PLII GAME",
  692. "0107"=>"[)(]PROLOGIC",
  693. "0108"=>"Neo:6 CINEMA",
  694. "0109"=>"Neo:6 MUSIC",
  695. "010c"=>"2ch Straight Decode",
  696. "010d"=>"[)(]PLIIz HEIGHT",
  697. "010e"=>"WIDE SURR MOVIE",
  698. "010f"=>"WIDE SURR MUSIC",
  699. "0110"=>"STEREO",
  700. "0111"=>"Neo:X CINEMA",
  701. "0112"=>"Neo:X MUSIC",
  702. "0113"=>"Neo:X GAME",
  703. "1101"=>"[)(]PLIIx MOVIE",
  704. "1102"=>"[)(]PLIIx MUSIC",
  705. "1103"=>"[)(]DIGITAL EX",
  706. "1104"=>"DTS Neo:6",
  707. "1105"=>"ES MATRIX",
  708. "1106"=>"ES DISCRETE",
  709. "1107"=>"DTS-ES 8ch ",
  710. "1108"=>"multi ch Straight Decode",
  711. "1109"=>"[)(]PLIIz HEIGHT",
  712. "110a"=>"WIDE SURR MOVIE",
  713. "110b"=>"WIDE SURR MUSIC",
  714. "110c"=>"Neo:X CINEMA ",
  715. "110d"=>"Neo:X MUSIC",
  716. "110e"=>"Neo:X GAME",
  717. "0201"=>"ACTION",
  718. "0202"=>"DRAMA",
  719. "0208"=>"ADVANCEDGAME",
  720. "0209"=>"SPORTS",
  721. "020a"=>"CLASSICAL",
  722. "020b"=>"ROCK/POP",
  723. "020d"=>"EXT.STEREO",
  724. "020e"=>"PHONES SURR.",
  725. "020f"=>"FRONT STAGE SURROUND ADVANCE",
  726. "0211"=>"SOUND RETRIEVER AIR",
  727. "0212"=>"ECO MODE 1",
  728. "0213"=>"ECO MODE 2",
  729. "0301"=>"[)(]PLIIx MOVIE +THX",
  730. "0302"=>"[)(]PLII MOVIE +THX",
  731. "0303"=>"[)(]PL +THX CINEMA",
  732. "0305"=>"THX CINEMA",
  733. "0306"=>"[)(]PLIIx MUSIC +THX",
  734. "0307"=>"[)(]PLII MUSIC +THX",
  735. "0308"=>"[)(]PL +THX MUSIC",
  736. "030a"=>"THX MUSIC",
  737. "030b"=>"[)(]PLIIx GAME +THX",
  738. "030c"=>"[)(]PLII GAME +THX",
  739. "030d"=>"[)(]PL +THX GAMES",
  740. "0310"=>"THX GAMES",
  741. "0311"=>"[)(]PLIIz +THX CINEMA",
  742. "0312"=>"[)(]PLIIz +THX MUSIC",
  743. "0313"=>"[)(]PLIIz +THX GAMES",
  744. "0314"=>"Neo:X CINEMA + THX CINEMA",
  745. "0315"=>"Neo:X MUSIC + THX MUSIC",
  746. "0316"=>"Neo:X GAMES + THX GAMES",
  747. "1301"=>"THX Surr EX",
  748. "1303"=>"ES MTRX +THX CINEMA",
  749. "1304"=>"ES DISC +THX CINEMA",
  750. "1305"=>"ES 8ch +THX CINEMA ",
  751. "1306"=>"[)(]PLIIx MOVIE +THX",
  752. "1309"=>"THX CINEMA",
  753. "130b"=>"ES MTRX +THX MUSIC",
  754. "130c"=>"ES DISC +THX MUSIC",
  755. "130d"=>"ES 8ch +THX MUSIC",
  756. "130e"=>"[)(]PLIIx MUSIC +THX",
  757. "1311"=>"THX MUSIC",
  758. "1313"=>"ES MTRX +THX GAMES",
  759. "1314"=>"ES DISC +THX GAMES",
  760. "1315"=>"ES 8ch +THX GAMES",
  761. "1319"=>"THX GAMES",
  762. "131a"=>"[)(]PLIIz +THX CINEMA",
  763. "131b"=>"[)(]PLIIz +THX MUSIC",
  764. "131c"=>"[)(]PLIIz +THX GAMES",
  765. "131d"=>"Neo:X CINEMA + THX CINEMA",
  766. "131e"=>"Neo:X MUSIC + THX MUSIC",
  767. "131f"=>"Neo:X GAME + THX GAMES",
  768. "0401"=>"STEREO",
  769. "0402"=>"[)(]PLII MOVIE",
  770. "0403"=>"[)(]PLIIx MOVIE",
  771. "0405"=>"AUTO SURROUND Straight Decode",
  772. "0406"=>"[)(]DIGITAL EX",
  773. "0407"=>"[)(]PLIIx MOVIE",
  774. "0408"=>"DTS +Neo:6",
  775. "0409"=>"ES MATRIX",
  776. "040a"=>"ES DISCRETE",
  777. "040b"=>"DTS-ES 8ch ",
  778. "040e"=>"RETRIEVER AIR",
  779. "040f"=>"Neo:X CINEMA",
  780. "0501"=>"STEREO",
  781. "0502"=>"[)(]PLII MOVIE",
  782. "0503"=>"[)(]PLIIx MOVIE",
  783. "0504"=>"DTS/DTS-HD",
  784. "0505"=>"ALC Straight Decode",
  785. "0506"=>"[)(]DIGITAL EX",
  786. "0507"=>"[)(]PLIIx MOVIE",
  787. "0508"=>"DTS +Neo:6",
  788. "0509"=>"ES MATRIX",
  789. "050a"=>"ES DISCRETE",
  790. "050b"=>"DTS-ES 8ch ",
  791. "050e"=>"RETRIEVER AIR",
  792. "050f"=>"Neo:X CINEMA",
  793. "0601"=>"STEREO",
  794. "0602"=>"[)(]PLII MOVIE",
  795. "0603"=>"[)(]PLIIx MOVIE",
  796. "0605"=>"STREAM DIRECT NORMAL Straight Decode",
  797. "0606"=>"[)(]DIGITAL EX",
  798. "0607"=>"[)(]PLIIx MOVIE",
  799. "0609"=>"ES MATRIX",
  800. "060a"=>"ES DISCRETE",
  801. "060b"=>"DTS-ES 8ch ",
  802. "060c"=>"Neo:X CINEMA",
  803. "0701"=>"STREAM DIRECT PURE 2ch",
  804. "0702"=>"[)(]PLII MOVIE",
  805. "0703"=>"[)(]PLIIx MOVIE",
  806. "0704"=>"Neo:6 CINEMA",
  807. "0705"=>"STREAM DIRECT PURE Straight Decode",
  808. "0706"=>"[)(]DIGITAL EX",
  809. "0707"=>"[)(]PLIIx MOVIE",
  810. "0708"=>"(nothing)",
  811. "0709"=>"ES MATRIX",
  812. "070a"=>"ES DISCRETE",
  813. "070b"=>"DTS-ES 8ch ",
  814. "070c"=>"Neo:X CINEMA",
  815. "0881"=>"OPTIMUM",
  816. "0e01"=>"HDMI THROUGH",
  817. "0f01"=>"MULTI CH IN"
  818. };
  819. #translation for hdmiOut
  820. $hash->{helper}{HDMIOUT} = {
  821. "0"=>"1+2",
  822. "1"=>"1",
  823. "2"=>"2",
  824. "3"=>"OFF"
  825. };
  826. #Video Input Terminals
  827. $hash->{helper}{VIDEOINPUTTERMINAL} = {
  828. "0"=>"---",
  829. "1"=>"VIDEO",
  830. "2"=>"S-VIDEO",
  831. "3"=>"COMPONENT",
  832. "4"=>"HDMI",
  833. "5"=>"Self OSD/JPEG"
  834. };
  835. #Video resolutions
  836. $hash->{helper}{VIDEORESOLUTION} = {
  837. "00"=>"---",
  838. "01"=>"480/60i",
  839. "02"=>"576/50i",
  840. "03"=>"480/60p",
  841. "04"=>"576/50p",
  842. "05"=>"720/60p",
  843. "06"=>"720/50p",
  844. "07"=>"1080/60i",
  845. "08"=>"1080/50i",
  846. "09"=>"1080/60p",
  847. "10"=>"1080/50p",
  848. "11"=>"1080/24p",
  849. "12"=>"4Kx2K/24Hz",
  850. "13"=>"4Kx2K/25Hz",
  851. "14"=>"4Kx2K/30Hz",
  852. "15"=>"4Kx2K/24Hz(SMPTE)",
  853. "16"=>"4Kx2K/50Hz",
  854. "17"=>"4Kx2K/60Hz"
  855. };
  856. #Video aspect ratios
  857. $hash->{helper}{VIDEOASPECTRATIO} = {
  858. "0"=>"---",
  859. "1"=>"4:3",
  860. "2"=>"16:9",
  861. "3"=>"14:9"
  862. };
  863. #Video colour format
  864. $hash->{helper}{VIDEOCOLOURFORMAT} = {
  865. "0"=>"---",
  866. "1"=>"RGB Limit",
  867. "2"=>"RGB Full",
  868. "3"=>"YcbCr444",
  869. "4"=>"YcbCr422",
  870. "5"=>"YcbCr420"
  871. };
  872. #Video bit (VIDEOCOLOURDEPTH)
  873. $hash->{helper}{VIDEOCOLOURDEPTH} = {
  874. "0"=>"---",
  875. "1"=>"24bit (8bit*3)",
  876. "2"=>"30bit (10bit*3)",
  877. "3"=>"36bit (12bit*3)",
  878. "4"=>"48bit (16bit*3)"
  879. };
  880. #Video extended colour space
  881. $hash->{helper}{VIDEOCOLOURSPACE} = {
  882. "0"=>"---",
  883. "1"=>"Standard",
  884. "2"=>"xvYCC601",
  885. "3"=>"xvYCC709",
  886. "4"=>"sYCC",
  887. "5"=>"AdobeYCC601",
  888. "6"=>"AdobeRGB"
  889. };
  890. # for some inputs (e.g. internetRadio) the Pioneer AVR gives more information about the current program
  891. # The information is displayed on a (to the Pioneer avr) connected screen
  892. # This information is categorized - below are the categories ("dataTypes")
  893. $hash->{helper}{SCREENTYPES} = {
  894. "00"=>"Message",
  895. "01"=>"List",
  896. "02"=>"Playing(Play)",
  897. "03"=>"Playing(Pause)",
  898. "04"=>"Playing(Fwd)",
  899. "05"=>"Playing(Rev)",
  900. "06"=>"Playing(Stop)",
  901. "99"=>"Drawing invalid"
  902. };
  903. $hash->{helper}{LINEDATATYPES} = {
  904. "00"=>"normal",
  905. "01"=>"directory",
  906. "02"=>"music",
  907. "03"=>"photo",
  908. "04"=>"video",
  909. "05"=>"nowPlaying",
  910. "20"=>"currentTitle",
  911. "21"=>"currentArtist",
  912. "22"=>"currentAlbum",
  913. "23"=>"time",
  914. "24"=>"genre",
  915. "25"=>"currentChapterNumber",
  916. "26"=>"format",
  917. "27"=>"bitPerSample",
  918. "28"=>"currentSamplingRate",
  919. "29"=>"currentBitrate",
  920. "32"=>"currentChannel",
  921. "31"=>"buffer",
  922. "33"=>"station"
  923. };
  924. # indicates what the source of the screen information is
  925. $hash->{helper}{SOURCEINFO} = {
  926. "00"=>"Internet Radio",
  927. "01"=>"MEDIA SERVER",
  928. "02"=>"iPod",
  929. "03"=>"USB",
  930. "04"=>"(Reserved)",
  931. "05"=>"(Reserved)",
  932. "06"=>"(Reserved)",
  933. "07"=>"PANDORA",
  934. "10"=>"AirPlay",
  935. "11"=>"Digital Media Renderer(DMR)",
  936. "99"=>"(Indeterminate)"
  937. };
  938. # translation for chars (for the display)
  939. $hash->{helper}{CHARS} = {
  940. "00"=>" ",
  941. "01"=>" ",
  942. "02"=>" ",
  943. "03"=>" ",
  944. "04"=>" ",
  945. "05"=>"[)",
  946. "06"=>"(]",
  947. "07"=>"I",
  948. "08"=>"II",
  949. "09"=>"<",
  950. "0A"=>">",
  951. "0B"=>"_",
  952. "0C"=>".",
  953. "0D"=>".0",
  954. "0E"=>".5",
  955. "0F"=>"O",
  956. "10"=>"0",
  957. "11"=>"1",
  958. "12"=>"2",
  959. "13"=>"3",
  960. "14"=>"4",
  961. "15"=>"5",
  962. "16"=>"6",
  963. "17"=>"7",
  964. "18"=>"8",
  965. "19"=>"9",
  966. "1A"=>"A",
  967. "1B"=>"B",
  968. "1C"=>"C",
  969. "1D"=>"F",
  970. "1E"=>"M",
  971. "1F"=>"¯",
  972. "20"=>" ",
  973. "21"=>"!",
  974. "22"=>"\"",
  975. "23"=>"#",
  976. "24"=>"\$",
  977. "25"=>"%",
  978. "26"=>"&",
  979. "27"=>"\'",
  980. "28"=>"(",
  981. "29"=>")",
  982. "2A"=>"*",
  983. "2B"=>"+",
  984. "2C"=>",",
  985. "2D"=>"-",
  986. "2E"=>".",
  987. "2F"=>"/",
  988. "30"=>"0",
  989. "31"=>"1",
  990. "32"=>"2",
  991. "33"=>"3",
  992. "34"=>"4",
  993. "35"=>"5",
  994. "36"=>"6",
  995. "37"=>"7",
  996. "38"=>"8",
  997. "39"=>"9",
  998. "3A"=>":",
  999. "3B"=>";",
  1000. "3C"=>"<",
  1001. "3D"=>"=",
  1002. "3E"=>">",
  1003. "3F"=>"?",
  1004. "40"=>"@",
  1005. "41"=>"A",
  1006. "42"=>"B",
  1007. "43"=>"C",
  1008. "44"=>"D",
  1009. "45"=>"E",
  1010. "46"=>"F",
  1011. "47"=>"G",
  1012. "48"=>"H",
  1013. "49"=>"I",
  1014. "4A"=>"J",
  1015. "4B"=>"K",
  1016. "4C"=>"L",
  1017. "4D"=>"M",
  1018. "4E"=>"N",
  1019. "4F"=>"O",
  1020. "50"=>"P",
  1021. "51"=>"Q",
  1022. "52"=>"R",
  1023. "53"=>"S",
  1024. "54"=>"T",
  1025. "55"=>"U",
  1026. "56"=>"V",
  1027. "57"=>"W",
  1028. "58"=>"X",
  1029. "59"=>"Y",
  1030. "5A"=>"Z",
  1031. "5B"=>"[",
  1032. "5C"=>"\\",
  1033. "5D"=>"]",
  1034. "5E"=>"^",
  1035. "5F"=>"_",
  1036. "60"=>"||",
  1037. "61"=>"a",
  1038. "62"=>"b",
  1039. "63"=>"c",
  1040. "64"=>"d",
  1041. "65"=>"e",
  1042. "66"=>"f",
  1043. "67"=>"g",
  1044. "68"=>"h",
  1045. "69"=>"i",
  1046. "6A"=>"j",
  1047. "6B"=>"k",
  1048. "6C"=>"l",
  1049. "6D"=>"m",
  1050. "6E"=>"n",
  1051. "6F"=>"o",
  1052. "70"=>"p",
  1053. "71"=>"q",
  1054. "72"=>"r",
  1055. "73"=>"s",
  1056. "74"=>"t",
  1057. "75"=>"u",
  1058. "76"=>"v",
  1059. "77"=>"w",
  1060. "78"=>"x",
  1061. "79"=>"y",
  1062. "7A"=>"z",
  1063. "7B"=>"{",
  1064. "7C"=>"|",
  1065. "7D"=>"}",
  1066. "7E"=>"~",
  1067. "7F"=>" ",
  1068. "80"=>"Œ",
  1069. "81"=>"œ",
  1070. "82"=>"?",
  1071. "83"=>"?",
  1072. "84"=>"p",
  1073. "85"=>" ",
  1074. "86"=>" ",
  1075. "87"=>" ",
  1076. "88"=>" ",
  1077. "89"=>" ",
  1078. "8A"=>" ",
  1079. "8B"=>" ",
  1080. "8C"=>"?",
  1081. "8D"=>"?",
  1082. "8E"=>"?",
  1083. "8F"=>"?",
  1084. "90"=>"+",
  1085. "91"=>"?",
  1086. "92"=>" ",
  1087. "93"=>" ",
  1088. "94"=>" ",
  1089. "95"=>" ",
  1090. "96"=>" ",
  1091. "97"=>" ",
  1092. "98"=>" ",
  1093. "99"=>" ",
  1094. "9A"=>" ",
  1095. "9B"=>" ",
  1096. "9C"=>" ",
  1097. "9D"=>" ",
  1098. "9E"=>" ",
  1099. "9F"=>" ",
  1100. "A0"=>" ",
  1101. "A1"=>"¡",
  1102. "A2"=>"¢",
  1103. "A3"=>"£",
  1104. "A4"=>"¤",
  1105. "A5"=>"¥",
  1106. "A6"=>"¦",
  1107. "A7"=>"§",
  1108. "A8"=>"¨",
  1109. "A9"=>"©",
  1110. "AA"=>"ª",
  1111. "AB"=>"«",
  1112. "AC"=>"¬",
  1113. "AD"=>"-",
  1114. "AE"=>"®",
  1115. "AF"=>"¯",
  1116. "B0"=>"°",
  1117. "B1"=>"±",
  1118. "B2"=>"²",
  1119. "B3"=>"³",
  1120. "B4"=>"´",
  1121. "B5"=>"µ",
  1122. "B6"=>"¶",
  1123. "B7"=>"·",
  1124. "B8"=>"¸",
  1125. "B9"=>"¹",
  1126. "BA"=>"º",
  1127. "BB"=>"»",
  1128. "BC"=>"¼",
  1129. "BD"=>"½",
  1130. "BE"=>"¾",
  1131. "BF"=>"¿",
  1132. "C0"=>"À",
  1133. "C1"=>"Á",
  1134. "C2"=>"Â",
  1135. "C3"=>"Ã",
  1136. "C4"=>"Ä",
  1137. "C5"=>"Å",
  1138. "C6"=>"Æ",
  1139. "C7"=>"Ç",
  1140. "C8"=>"È",
  1141. "C9"=>"É",
  1142. "CA"=>"Ê",
  1143. "CB"=>"Ë",
  1144. "CC"=>"Ì",
  1145. "CD"=>"Í",
  1146. "CE"=>"Î",
  1147. "CF"=>"ï",
  1148. "D0"=>"Ð",
  1149. "D1"=>"Ñ",
  1150. "D2"=>"Ò",
  1151. "D3"=>"Ó",
  1152. "D4"=>"Ô",
  1153. "D5"=>"Õ",
  1154. "D6"=>"Ö",
  1155. "D7"=>"×",
  1156. "D8"=>"Ø",
  1157. "D9"=>"Ù",
  1158. "DA"=>"Ú",
  1159. "DB"=>"Û",
  1160. "DC"=>"Ü",
  1161. "DD"=>"Ý",
  1162. "DE"=>"Þ",
  1163. "DF"=>"ß",
  1164. "E0"=>"à",
  1165. "E1"=>"á",
  1166. "E2"=>"â",
  1167. "E3"=>"ã",
  1168. "E4"=>"ä",
  1169. "E5"=>"å",
  1170. "E6"=>"æ",
  1171. "E7"=>"ç",
  1172. "E8"=>"è",
  1173. "E9"=>"é",
  1174. "EA"=>"ê",
  1175. "EB"=>"ë",
  1176. "EC"=>"ì",
  1177. "ED"=>"í",
  1178. "EE"=>"î",
  1179. "EF"=>"ï",
  1180. "F0"=>"ð",
  1181. "F1"=>"ñ",
  1182. "F2"=>"ò",
  1183. "F3"=>"ó",
  1184. "F4"=>"ô",
  1185. "F5"=>"õ",
  1186. "F6"=>"ö",
  1187. "F7"=>"÷",
  1188. "F8"=>"ø",
  1189. "F9"=>"ù",
  1190. "FA"=>"ú",
  1191. "FB"=>"û",
  1192. "FC"=>"ü",
  1193. "FD"=>"ý",
  1194. "FE"=>"þ",
  1195. "FF"=>"ÿ"
  1196. };
  1197. $hash->{helper}{CLEARONINPUTCHANGE} = {
  1198. "00"=>"screenLine01",
  1199. "01"=>"screenLine02",
  1200. "02"=>"screenLine03",
  1201. "03"=>"screenLine04",
  1202. "04"=>"screenLine05",
  1203. "05"=>"screenLine06",
  1204. "06"=>"screenLine07",
  1205. "07"=>"screenLine08",
  1206. "09"=>"screenLineType01",
  1207. "10"=>"screenLineType02",
  1208. "11"=>"screenLineType03",
  1209. "12"=>"screenLineType04",
  1210. "13"=>"screenLineType05",
  1211. "14"=>"screenLineType06",
  1212. "15"=>"screenLineType07",
  1213. "16"=>"screenLineType08",
  1214. "17"=>"screenLineHasFocus",
  1215. "18"=>"screenLineNumberFirst",
  1216. "19"=>"screenLineNumberLast",
  1217. "20"=>"screenLineNumbersTotal",
  1218. "21"=>"screenLineNumbers",
  1219. "22"=>"screenType",
  1220. "23"=>"screenName",
  1221. "24"=>"screenHierarchy",
  1222. "25"=>"screenTopMenuKey",
  1223. "26"=>"screenToolsKey",
  1224. "27"=>"screenReturnKey",
  1225. "28"=>"playStatus",
  1226. "29"=>"sourceInfo",
  1227. "30"=>"currentAlbum",
  1228. "31"=>"currentArtist",
  1229. "32"=>"currentTitle",
  1230. "33"=>"channel",
  1231. "34"=>"channelName",
  1232. "35"=>"channelStraight",
  1233. "36"=>"tunerFrequency"
  1234. };
  1235. ### initialize timer
  1236. $hash->{helper}{nextConnectionCheck} = gettimeofday()+120;
  1237. return undef;
  1238. }
  1239. #####################################
  1240. #Die Undef-Funktion ist das Gegenstück zur Define-Funktion und wird aufgerufen wenn ein Gerät mit delete gelöscht wird
  1241. # oder bei der Abarbeitung des Befehls rereadcfg, der ebenfalls alle Geräte löscht und danach das Konfigurationsfile neu abarbeitet.
  1242. # Entsprechend müssen in der Funktion typische Aufräumarbeiten durchgeführt werden wie das saubere Schließen von Verbindungen
  1243. # oder das Entfernen von internen Timern sofern diese im Modul zum Pollen verwendet wurden (siehe später).
  1244. #
  1245. #Zugewiesene Variablen im Hash der Geräteinstanz, Internals oder Readings müssen hier nicht gelöscht werden.
  1246. # In fhem.pl werden die entsprechenden Strukturen beim Löschen der Geräteinstanz ohnehin vollständig gelöscht.
  1247. sub
  1248. PIONEERAVR_Undef($$)
  1249. {
  1250. my ( $hash, $arg) = @_;
  1251. my $name = $hash->{NAME};
  1252. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_Undef() called";
  1253. RemoveInternalTimer( $hash);
  1254. # deleting port for clients
  1255. foreach my $d (sort keys %defs) {
  1256. if(defined($defs{$d}) &&
  1257. defined($defs{$d}{IODev}) &&
  1258. $defs{$d}{IODev} == $hash) {
  1259. my $lev = ($reread_active ? 4 : 2);
  1260. Log3 $hash, $lev, "PIONEERAVR $name: deleting port for $d";
  1261. delete $defs{$d}{IODev};
  1262. }
  1263. }
  1264. DevIo_CloseDev( $hash);
  1265. return undef;
  1266. }
  1267. #####################################
  1268. sub
  1269. PIONEERAVR_Ready($)
  1270. {
  1271. my ( $hash) = @_;
  1272. my $name = $hash->{NAME};
  1273. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_Ready() called at state: ".$hash->{STATE}." reading state:".ReadingsVal( $name, "state", "disconnected" );
  1274. if ( ReadingsVal( $name, "state", "disconnected" ) eq "disconnected" ) {
  1275. DevIo_OpenDev(
  1276. $hash, 1, undef,
  1277. sub() {
  1278. my ( $hash, $err ) = @_;
  1279. Log3 $name, 4, "PIONEERAVR $name: $err" if ($err);
  1280. }
  1281. );
  1282. return;
  1283. }
  1284. # This is relevant for windows/USB only
  1285. my $po = $hash->{USBDev};
  1286. my ($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags);
  1287. if($po) {
  1288. ($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags) = $po->status;
  1289. }
  1290. return ($InBytes && $InBytes>0);
  1291. }
  1292. sub PIONEERAVR_Notify($$) {
  1293. my ( $hash, $dev ) = @_;
  1294. my $name = $hash->{NAME};
  1295. my $devName = $dev->{NAME};
  1296. my $definedZones = scalar keys %{ $modules{PIONEERAVR_ZONE}{defptr}{$name} };
  1297. my $presence = ReadingsVal( $name, "presence", "-" );
  1298. return
  1299. if ( !$dev->{CHANGED} ); # Some previous notify deleted the array.
  1300. # work on global events related to us
  1301. if ( $devName eq "global" ) {
  1302. foreach my $change ( @{ $dev->{CHANGED} } ) {
  1303. if ( $change !~ /^(\w+)\s(\w+)\s?(\w*)\s?(.*)$/
  1304. || $2 ne $name )
  1305. {
  1306. return;
  1307. }
  1308. # DEFINED
  1309. # MODIFIED
  1310. elsif ( $1 eq "DEFINED" || $1 eq "MODIFIED" ) {
  1311. Log3 $hash, 5,
  1312. "PIONEERAVR "
  1313. . $name
  1314. . ": processing my global event $1: $3 -> $4";
  1315. if ( lc( ReadingsVal( $name, "state", "?" ) ) eq "opened" ) {
  1316. DoTrigger( $name, "CONNECTED" );
  1317. }
  1318. else {
  1319. DoTrigger( $name, "DISCONNECTED" );
  1320. }
  1321. }
  1322. # unknown event
  1323. else {
  1324. Log3 $hash, 5,
  1325. "PIONEERAVR "
  1326. . $name
  1327. . ": WONT BE processing my global event $1: $3 -> $4";
  1328. }
  1329. }
  1330. return;
  1331. }
  1332. # do nothing for any other device
  1333. elsif ( $devName ne $name ) {
  1334. return;
  1335. }
  1336. readingsBeginUpdate( $hash);
  1337. foreach my $change ( @{ $dev->{CHANGED} } ) {
  1338. # DISCONNECTED
  1339. if ( $change eq "DISCONNECTED" ) {
  1340. Log3 $hash, 5, "PIONEERAVR " . $name . ": processing change $change";
  1341. # disable connectionCheck and wait
  1342. # until DevIo reopened the connection
  1343. RemoveInternalTimer( $hash);
  1344. readingsBulkUpdate( $hash, "presence", "absent" )
  1345. if ( $presence ne "absent" );
  1346. readingsBulkUpdate( $hash, "power", "off" )
  1347. if ( ReadingsVal( $name, "power", "on" ) ne "off" );
  1348. # stateAV
  1349. my $stateAV = PIONEERAVR_GetStateAV( $hash);
  1350. readingsBulkUpdate( $hash, "stateAV", $stateAV )
  1351. if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
  1352. # send to slaves
  1353. if ( $definedZones > 1 ) {
  1354. Log3 $name, 5,
  1355. "PIONEERAVR $name: Dispatching state change to slaves";
  1356. Dispatch(
  1357. $hash,
  1358. {
  1359. "presence" => "absent",
  1360. "power" => "off",
  1361. },
  1362. undef
  1363. );
  1364. }
  1365. }
  1366. # CONNECTED
  1367. elsif ( $change eq "CONNECTED" ) {
  1368. Log3 $hash, 5, "PIONEERAVR " . $name . ": processing change $change";
  1369. readingsBulkUpdate( $hash, "presence", "present" )
  1370. if ( $presence ne "present" );
  1371. # stateAV
  1372. my $stateAV = PIONEERAVR_GetStateAV( $hash);
  1373. readingsBulkUpdate( $hash, "stateAV", $stateAV )
  1374. if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
  1375. PIONEERAVR_Write( $hash, "?P\n\r?M\n\r?V\n\r\?F\n\r" );
  1376. # send to slaves
  1377. if ( $definedZones > 1 ) {
  1378. Log3 $name, 5,
  1379. "PIONEERAVR $name: Dispatching state change to slaves";
  1380. Dispatch(
  1381. $hash,
  1382. {
  1383. "presence" => "present",
  1384. },
  1385. undef
  1386. );
  1387. }
  1388. }
  1389. }
  1390. readingsEndUpdate( $hash, 1 );
  1391. }
  1392. #####################################
  1393. sub
  1394. PIONEERAVR_DoInit($)
  1395. {
  1396. my $hash = shift;
  1397. my $name = $hash->{NAME};
  1398. Log3 $name, 5, "PIONEERAVR $name: PIONEER_DoInit() called";
  1399. PIONEERAVR_Clear( $hash);
  1400. $hash->{STATE} = "Initialized" if(!$hash->{STATE});
  1401. return undef;
  1402. }
  1403. #####################################
  1404. sub
  1405. PIONEERAVR_Clear($)
  1406. {
  1407. my $hash = shift;
  1408. my $name = $hash->{NAME};
  1409. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_Clear() called";
  1410. # Clear the pipe
  1411. DevIo_TimeoutRead( $hash, 0.1);
  1412. }
  1413. ####################################
  1414. sub
  1415. PIONEERAVR_Set($@)
  1416. {
  1417. my ($hash, $a, $h) = @_;
  1418. my $name = $hash->{NAME};
  1419. my $cmd = @$a[1];
  1420. my $arg = (@$a[2] ? @$a[2] : "");
  1421. my $presence = ReadingsVal( $name, "presence", "absent" );
  1422. my @args = @$a; shift @args; shift @args;
  1423. my @setsPlayer = ("play",
  1424. "pause",
  1425. "stop",
  1426. "repeat",
  1427. "shuffle",
  1428. "prev",
  1429. "next",
  1430. "rev",
  1431. "fwd",
  1432. "up",
  1433. "down",
  1434. "right",
  1435. "left",
  1436. "enter",
  1437. "return",
  1438. "menu",
  1439. "updateScreen",
  1440. "selectLine01",
  1441. "selectLine02",
  1442. "selectLine03",
  1443. "selectLine04",
  1444. "selectLine05",
  1445. "selectLine06",
  1446. "selectLine07",
  1447. "selectLine08",
  1448. "selectScreenPage" ); # available commands for certain inputs (@playerInputNr)
  1449. 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
  1450. my @setsTuner = ("channelUp",
  1451. "channelDown",
  1452. "channelStraight",
  1453. "channel"); # available commands for input tuner
  1454. my @setsWithoutArg = ("off",
  1455. "toggle",
  1456. "volumeUp",
  1457. "volumeDown",
  1458. "muteOn",
  1459. "muteOff",
  1460. "muteToggle",
  1461. "inputUp",
  1462. "inputDown" ); # set commands without arguments
  1463. my $playerCmd = "";
  1464. my $inputNr = "";
  1465. Log3 $name, 5, "PIONEERAVR $name: Processing PIONEERAVR_Set( $cmd )";
  1466. return "Argument is missing" if ( int(@$a) < 1 );
  1467. return "Device is offline and cannot be controlled at that stage."
  1468. if ( $presence eq "absent"
  1469. && lc( $cmd ) ne "on"
  1470. && lc( $cmd ) ne "?"
  1471. && lc( $cmd ) ne "reopen"
  1472. && lc( $cmd ) ne "help" );
  1473. # get all input names (preferable the aliasName) of the enabled inputs for the drop down list of "set <device> input xxx"
  1474. my @listInputNames = ();
  1475. foreach my $key ( keys %{$hash->{helper}{INPUTNAMES}} ) {
  1476. if (defined( $hash->{helper}{INPUTNAMES}->{$key}{enabled})) {
  1477. if ( $hash->{helper}{INPUTNAMES}->{$key}{enabled} eq "1" ) {
  1478. if ( $hash->{helper}{INPUTNAMES}{$key}{aliasName}) {
  1479. push(@listInputNames,$hash->{helper}{INPUTNAMES}{$key}{aliasName});
  1480. } elsif ( $hash->{helper}{INPUTNAMES}{$key}{name}) {
  1481. push(@listInputNames,$hash->{helper}{INPUTNAMES}{$key}{name});
  1482. }
  1483. }
  1484. }
  1485. }
  1486. my $inputsList=join(':', sort @listInputNames);
  1487. readingsSingleUpdate( $hash, "inputsList", $inputsList, 0 );
  1488. my $list = "reopen:noArg on:noArg off:noArg toggle:noArg input:"
  1489. . join(',', sort @listInputNames)
  1490. . " hdmiOut:"
  1491. . join(',', sort values (%{$hash->{helper}{HDMIOUT}}))
  1492. . " inputUp:noArg inputDown:noArg"
  1493. . " channelUp:noArg channelDown:noArg channelStraight"
  1494. # . join(',', sort values ( $hash->{helper}{TUNERCHANNELNAMES}))
  1495. . " channel:1,2,3,4,5,6,7,8,9"
  1496. . " listeningMode:"
  1497. . join(',', sort values (%{$hash->{helper}{LISTENINGMODES}}))
  1498. . " volumeUp:noArg volumeDown:noArg mute:on,off,toggle tone:on,bypass bass:slider,-6,1,6"
  1499. . " treble:slider,-6,1,6 statusRequest:noArg volume:slider,0,1," . AttrVal($name, "volumeLimit", (AttrVal($name, "volumeLimitStraight", 12)+80)/0.92)
  1500. . " volumeStraight:slider,-80,1," . AttrVal($name, "volumeLimitStraight", (AttrVal($name, "volumeLimit", 100)*0.92-80))
  1501. . " signalSelect:auto,analog,digital,hdmi,cycle"
  1502. . " speakers:off,A,B,A+B raw"
  1503. . " mcaccMemory:1,2,3,4,5,6 eq:on,off standingWave:on,off"
  1504. . " remoteControl:"
  1505. . join(',', sort keys (%{$hash->{helper}{REMOTECONTROL}}));
  1506. my $currentInput= ReadingsVal($name,"input","");
  1507. if (defined( $hash->{helper}{main}{CURINPUTNR})) {
  1508. $inputNr = $hash->{helper}{main}{CURINPUTNR};
  1509. }
  1510. #return "Can't find the current input - you might want to try 'get $name loadInputNames" if ($inputNr eq "");
  1511. # some input have more set commands ...
  1512. if ( $inputNr ~~ @playerInputNr ) {
  1513. $list .= " play:noArg stop:noArg pause:noArg repeat:noArg shuffle:noArg prev:noArg next:noArg rev:noArg fwd:noArg up:noArg down:noArg";
  1514. $list .= " right:noArg left:noArg enter:noArg return:noArg menu:noArg";
  1515. $list .= " updateScreen:noArg selectLine01:noArg selectLine02:noArg selectLine03:noArg selectLine04:noArg selectLine05:noArg selectLine06:noArg selectLine07:noArg selectLine08:noArg selectScreenPage ";
  1516. }
  1517. $list .= " networkStandby:on,off";
  1518. if ( $cmd eq "?" ) {
  1519. return SetExtensions( $hash, $list, $name, $cmd, @args);
  1520. # set <name> blink is part of the setextensions
  1521. # but blink does not make sense for an PioneerAVR so we disable it here
  1522. } elsif ( $cmd eq "blink" ) {
  1523. return "blink does not make too much sense with an PIONEER AV receiver isn't it?";
  1524. }
  1525. # process set <name> command (without further argument(s))
  1526. if(@$a == 2) {
  1527. Log3 $name, 5, "PIONEERAVR $name: Set $cmd (no arguments)";
  1528. # if the data connection between the PioneerAVR and Fhem is lost, we can try to reopen the data connection manually
  1529. if( $cmd eq "reopen" ) {
  1530. return PIONEERAVR_Reopen( $hash);
  1531. ### Power on
  1532. ### Command: PO
  1533. ### according to "Elite & Pioneer FY14AVR IP & RS-232 7-31-13.xlsx" (notice) we need to send <cr> and
  1534. ### wait 100ms before the first command is accepted by the Pioneer AV receiver
  1535. } elsif ( $cmd eq "on" ) {
  1536. Log3 $name, 5, "PIONEERAVR $name: Set $cmd -> 2x newline + 2x PO with 100ms break in between";
  1537. my $setCmd= "";
  1538. PIONEERAVR_Write( $hash, $setCmd);
  1539. select(undef, undef, undef, 0.1);
  1540. PIONEERAVR_Write( $hash, $setCmd);
  1541. select(undef, undef, undef, 0.1);
  1542. $setCmd= "\n\rPO";
  1543. PIONEERAVR_Write( $hash, $setCmd);
  1544. select(undef, undef, undef, 0.2);
  1545. PIONEERAVR_Write( $hash, $setCmd);
  1546. if (ReadingsVal($name,"networkStandby","") eq "off") {
  1547. return "NetworkStandby for the Pioneer AV receiver is off. If Fhem should be able to turn the AV Receiver on from standby enable networkStandby on the Pioneer AV Receiver (e.g. set $name networkStandby on )!";
  1548. } else {
  1549. return undef;
  1550. }
  1551. #### simple set commands without attributes
  1552. #### we just "translate" the human readable command to the PioneerAvr command
  1553. #### lookup in $hash->{helper}{SETS} if the command exists and what to write to PioneerAvr
  1554. } elsif ( $cmd ~~ @setsWithoutArg ) {
  1555. my $setCmd= $hash->{helper}{SETS}{main}{$cmd};
  1556. my $v= PIONEERAVR_Write( $hash, $setCmd);
  1557. Log3 $name, 5, "PIONEERAVR $name: Set $cmd (setsWithoutArg): ". $cmd ." -> $setCmd";
  1558. return undef;
  1559. # statusRequest: execute all "get" commands to update the readings
  1560. } elsif ( $cmd eq "statusRequest") {
  1561. Log3 $name, 5, "PIONEERAVR $name: Set $cmd ";
  1562. PIONEERAVR_statusUpdate( $hash);
  1563. return undef;
  1564. #### play, pause, stop, random, repeat,prev,next,rev,fwd,up,down,right,left,enter,return,menu
  1565. #### Only available if the input is one of:
  1566. #### ipod, internetRadio, mediaServer, favorites, adapterPort, mhl
  1567. #### we need to send different commands to the Pioneer AV receiver
  1568. #### depending on that input
  1569. } elsif ($cmd ~~ @setsPlayer) {
  1570. Log3 $name, 5, "PIONEERAVR $name: set $cmd for inputNr: $inputNr (player command)";
  1571. if ($inputNr eq "17") {
  1572. $playerCmd = $cmd."Ipod";
  1573. } elsif ( $inputNr eq "33"
  1574. && ( $cmd ne "updateScreen" )
  1575. && ( $cmd ne "selectLine01" )
  1576. && ( $cmd ne "selectLine02" )
  1577. && ( $cmd ne "selectLine03" )
  1578. && ( $cmd ne "selectLine04" )
  1579. && ( $cmd ne "selectLine05" )
  1580. && ( $cmd ne "selectLine06" )
  1581. && ( $cmd ne "selectLine07" )
  1582. && ( $cmd ne "selectLine08" ) )
  1583. {
  1584. $playerCmd= $cmd."AdapterPort";
  1585. #### homeMediaGallery, sirius, internetRadio, pandora, mediaServer, favorites, spotify
  1586. } elsif (($inputNr eq "26") ||($inputNr eq "27") || ($inputNr eq "38") || ($inputNr eq "41") || ($inputNr eq "44") || ($inputNr eq "45") || ($inputNr eq "53")) {
  1587. $playerCmd= $cmd."Network";
  1588. #### 'random' and 'repeat' are not available on input mhl
  1589. } elsif (( $inputNr eq "48" )
  1590. && ( $cmd ne "repeat")
  1591. && ( $cmd ne "random")
  1592. && ( $cmd ne "updateScreen" )
  1593. && ( $cmd ne "selectLine01" )
  1594. && ( $cmd ne "selectLine02" )
  1595. && ( $cmd ne "selectLine03" )
  1596. && ( $cmd ne "selectLine04" )
  1597. && ( $cmd ne "selectLine05" )
  1598. && ( $cmd ne "selectLine06" )
  1599. && ( $cmd ne "selectLine07" )
  1600. && ( $cmd ne "selectLine08" ) ) {
  1601. $playerCmd= $cmd."Mhl";
  1602. } else {
  1603. my $err= "PIONEERAVR $name: The command $cmd for input nr. $inputNr is not possible!";
  1604. Log3 $name, 3, $err;
  1605. return $err;
  1606. }
  1607. my $setCmd= $hash->{helper}{SETS}{main}{$playerCmd};
  1608. PIONEERAVR_Write( $hash, $setCmd);
  1609. return undef;
  1610. #### channelUp, channelDown
  1611. #### Only available if the input is 02 (tuner)
  1612. } elsif ($cmd ~~ @setsTuner) {
  1613. Log3 $name, 5, "PIONEERAVR $name: set $cmd for inputNr: $inputNr (tuner command)";
  1614. if ($inputNr eq "02") {
  1615. my $setCmd= $hash->{helper}{SETS}{main}{$cmd};
  1616. PIONEERAVR_Write( $hash, $setCmd);
  1617. } else {
  1618. my $err= "PIONEERAVR $name: The tuner command $cmd for input nr. $inputNr is not possible!";
  1619. Log3 $name, 3, $err;
  1620. return $err;
  1621. }
  1622. return undef;
  1623. }
  1624. #### commands with argument(s)
  1625. } elsif(@$a > 2) {
  1626. ####Raw
  1627. #### sends $arg to the PioneerAVR
  1628. if($cmd eq "raw") {
  1629. my $allArgs= join " ", @args;
  1630. Log3 $name, 5, "PIONEERAVR $name: sending raw command ".dq($allArgs);
  1631. PIONEERAVR_Write( $hash, $allArgs);
  1632. return undef;
  1633. ####Input (all available Inputs of the Pioneer AV receiver -> see 'get $name loadInputNames')
  1634. #### according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  1635. #### first try the aliasName (only if this fails try the default input name)
  1636. } elsif ( $cmd eq "input" ) {
  1637. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1638. foreach my $key ( keys %{$hash->{helper}{INPUTNAMES}} ) {
  1639. if ( $hash->{helper}{INPUTNAMES}->{$key}{aliasName} eq $arg ) {
  1640. PIONEERAVR_Write( $hash, sprintf "%02dFN", $key );
  1641. } elsif ( $hash->{helper}{INPUTNAMES}->{$key}{name} eq $arg ) {
  1642. PIONEERAVR_Write( $hash, sprintf "%02dFN", $key );
  1643. }
  1644. }
  1645. return undef;
  1646. ####hdmiOut
  1647. } elsif ( $cmd eq "hdmiOut" ) {
  1648. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1649. foreach my $key ( keys %{$hash->{helper}{HDMIOUT}} ) {
  1650. if ( $hash->{helper}{LISTENINGMODES}->{$key} eq $arg ) {
  1651. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg)." -> found nr: ".$key." for HDMIOut ".dq($arg);
  1652. PIONEERAVR_Write( $hash, sprintf "%dHO", $key);
  1653. return undef;
  1654. }
  1655. }
  1656. my $err= "PIONEERAVR $name: Error: unknown HDMI Out $cmd --- $arg !";
  1657. Log3 $name, 3, $err;
  1658. return $err;
  1659. ####ListeningMode
  1660. } elsif ( $cmd eq "listeningMode" ) {
  1661. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1662. foreach my $key ( keys %{$hash->{helper}{LISTENINGMODES}} ) {
  1663. if ( $hash->{helper}{LISTENINGMODES}->{$key} eq $arg ) {
  1664. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg)." -> found nr: ".$key." for listeningMode ".dq($arg);
  1665. PIONEERAVR_Write( $hash, sprintf "%04dSR", $key);
  1666. return undef;
  1667. }
  1668. }
  1669. my $err= "PIONEERAVR $name: Error: unknown listeningMode $cmd --- $arg !";
  1670. Log3 $name, 3, $err;
  1671. return $err;
  1672. #####VolumeStraight (-80.5 - 12) in dB
  1673. ####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  1674. # PioneerAVR expects values between 000 - 185
  1675. } elsif ( $cmd eq "volumeStraight" ) {
  1676. if (AttrVal($name, "volumeLimitStraight", 12) < $arg ) {
  1677. $arg = AttrVal($name, "volumeLimitStraight", 12);
  1678. }
  1679. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1680. my $pioneerVol = (80.5 + $arg)*2;
  1681. PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol);
  1682. return undef;
  1683. ####Volume (0 - 100) in %
  1684. ####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  1685. # PioneerAVR expects values between 000 - 185
  1686. } elsif ( $cmd eq "volume" ) {
  1687. if (AttrVal($name, "volumeLimit", 100) < $arg ) {
  1688. $arg = AttrVal($name, "volumeLimit", 100);
  1689. }
  1690. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1691. my $pioneerVol = sprintf "%d", $arg * 1.85;
  1692. PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol);
  1693. return undef;
  1694. ####tone (on|bypass)
  1695. } elsif ( $cmd eq "tone" ) {
  1696. if ($arg eq "on") {
  1697. PIONEERAVR_Write( $hash, "1TO");
  1698. }
  1699. elsif ($arg eq "bypass") {
  1700. PIONEERAVR_Write( $hash, "0TO");
  1701. } else {
  1702. my $err= "PIONEERAVR $name: Error: unknown set ... tone argument: $arg !";
  1703. Log3 $name, 3, $err;
  1704. return $err;
  1705. }
  1706. return undef;
  1707. ####bass (-6 - 6) in dB
  1708. } elsif ( $cmd eq "bass" ) {
  1709. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1710. my $zahl = sprintf "%d", ($arg * (-1)) + 6;
  1711. PIONEERAVR_Write( $hash, sprintf "%02dBA", $zahl);
  1712. return undef;
  1713. ####treble (-6 - 6) in dB
  1714. } elsif ( $cmd eq "treble" ) {
  1715. Log3 $name, 5, "PIONEERAVR $name: set $cmd ".dq($arg);
  1716. my $zahl = sprintf "%d", ($arg * (-1)) + 6;
  1717. PIONEERAVR_Write( $hash, sprintf "%02dTR", $zahl);
  1718. return undef;
  1719. ####Mute (on|off|toggle)
  1720. ####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  1721. } elsif ( $cmd eq "mute" ) {
  1722. if ($arg eq "on") {
  1723. PIONEERAVR_Write( $hash, "MO");
  1724. readingsSingleUpdate( $hash, "mute", "on", 1 );
  1725. }
  1726. elsif ($arg eq "off") {
  1727. PIONEERAVR_Write( $hash, "MF");
  1728. readingsSingleUpdate( $hash, "mute", "off", 1 );
  1729. }
  1730. elsif ($arg eq "toggle") {
  1731. PIONEERAVR_Write( $hash, "MZ");
  1732. } else {
  1733. my $err= "PIONEERAVR $name: Error: unknown set ... mute argument: $arg !";
  1734. Log3 $name, 3, $err;
  1735. return $err;
  1736. }
  1737. return undef;
  1738. #### channelStraight
  1739. #### set tuner preset in Pioneer preset format (A1...G9)
  1740. #### Only available if the input is 02 (tuner)
  1741. #### X0YPR -> X = tuner preset class (A...G), Y = tuner preset number (1...9)
  1742. } elsif ($cmd eq "channelStraight" ) {
  1743. Log3 $name, 5, "PIONEERAVR $name: set $cmd for inputNr: $inputNr $arg (tuner command only available for 02)";
  1744. if (($inputNr eq "02") && $arg =~ m/([A-G])([1-9])/ ) {
  1745. my $setCmd= $1."0".$2."PR";
  1746. PIONEERAVR_Write( $hash,$setCmd);
  1747. } else {
  1748. my $err= "PIONEERAVR $name: Error: set ... channelStraight only available for input 02 (tuner) - not for $inputNr !";
  1749. Log3 $name, 3, $err;
  1750. return $err;
  1751. }
  1752. return undef;
  1753. #### channel
  1754. ####according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  1755. #### set tuner preset numeric (1...9)
  1756. #### Only available if the input is 02 (tuner)
  1757. #### XTP -> X = tuner preset number (1...9)
  1758. } elsif ($cmd eq "channel" ) {
  1759. Log3 $name, 5, "PIONEERAVR $name: set $cmd for inputNr: $inputNr $arg (tuner command)";
  1760. if (($inputNr eq "02") && $arg =~ m/([1-9])/ ) {
  1761. my $setCmd= $1."TP";
  1762. PIONEERAVR_Write( $hash,$setCmd);
  1763. } else {
  1764. my $err= "PIONEERAVR $name: Error: set ... channel only available for input 02 (tuner) - not for $inputNr !";
  1765. Log3 $name, 3, $err;
  1766. return $err;
  1767. }
  1768. return undef;
  1769. ####Speakers (off|A|B|A+B)
  1770. } elsif ( $cmd eq "speakers" ) {
  1771. Log3 $name, 5, "PIONEERAVR $name: set $cmd $arg";
  1772. if ($arg eq "off") {
  1773. PIONEERAVR_Write( $hash, "0SPK");
  1774. } elsif ($arg eq "A") {
  1775. PIONEERAVR_Write( $hash, "1SPK");
  1776. } elsif ($arg eq "B") {
  1777. PIONEERAVR_Write( $hash, "2SPK");
  1778. } elsif ($arg eq "A+B") {
  1779. PIONEERAVR_Write( $hash, "3SPK");
  1780. } else {
  1781. my $err= "PIONEERAVR $name: Error: unknown argument $arg in set ... speakers. Must be one of off, A, B, A+B !";
  1782. Log3 $name, 5, $err;
  1783. return $err;
  1784. }
  1785. return undef;
  1786. ####Signal select (auto|analog|digital|hdmi|cycle)
  1787. } elsif ( $cmd eq "signalSelect" ) {
  1788. Log3 $name, 5, "PIONEERAVR $name: set $cmd $arg";
  1789. if ($arg eq "auto") {
  1790. PIONEERAVR_Write( $hash, "0SDA");
  1791. } elsif ($arg eq "analog") {
  1792. PIONEERAVR_Write( $hash, "1SDA");
  1793. } elsif ($arg eq "digital") {
  1794. PIONEERAVR_Write( $hash, "2SDA");
  1795. } elsif ($arg eq "hdmi") {
  1796. PIONEERAVR_Write( $hash, "3SDA");
  1797. } elsif ($arg eq "cycle") {
  1798. PIONEERAVR_Write( $hash, "9SDA");
  1799. } else {
  1800. my $err= "PIONEERAVR $name: Error: unknown argument $arg in set ... signalSelect. Must be one of auto|analog|digital|hdmi|cycle !";
  1801. Log3 $name, 5, $err;
  1802. return $err;
  1803. }
  1804. return undef;
  1805. #mcacc memory
  1806. } elsif ($cmd eq "mcaccMemory") {
  1807. if ($arg > 0 and $arg < 7) {
  1808. my $setCmd = $arg."MC";
  1809. Log3 $name, 5, "PIONEERAVR $name: setting MCACC memory to ".dq($arg);
  1810. PIONEERAVR_Write( $hash, $setCmd);
  1811. return undef;
  1812. } else {
  1813. my $err= "PIONEERAVR $name: Error: unknown argument $arg in set ... mcaccMemory!";
  1814. Log3 $name, 5, $err;
  1815. return $err;
  1816. }
  1817. # eq on/off/toggle
  1818. } elsif ( $cmd eq "eq" ) {
  1819. if ($arg eq "on") {
  1820. PIONEERAVR_Write( $hash, "1ATC");
  1821. }
  1822. elsif ($arg eq "off") {
  1823. PIONEERAVR_Write( $hash, "0ATC");
  1824. } else {
  1825. my $err= "PIONEERAVR $name: Error: unknown set ... eq argument: $arg !";
  1826. Log3 $name, 3, $err;
  1827. return $err;
  1828. }
  1829. # standingWave on/off/toggle
  1830. } elsif ( $cmd eq "standingWave" ) {
  1831. if ( $arg eq "on" ) {
  1832. PIONEERAVR_Write( $hash, "1ATD" );
  1833. } elsif ( $arg eq "off" ) {
  1834. PIONEERAVR_Write( $hash, "0ATD" );
  1835. } else {
  1836. my $err= "PIONEERAVR $name: Error: unknown set ... standingWave argument: $arg !";
  1837. Log3 $name, 3, $err;
  1838. return $err;
  1839. }
  1840. # Network standby (on|off)
  1841. # needs to be "on" to turn on the Pioneer AVR via this module
  1842. } elsif ( $cmd eq "networkStandby" ) {
  1843. if ( $arg eq "on" ) {
  1844. PIONEERAVR_Write( $hash, "1STJ");
  1845. }
  1846. elsif ( $arg eq "off" ) {
  1847. PIONEERAVR_Write( $hash, "0STJ" );
  1848. } else {
  1849. my $err= "PIONEERAVR $name: Error: unknown set ... networkStandby argument: $arg !";
  1850. Log3 $name, 3, $err;
  1851. return $err;
  1852. }
  1853. return undef;
  1854. # selectScreenPage (player command)
  1855. } elsif ($cmd eq "selectScreenPage") {
  1856. Log3 $name, 5, "PIONEERAVR $name: set $cmd for inputNr: $inputNr (player command) argument: $arg !";
  1857. if ($inputNr eq "17") {
  1858. my $setCmd = sprintf "%05dGGI", $arg;
  1859. PIONEERAVR_Write( $hash, $setCmd);
  1860. return undef;
  1861. #### homeMediaGallery, sirius, internetRadio, pandora, mediaServer, favorites, spotify
  1862. } elsif ( ( $inputNr eq "26")
  1863. || ( $inputNr eq "27" )
  1864. || ( $inputNr eq "38" )
  1865. || ( $inputNr eq "41" )
  1866. || ( $inputNr eq "44" )
  1867. || ( $inputNr eq "45" )
  1868. || ( $inputNr eq "53" ) )
  1869. {
  1870. my $setCmd = sprintf "%05dGGH", $arg;
  1871. PIONEERAVR_Write( $hash, $setCmd);
  1872. return undef;
  1873. }
  1874. ####remoteControl
  1875. } elsif ( $cmd eq "remoteControl" ) {
  1876. Log3 $name, 5, "PIONEERAVR $name: set $cmd $arg";
  1877. if (exists $hash->{helper}{REMOTECONTROL}{$arg}) {
  1878. my $setCmd= $hash->{helper}{REMOTECONTROL}{$arg};
  1879. my $v= PIONEERAVR_Write( $hash, $setCmd);
  1880. } else {
  1881. my $err= "PIONEERAVR $name: Error: unknown argument $arg in set ... remoteControl!";
  1882. Log3 $name, 5, $err;
  1883. return $err;
  1884. }
  1885. return undef;
  1886. } else {
  1887. return SetExtensions( $hash, $list, $name, $cmd, @args);
  1888. }
  1889. } else {
  1890. return SetExtensions( $hash, $list, $name, $cmd, @args);
  1891. }
  1892. }
  1893. #####################################
  1894. sub PIONEERAVR_Get($$$) {
  1895. my ( $hash, $a, $h ) = @_;
  1896. my $name = $hash->{NAME};
  1897. my $cmd = @$a[1];
  1898. my $presence = ReadingsVal( $name, "presence", "absent" );
  1899. Log3 $name, 5, "PIONEERAVR $name: called function PIONEERAVR_AVR_Get()";
  1900. return "get $name needs at least one parameter" if ( int(@$a) < 1 );
  1901. # readings
  1902. return $hash->{READINGS}{ @$a[1] }{VAL}
  1903. if ( defined( $hash->{READINGS}{ @$a[1] } ) );
  1904. return "Device is offline and cannot be controlled at that stage."
  1905. if ( $presence eq "absent" );
  1906. ####loadInputNames
  1907. if ( $cmd eq "loadInputNames" ) {
  1908. Log3 $name, 5, "PIONEERAVR $name: processing get loadInputNames";
  1909. PIONEERAVR_askForInputNames( $hash, 5);
  1910. return "updating input names - this may take up to one minute.";
  1911. } elsif ( !defined( $hash->{helper}{GETS}{main}{$cmd})) {
  1912. my $gets= "";
  1913. foreach my $key ( keys %{$hash->{helper}{GETS}{main}} ) {
  1914. $gets.= $key.":noArg ";
  1915. }
  1916. return "$name error: unknown argument $cmd, choose one of loadInputNames:noArg " . $gets;
  1917. ####get commands for the main zone without arguments
  1918. #### Fhem commands are translated to PioneerAVR commands as defined in PIONEERAVR_Define -> {helper}{GETS}{main}
  1919. } elsif ( defined( $hash->{helper}{GETS}{main}{$cmd} ) ) {
  1920. my $pioneerCmd = $hash->{helper}{GETS}{main}{$cmd};
  1921. my $v = PIONEERAVR_Write( $hash, $pioneerCmd);
  1922. return "updating $cmd .";
  1923. }
  1924. }
  1925. #####################################
  1926. # called from the global loop, when the select for hash->{FD} reports data
  1927. # PIONEERAVR_Read() makes sure, that a message is complete and correct,
  1928. # and calls the global Dispatch() with one message if this message is not for the main zone
  1929. # as the main zone is handled here
  1930. sub PIONEERAVR_Read($)
  1931. {
  1932. my ( $hash) = @_;
  1933. my $name = $hash->{NAME};
  1934. my $state = '';
  1935. my $msgForZone = "";
  1936. my $buf = '';
  1937. #include previous partial message
  1938. if ( defined( $hash->{PARTIAL} ) && $hash->{PARTIAL} ) {
  1939. $buf = $hash->{PARTIAL} . DevIo_SimpleRead( $hash);
  1940. } else {
  1941. $buf = DevIo_SimpleRead( $hash);
  1942. }
  1943. return if(!defined($buf));
  1944. my $logMsg = "Spontaneously received " . dq($buf);
  1945. PIONEERAVR_Log( $hash, undef, $logMsg);
  1946. # Connection still up!
  1947. # We received something from the Pioneer AV receiver (otherwise we would not be here)
  1948. # So we can assume that the connection is up.
  1949. # We delete the current "inactivity timer" and set a new timer
  1950. # to check if the connection to the Pioneer AV receiver is still working in 120s
  1951. # reset connectionCheck timer
  1952. my $checkInterval = AttrVal( $name, "connectionCheck", "60" );
  1953. RemoveInternalTimer( $hash, "PIONEERAVR_connectionCheck" );
  1954. if ( $checkInterval ne "off" ) {
  1955. my $next = gettimeofday() + $checkInterval;
  1956. $hash->{helper}{nextConnectionCheck} = $next;
  1957. InternalTimer( $next, "PIONEERAVR_connectionCheck", $hash, 0 );
  1958. Log3 $hash, 5, "PIONEERAVR $name: Connection is up --- Check again in $checkInterval s --> Internal timer set";
  1959. } else {
  1960. Log3 $hash, 5, "PIONEERAVR $name: Connection is up --- checkConnection is disabled";
  1961. }
  1962. # $buf can contain more than one line of information
  1963. # the lines are separated by "\r\n"
  1964. # if the information in the line is not for the main zone it is dispatched to
  1965. # all listening modules otherwise we process it here
  1966. readingsBeginUpdate( $hash);
  1967. while($buf =~ m/^(.*?)\r\n(.*)\Z/s ) {
  1968. my $line = $1;
  1969. $buf = $2;
  1970. Log3 $name, 5, "PIONEERAVR $name: processing ". dq( $line ) ." received from PIONEERAVR";
  1971. Log3 $name, 5, "PIONEERAVR $name: line to do soon: " . dq($buf) unless ($buf eq "");
  1972. if ( ( $line eq "R" ) || ( $line eq "" ) ) {
  1973. Log3 $hash, 5, "PIONEERAVR $name: Supressing received " . dq( $line );
  1974. # Main zone volume
  1975. } elsif ( substr($line,0,3) eq "VOL" ) {
  1976. my $volume = substr( $line,3,3 );
  1977. my $volume_st = $volume/2 - 80.5;
  1978. my $volume_vl = $volume/1.85;
  1979. readingsBulkUpdate( $hash, "volumeStraight", $volume_st);
  1980. readingsBulkUpdate( $hash, "volume", sprintf "%d", $volume_vl);
  1981. Log3 $name, 5, "PIONEERAVR $name: ". dq( $line ) ." interpreted as: Main Zone - New volume = ".$volume . " (raw volume data).";
  1982. # correct volume if it is over the limit
  1983. if ( AttrVal( $name, "volumeLimitStraight", 12 ) < $volume_st or AttrVal( $name, "volumeLimit", 100 ) < $volume_vl ) {
  1984. my $limit_st = AttrVal( $name, "volumeLimitStraight", 12 );
  1985. my $limit_vl = AttrVal( $name, "volumeLimit", 100 );
  1986. $limit_st = $limit_vl*0.92-80 if ($limit_vl*0.92-80 < $limit_st);
  1987. my $pioneerVol = ( 80.5 + $limit_st )*2;
  1988. PIONEERAVR_Write( $hash, sprintf "%03dVL", $pioneerVol);
  1989. }
  1990. # Main zone tone (0 = bypass, 1 = on)
  1991. } elsif ( $line =~ m/^TO([0|1])$/) {
  1992. if ($1 == "1") {
  1993. readingsBulkUpdate( $hash, "tone", "on" );
  1994. Log3 $name, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Main Zone - tone on ";
  1995. }
  1996. else {
  1997. readingsBulkUpdate( $hash, "tone", "bypass" );
  1998. Log3 $name, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Main Zone - tone bypass ";
  1999. }
  2000. # Main zone bass (-6 to +6 dB)
  2001. # works only if tone=on
  2002. } elsif ( $line =~ m/^BA(\d\d)$/ ) {
  2003. readingsBulkUpdate( $hash, "bass", ( $1 *(-1) ) + 6 );
  2004. Log3 $name, 5, "PIONEERAVR $name: ". dq( $line ) ." interpreted as: Main Zone - New bass = ".$1 . " (raw bass data).";
  2005. # Main zone treble (-6 to +6 dB)
  2006. # works only if tone=on
  2007. } elsif ( $line =~ m/^TR(\d\d)$/ ) {
  2008. readingsBulkUpdate( $hash, "treble", ( $1 *(-1) ) + 6 );
  2009. Log3 $name, 5, "PIONEERAVR $name: ". dq( $line ) ." interpreted as: Main Zone - New treble = ".$1 . " (raw treble data).";
  2010. # Main zone Mute
  2011. } elsif ( substr( $line,0,3 ) eq "MUT" ) {
  2012. my $mute = substr( $line, 3, 1 );
  2013. if ($mute == "1") {
  2014. readingsBulkUpdate( $hash, "mute", "off" );
  2015. Log3 $name, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Main Zone - Mute off ";
  2016. }
  2017. else {
  2018. readingsBulkUpdate( $hash, "mute", "on" );
  2019. Log3 $name, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Main Zone - Mute on ";
  2020. }
  2021. } elsif ( $line =~ m/^AST(\d{2})(\d{2})(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d*)$/ ) {
  2022. # Audio information parameters
  2023. # data1-data2:Audio Input Signal
  2024. # data3-data4:Audio Input Frequency
  2025. # data5-data20 (for some models data5-data25):Audio Input Channel Format
  2026. if ( defined ( $hash->{helper}{AUDIOINPUTSIGNAL}->{$1} ) ) {
  2027. readingsBulkUpdate( $hash, "audioInputSignal", $hash->{helper}{AUDIOINPUTSIGNAL}->{$1} );
  2028. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: audio input signal: ". dq( $1 );
  2029. }
  2030. else {
  2031. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown audio input signal: ". dq( $1 );
  2032. }
  2033. if ( defined ( $hash->{helper}{AUDIOINPUTFREQUENCY}->{$2}) ) {
  2034. readingsBulkUpdate( $hash, "audioInputFrequency", $hash->{helper}{AUDIOINPUTFREQUENCY}->{$2} );
  2035. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: audio input frequency: ". dq( $2 );
  2036. }
  2037. else {
  2038. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown audio input frequency: ". dq( $2 );
  2039. }
  2040. readingsBulkUpdate( $hash, "audioInputFormatL", $3 );
  2041. readingsBulkUpdate( $hash, "audioInputFormatC", $4 );
  2042. readingsBulkUpdate( $hash, "audioInputFormatR", $5 );
  2043. readingsBulkUpdate( $hash, "audioInputFormatSL", $6 );
  2044. readingsBulkUpdate( $hash, "audioInputFormatSR", $7 );
  2045. readingsBulkUpdate( $hash, "audioInputFormatSLB", $8 );
  2046. readingsBulkUpdate( $hash, "audioInputFormatS", $9 );
  2047. readingsBulkUpdate( $hash, "audioInputFormatSBR", $10 );
  2048. readingsBulkUpdate( $hash, "audioInputFormatLFE", $11 );
  2049. readingsBulkUpdate( $hash, "audioInputFormatFHL", $12 );
  2050. readingsBulkUpdate( $hash, "audioInputFormatFHR", $13 );
  2051. readingsBulkUpdate( $hash, "audioInputFormatFWL", $14 );
  2052. readingsBulkUpdate( $hash, "audioInputFormatFWR", $15 );
  2053. readingsBulkUpdate( $hash, "audioInputFormatXL", $16 );
  2054. readingsBulkUpdate( $hash, "audioInputFormatXC", $17 );
  2055. readingsBulkUpdate( $hash, "audioInputFormatXR", $18 );
  2056. if ( $19=~ m/^(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d{2})(\d{2})(\d{4})(\d)(\d{2})(\d)$/ ) {
  2057. # Some Pioneer AVR models (e.g. VSX-921) return less then 55 data bytes - the first 20 bytes can still be used
  2058. # here are the bytes 21-55 processed ... e.g. for VSX-923
  2059. # data26-data43:Audio Output Channel
  2060. # data44-data45:Audio Output Frequency
  2061. # data46-data47:Audio Output bit
  2062. # data48-data51:Reserved
  2063. # data52:Working PQLS
  2064. # data53-data54:Working Auto Phase Control Plus (in ms)(ignored)
  2065. # data55:Working Auto Phase Control Plus (Reverse Phase) (0... no revers phase, 1...reverse phase)
  2066. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." AST with 55 data bytes ";
  2067. #readingsBulkUpdate( $hash, "audioInputFormatReserved1", $1);
  2068. #readingsBulkUpdate( $hash, "audioInputFormatReserved2", $2);
  2069. #readingsBulkUpdate( $hash, "audioInputFormatReserved3", $3);
  2070. #readingsBulkUpdate( $hash, "audioInputFormatReserved4", $4);
  2071. #readingsBulkUpdate( $hash, "audioInputFormatReserved5", $5);
  2072. readingsBulkUpdate( $hash, "audioOutputFormatL", $6 );
  2073. readingsBulkUpdate( $hash, "audioOutputFormatC", $7 );
  2074. readingsBulkUpdate( $hash, "audioOutputFormatR", $8 );
  2075. readingsBulkUpdate( $hash, "audioOutputFormatSL", $9 );
  2076. readingsBulkUpdate( $hash, "audioOutputFormatSR", $10 );
  2077. readingsBulkUpdate( $hash, "audioOutputFormatSBL", $11 );
  2078. readingsBulkUpdate( $hash, "audioOutputFormatSB", $12 );
  2079. readingsBulkUpdate( $hash, "audioOutputFormatSBR", $13 );
  2080. readingsBulkUpdate( $hash, "audioOutputFormatSW", $14 );
  2081. readingsBulkUpdate( $hash, "audioOutputFormatFHL", $15);
  2082. readingsBulkUpdate( $hash, "audioOutputFormatFHR", $16 );
  2083. readingsBulkUpdate( $hash, "audioOutputFormatFWL", $17 );
  2084. readingsBulkUpdate( $hash, "audioOutputFormatFWR", $18 );
  2085. # readingsBulkUpdate( $hash, "audioOutputFormatReserved1", $19);
  2086. # readingsBulkUpdate( $hash, "audioOutputFormatReserved2", $20);
  2087. # readingsBulkUpdate( $hash, "audioOutputFormatReserved3", $21);
  2088. # readingsBulkUpdate( $hash, "audioOutputFormatReserved4", $22);
  2089. # readingsBulkUpdate( $hash, "audioOutputFormatReserved5", $23);
  2090. if ( defined ( $hash->{helper}{AUDIOOUTPUTFREQUENCY}->{$24}) ) {
  2091. readingsBulkUpdate( $hash, "audioOutputFrequency", $hash->{helper}{AUDIOOUTPUTFREQUENCY}->{$24} );
  2092. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: audio output frequency: ". dq( $24 );
  2093. } else {
  2094. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown audio output frequency: ". dq( $24 );
  2095. }
  2096. readingsBulkUpdate( $hash, "audioOutputBit", $25 );
  2097. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: audio input bit: ". dq( $25 );
  2098. if ( defined ( $hash->{helper}{PQLSWORKING}->{$27} ) ) {
  2099. readingsBulkUpdate( $hash, "pqlsWorking", $hash->{helper}{PQLSWORKING}->{$27} );
  2100. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: working PQLS: ". dq( $27 );
  2101. } else {
  2102. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown working PQLS: ". dq( $27 );
  2103. }
  2104. readingsBulkUpdate( $hash, "audioAutoPhaseControlMS", $28 );
  2105. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: working audio auto phase control plus (in ms): ". dq( $28 );
  2106. readingsBulkUpdate( $hash, "audioAutoPhaseControlRevPhase", $29);
  2107. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: working audio auto phase control plus reverse phase: ". dq( $29 );
  2108. } else {
  2109. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." AST with NOT 55 data bytes ... some audio parameters like audioOutputFormatXXX could not be set";
  2110. }
  2111. # Main zone Input
  2112. } elsif ( $line =~ m/^FN(\d\d)$/ ) {
  2113. my $inputNr = $1;
  2114. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Main Zone - Input is set to inputNr: $inputNr ";
  2115. if ( $hash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} ) {
  2116. readingsBulkUpdate( $hash, "input", $hash->{helper}{INPUTNAMES}{$inputNr}{aliasName} );
  2117. Log3 $hash, 5, "PIONEERAVR $name: Main Input aliasName for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{aliasName};
  2118. } elsif ( defined ( $hash->{helper}{INPUTNAMES}{$inputNr}{name}) ) {
  2119. readingsBulkUpdate( $hash, "input", $hash->{helper}{INPUTNAMES}{$inputNr}{name} );
  2120. Log3 $hash, 5, "PIONEERAVR $name: Main Input Name for input $inputNr is " . $hash->{helper}{INPUTNAMES}{$inputNr}{name};
  2121. } else {
  2122. readingsBulkUpdate( $hash, "input", $line );
  2123. Log3 $hash, 3, "PIONEERAVR $name: Main InputName: can't find Name for input $inputNr";
  2124. }
  2125. $hash->{helper}{main}{CURINPUTNR} = $inputNr;
  2126. # if($inputNr != "17" and $inputNr != "44" and $inputNr != "45"){
  2127. # clear screen information on input change...
  2128. foreach my $key ( keys %{$hash->{helper}{CLEARONINPUTCHANGE}} ) {
  2129. readingsBulkUpdate( $hash, $hash->{helper}{CLEARONINPUTCHANGE}->{$key} , "" );
  2130. Log3 $hash, 5, "PIONEERAVR $name: Main Input change ... clear screen... reading:" . $hash->{helper}{CLEARONINPUTCHANGE}->{$key};
  2131. }
  2132. foreach my $key ( keys %{$hash->{helper}{CLEARONINPUTCHANGE}} ) {
  2133. readingsBulkUpdate( $hash, $hash->{helper}{CLEARONINPUTCHANGE}->{$key} , "" );
  2134. Log3 $hash, 5, "PIONEERAVR $name: Main Input change ... clear screen... reading:" . $hash->{helper}{CLEARONINPUTCHANGE}->{$key};
  2135. }
  2136. # input names
  2137. # RGBXXY(14char)
  2138. # XX -> input number
  2139. # Y -> 1: aliasName; 0: Standard (predefined) name
  2140. # 14char -> name of the input
  2141. } elsif ( $line=~ m/^RGB(\d\d)(\d)(.*)/ ) {
  2142. my $inputNr = $1;
  2143. my $isAlias = $2; #1: aliasName; 0: Standard (predefined) name
  2144. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Name for InputNr: $inputNr is ".dq( $3 );
  2145. # remove non alnum
  2146. $line =~ s/[^a-zA-Z 0-9]/ /g;
  2147. # uc first
  2148. $line =~ s/([\w']+)/\u\L$1/g;
  2149. # remove whitespace
  2150. $line =~ s/\s//g;
  2151. # lc first
  2152. if ( $isAlias ) {
  2153. $hash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} = lcfirst( substr( $line,6 ) );
  2154. } else {
  2155. $hash->{helper}{INPUTNAMES}->{$inputNr}{name} = lcfirst( substr( $line,6 ) );
  2156. }
  2157. $hash->{helper}{INPUTNAMES}->{$inputNr}{enabled} = 1
  2158. if ( !defined( $hash->{helper}{INPUTNAMES}->{$inputNr}{enabled} ) );
  2159. $hash->{helper}{INPUTNAMES}->{$inputNr}{aliasName} = ""
  2160. if ( !defined( $hash->{helper}{INPUTNAMES}->{$inputNr}{aliasName}));
  2161. Log3 $hash, 5, "$name: Input name for input $inputNr is " . lcfirst( substr( $line,6 ) );
  2162. # audio input terminal
  2163. } elsif ( $line=~ m/^SSC(\d{2})00(\d{2})$/ ) {
  2164. # check for audio input terminal information
  2165. # format: ?SSC<2 digit input function nr>00
  2166. # response: SSC<2 digit input function nr>00
  2167. # 00:No Assign
  2168. # 01:COAX 1
  2169. # 02:COAX 2
  2170. # 03:COAX 3
  2171. # 04:OPT 1
  2172. # 05:OPT 2
  2173. # 06:OPT 3
  2174. # 10:ANALOG"
  2175. # response: E06: inappropriate parameter (input function nr not available on that device)
  2176. # we can not trust "E06" as it is not sure that it is the reply for the current input nr
  2177. if ( $2 == 00) {
  2178. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "No Assign";
  2179. } elsif ( $2 == 01) {
  2180. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "COAX 1";
  2181. } elsif ( $2 == 02) {
  2182. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "COAX 2";
  2183. } elsif ( $2 == 03) {
  2184. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "COAX 3";
  2185. } elsif ( $2 == 04) {
  2186. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "OPT 1";
  2187. } elsif ( $2 == 05) {
  2188. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "OPT 2";
  2189. } elsif ( $2 == 06) {
  2190. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "OPT 3";
  2191. } elsif ( $2 == 10) {
  2192. $hash->{helper}{INPUTNAMES}->{$1}{audioTerminal} = "ANALOG";
  2193. }
  2194. # HDMI input terminal
  2195. } elsif ( $line=~ m/^SSC(\d{2})010(\d)$/ ) {
  2196. # check for hdmi input terminal information
  2197. # format: ?SSC<2 digit input function nr>010
  2198. # response: SSC<2 digit input function nr>010
  2199. # 0:No Assign
  2200. # 1:hdmi 1
  2201. # 2:hdmi 2
  2202. # 3:hdmi 3
  2203. # 4:hdmi 4
  2204. # 5:hdmi 5
  2205. # 6:hdmi 6
  2206. # 7:hdmi 7
  2207. # 8:hdmi 8
  2208. # response: E06: inappropriate parameter (input function nr not available on that device)
  2209. # we can not trust "E06" as it is not sure that it is the reply for the current input nr
  2210. if ( $2 == 0 ) {
  2211. $hash->{helper}{INPUTNAMES}->{$1}{hdmiTerminal} = "No Assign ";
  2212. } else {
  2213. $hash->{helper}{INPUTNAMES}->{$1}{hdmiTerminal} = "hdmi ".$2;
  2214. }
  2215. # component video input terminal
  2216. } elsif ( $line=~ m/^SSC(\d{2})020(\d)$/ ) {
  2217. # check for component video input terminal information
  2218. # format: ?SSC<2 digit input function nr>020
  2219. # response: SSC<2 digit input function nr>020
  2220. # 00:No Assign
  2221. # 01:Component 1
  2222. # 02:Component 2
  2223. # 03:Component 3
  2224. # response: E06: inappropriate parameter (input function nr not available on that device)
  2225. # we can not trust "E06" as it is not sure that it is the reply for the current input nr
  2226. if ( $2 == 0 ) {
  2227. $hash->{helper}{INPUTNAMES}->{$1}{componentTerminal} = "No Assign ";
  2228. } else {
  2229. $hash->{helper}{INPUTNAMES}->{$1}{componentTerminal} = "component ".$2;
  2230. }
  2231. # input enabled
  2232. } elsif ( $line=~ m/^SSC(\d\d)030(1|0)$/ ) {
  2233. # select(undef, undef, undef, 0.001);
  2234. # check for input skip information
  2235. # format: ?SSC<2 digit input function nr>03
  2236. # response: SSC<2 digit input function nr>0300: use
  2237. # response: SSC<2 digit input function nr>0301: skip
  2238. # response: E06: inappropriate parameter (input function nr not available on that device)
  2239. # we can not trust "E06" as it is not sure that it is the reply for the current input nr
  2240. if ( $2 == 1 ) {
  2241. $hash->{helper}{INPUTNAMES}->{$1}{enabled} = 0;
  2242. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: InputNr: $1 is disabled";
  2243. } elsif ( $2 == 0) {
  2244. $hash->{helper}{INPUTNAMES}->{$1}{enabled} = 1;
  2245. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: InputNr: $1 is enabled";
  2246. }
  2247. # input level adjust
  2248. } elsif ( $line=~ m/^ILA(\d{2})(\d{2})$/ ) {
  2249. # 74:+12dB
  2250. # 50: 0dB
  2251. # 26: -12dB
  2252. my $inputLevelAdjust = $2/2 - 25;
  2253. $hash->{helper}{INPUTNAMES}->{$1}{inputLevelAdjust} = $inputLevelAdjust;
  2254. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: InputLevelAdjust of InputNr: $1 is $inputLevelAdjust ";
  2255. # Signal Select
  2256. } elsif ( substr( $line, 0, 3 ) eq "SDA" ) {
  2257. my $signalSelect = substr( $line,3,1 );
  2258. if ( $signalSelect == "0" ) {
  2259. readingsBulkUpdate( $hash, "signalSelect", "auto" );
  2260. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: signalSelect: auto";
  2261. } elsif ( $signalSelect == "1" ) {
  2262. readingsBulkUpdate( $hash, "signalSelect", "analog" );
  2263. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: signalSelect: analog";
  2264. } elsif ( $signalSelect == "2" ) {
  2265. readingsBulkUpdate( $hash, "signalSelect", "digital" );
  2266. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: signalSelect: digital";
  2267. } elsif ( $signalSelect == "3" ) {
  2268. readingsBulkUpdate( $hash, "signalSelect", "hdmi" );
  2269. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: signalSelect: hdmi";
  2270. } elsif ( $signalSelect == "9" ) {
  2271. readingsBulkUpdate( $hash, "signalSelect", "cyclic" );
  2272. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: signalSelect: cycle";
  2273. } else {
  2274. readingsBulkUpdate( $hash, "signalSelect", $signalSelect );
  2275. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: signalSelect: ". dq( $signalSelect );
  2276. }
  2277. # HDMI output
  2278. # 0:HDMI OUT 1+2 ON
  2279. # 1:HDMI OUT 1 ON
  2280. # 2:HDMI OUT 2 ON
  2281. # 3:HDMI OUT 1/2 OFF
  2282. # Listening Mode
  2283. } elsif ( $line =~ m/^(HO)(\d)$/ ) {
  2284. if ( defined ( $hash->{helper}{HDMIOUT}->{$2} ) ) {
  2285. readingsBulkUpdate( $hash, "hdmiOut", $hash->{helper}{HDMIOUT}->{$2} );
  2286. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: HDMI Out: ". dq( $2 );
  2287. } else {
  2288. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown hdmiOut: ". dq( $2 );
  2289. }
  2290. } elsif ( $line=~ m/^VST(\d)(\d{2})(\d)(\d)(\d)(\d)(\d{2})(\d)(\d)(\d)(\d)(\d{2})(\d)(\d)(\d{2})(\d)(\d)(\d*)$/ ) {
  2291. # Video information parameters
  2292. # data1:Video Input Signal
  2293. # data2-data3:Video Input Resolution
  2294. # data4:Video Input aspect ratio
  2295. # data5:Video input colour format (HDMI only)
  2296. # data6:Video input bit rate (HDMI only) VIDEOCOLOURDEPTH
  2297. # data7:Input extend color space(HDMI only)
  2298. # data8-9:Output Resolution
  2299. # data10:Output aspect
  2300. # data11:Output color format(HDMI only)
  2301. # data12:Output bit(HDMI only)
  2302. # data13:Output extend color space(HDMI only)
  2303. # data14-15:HDMI 1 Monitor Recommend Resolution Information
  2304. # data16:HDMI 1 Monitor DeepColor
  2305. # data17-21:HDMI 1 Monitor Extend Color Space
  2306. # data22-23:HDMI 2 Monitor Recommend Resolution Information
  2307. # data24:HDMI 2 Monitor DeepColor
  2308. # data25-29:HDMI 2 Monitor Extend Color Space
  2309. # data30-49: HDMI3 & HDMI4 (not used)
  2310. if ( defined ( $hash->{helper}{VIDEOINPUTTERMINAL}->{$1}) ) {
  2311. readingsBulkUpdate( $hash, "videoInputTerminal", $hash->{helper}{VIDEOINPUTTERMINAL}->{$1} );
  2312. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input terminal: ". dq($1);
  2313. }
  2314. else {
  2315. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown video input terminal: ". dq($1);
  2316. }
  2317. if ( defined ( $hash->{helper}{VIDEORESOLUTION}->{$2}) ) {
  2318. readingsBulkUpdate( $hash, "videoInputResolution", $hash->{helper}{VIDEORESOLUTION}->{$2} );
  2319. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input resolution: ". dq($2);
  2320. }
  2321. else {
  2322. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input resolution: ". dq($2);
  2323. }
  2324. if ( defined ( $hash->{helper}{VIDEOASPECTRATIO}->{$3}) ) {
  2325. readingsBulkUpdate( $hash, "videoInputAspectRatio", $hash->{helper}{VIDEOASPECTRATIO}->{$3} );
  2326. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input aspect ratio: ". dq($3);
  2327. }
  2328. else {
  2329. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input aspect ratio: ". dq($3);
  2330. }
  2331. if ( defined ( $hash->{helper}{VIDEOCOLOURFORMAT}->{$4}) ) {
  2332. readingsBulkUpdate( $hash, "videoInputColourFormat", $hash->{helper}{VIDEOCOLOURFORMAT}->{$4} );
  2333. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input colour format: ". dq($4);
  2334. }
  2335. else {
  2336. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input colour format: ". dq($4);
  2337. }
  2338. if ( defined ( $hash->{helper}{VIDEOCOLOURDEPTH}->{$5}) ) {
  2339. readingsBulkUpdate( $hash, "videoInputColourDepth", $hash->{helper}{VIDEOCOLOURDEPTH}->{$5} );
  2340. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input colour depth: ". dq($5);
  2341. }
  2342. else {
  2343. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input colour depth: ". dq($5);
  2344. }
  2345. if ( defined ( $hash->{helper}{VIDEOCOLOURSPACE}->{$6}) ) {
  2346. readingsBulkUpdate( $hash, "videoInputColourSpace", $hash->{helper}{VIDEOCOLOURSPACE}->{$6} );
  2347. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input colour space: ". dq($6);
  2348. }
  2349. else {
  2350. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video input colour space: ". dq($6);
  2351. }
  2352. if ( defined ( $hash->{helper}{VIDEORESOLUTION}->{$7}) ) {
  2353. readingsBulkUpdate( $hash, "videoOutputResolution", $hash->{helper}{VIDEORESOLUTION}->{$7} );
  2354. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output resolution: ". dq($7);
  2355. }
  2356. else {
  2357. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output resolution: ". dq($7);
  2358. }
  2359. if ( defined ( $hash->{helper}{VIDEOASPECTRATIO}->{$8}) ) {
  2360. readingsBulkUpdate( $hash, "videoOutputAspectRatio", $hash->{helper}{VIDEOASPECTRATIO}->{$8} );
  2361. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output aspect ratio: ". dq($8);
  2362. }
  2363. else {
  2364. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output aspect ratio: ". dq($8);
  2365. }
  2366. if ( defined ( $hash->{helper}{VIDEOCOLOURFORMAT}->{$9}) ) {
  2367. readingsBulkUpdate( $hash, "videoOutputColourFormat", $hash->{helper}{VIDEOCOLOURFORMAT}->{$9} );
  2368. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output colour format: ". dq($9);
  2369. }
  2370. else {
  2371. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output colour format: ". dq($9);
  2372. }
  2373. if ( defined ( $hash->{helper}{VIDEOCOLOURDEPTH}->{$10}) ) {
  2374. readingsBulkUpdate( $hash, "videoOutputColourDepth", $hash->{helper}{VIDEOCOLOURDEPTH}->{$10} );
  2375. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output colour depth: ". dq($10);
  2376. }
  2377. else {
  2378. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output colour depth: ". dq($10);
  2379. }
  2380. if ( defined ( $hash->{helper}{VIDEOCOLOURSPACE}->{$11}) ) {
  2381. readingsBulkUpdate( $hash, "videoOutputColourSpace", $hash->{helper}{VIDEOCOLOURSPACE}->{$11} );
  2382. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output colour space: ". dq($11);
  2383. }
  2384. else {
  2385. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: video output colour space: ". dq($11);
  2386. }
  2387. if ( defined ( $hash->{helper}{VIDEORESOLUTION}->{$12}) ) {
  2388. readingsBulkUpdate( $hash, "hdmi1RecommendedResolution", $hash->{helper}{VIDEORESOLUTION}->{$12} );
  2389. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: HDMI 1 Monitor Recommend Resolution Information: ". dq($12);
  2390. }
  2391. else {
  2392. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: HDMI 1 Monitor Recommend Resolution Information: ". dq($12);
  2393. }
  2394. if ( defined ( $hash->{helper}{VIDEOCOLOURDEPTH}->{$13}) ) {
  2395. readingsBulkUpdate( $hash, "hdmi1ColourDepth", $hash->{helper}{VIDEOCOLOURDEPTH}->{$13} );
  2396. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi1 colour depth: ". dq($13);
  2397. }
  2398. else {
  2399. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi1 output colour depth: ". dq($13);
  2400. }
  2401. if ( defined ( $hash->{helper}{VIDEOCOLOURSPACE}->{$14}) ) {
  2402. readingsBulkUpdate( $hash, "hdmi1ColourSpace", $hash->{helper}{VIDEOCOLOURSPACE}->{$14} );
  2403. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi1 colour space: ". dq($14);
  2404. }
  2405. else {
  2406. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi1 output colour space: ". dq($14);
  2407. }
  2408. if ( defined ( $hash->{helper}{VIDEORESOLUTION}->{$15}) ) {
  2409. readingsBulkUpdate( $hash, "hdmi2RecommendedResolution", $hash->{helper}{VIDEORESOLUTION}->{$15} );
  2410. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: HDMI2 Monitor Recommend Resolution Information: ". dq($15);
  2411. }
  2412. else {
  2413. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: HDMI2 Monitor Recommend Resolution Information: ". dq($15);
  2414. }
  2415. if ( defined ( $hash->{helper}{VIDEOCOLOURDEPTH}->{$16}) ) {
  2416. readingsBulkUpdate( $hash, "hdmi2ColourDepth", $hash->{helper}{VIDEOCOLOURDEPTH}->{$16} );
  2417. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi2 colour depth: ". dq($16);
  2418. }
  2419. else {
  2420. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi2 output colour depth: ". dq($16);
  2421. }
  2422. if ( defined ( $hash->{helper}{VIDEOCOLOURSPACE}->{$17}) ) {
  2423. readingsBulkUpdate( $hash, "hdmi2ColourSpace", $hash->{helper}{VIDEOCOLOURSPACE}->{$17} );
  2424. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi2 colour space: ". dq($17);
  2425. }
  2426. else {
  2427. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: hdmi2 output colour space: ". dq($17);
  2428. }
  2429. # Speaker
  2430. } elsif ( substr($line,0,3) eq "SPK" ) {
  2431. my $speakers = substr($line,3,1);
  2432. if ( $speakers == "0" ) {
  2433. readingsBulkUpdate( $hash, "speakers", "off" );
  2434. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: speakers: off";
  2435. } elsif ( $speakers == "1" ) {
  2436. readingsBulkUpdate( $hash, "speakers", "A" );
  2437. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: speakers: A";
  2438. } elsif ($speakers == "2") {
  2439. readingsBulkUpdate( $hash, "speakers", "B" );
  2440. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: speakers: B";
  2441. } elsif ($speakers == "3") {
  2442. readingsBulkUpdate( $hash, "speakers", "A+B" );
  2443. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: speakers: A+B";
  2444. } else {
  2445. readingsBulkUpdate( $hash, "speakers", $speakers );
  2446. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: speakers: ". dq( $speakers );
  2447. }
  2448. # Speaker System
  2449. # do we have Zone 2 speakers?
  2450. } elsif ( substr( $line,0,3 ) eq "SSF" ) {
  2451. if ( defined ( $hash->{helper}{SPEAKERSYSTEMS}->{substr( $line, 3, 2)} ) ) {
  2452. readingsBulkUpdate( $hash, "speakerSystem", $hash->{helper}{SPEAKERSYSTEMS}->{substr( $line, 3, 2)} );
  2453. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: SpeakerSystem: ". dq( substr( $line, 3, 2) );
  2454. } else {
  2455. readingsBulkUpdate( $hash, "speakerSystem", $line );
  2456. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Unknown SpeakerSystem " . dq( substr( $line, 3, 2 ) );
  2457. }
  2458. # Listening Mode
  2459. } elsif ( substr($line,0,2) eq "SR" ) {
  2460. if ( defined ( $hash->{helper}{LISTENINGMODES}->{substr($line,2)}) ) {
  2461. readingsBulkUpdate( $hash, "listeningMode", $hash->{helper}{LISTENINGMODES}->{substr($line,2)} );
  2462. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: listeningMode: ". dq(substr($line,2));
  2463. } else {
  2464. readingsBulkUpdate( $hash, "listeningMode", $line );
  2465. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown listeningMode: ". dq(substr( $line, 2 ) );
  2466. }
  2467. # Listening Mode Playing (for Display)
  2468. } elsif ( substr( $line, 0, 2 ) eq "LM" ) {
  2469. if ( defined ( $hash->{helper}{LISTENINGMODESPLAYING}->{substr( $line, 2, 4)} ) ) {
  2470. readingsBulkUpdate( $hash, "listeningModePlaying", $hash->{helper}{LISTENINGMODESPLAYING}->{substr( $line, 2, 4 )} );
  2471. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: listeningModePlaying: ". dq( substr( $line, 2, 4 ) );
  2472. } else {
  2473. readingsBulkUpdate( $hash, "listeningModePlaying", $line );
  2474. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: unknown listeningModePlaying: ". dq( substr( $line, 2, 4 ) );
  2475. }
  2476. # Main zone Power
  2477. } elsif ( substr( $line, 0, 3 ) eq "PWR" ) {
  2478. my $power = substr( $line, 3, 1);
  2479. if ( $power == "0" ) {
  2480. readingsBulkUpdate( $hash, "power", "on" )
  2481. if ( ReadingsVal( $name, "power", "-" ) ne "on" );
  2482. $state = "on";
  2483. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Power: on";
  2484. } else {
  2485. readingsBulkUpdate( $hash, "power", "off" )
  2486. if ( ReadingsVal( $name, "power", "-" ) ne "off" );
  2487. $state = "off";
  2488. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Power: off";
  2489. }
  2490. # Set STATE
  2491. # devIO.pm sets hash->STATE accordingly to the connection state (opened, CONNECTED, DISCONNECTED)
  2492. # we want that hash->STATE represents the state of the device (absent, off, on)
  2493. # stateAV
  2494. my $stateAV = PIONEERAVR_GetStateAV($hash);
  2495. readingsBulkUpdate( $hash, "stateAV", $stateAV )
  2496. if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
  2497. # MCACC memory
  2498. } elsif ( $line =~ m/^(MC)(\d)$/ ) {
  2499. readingsBulkUpdate( $hash, "mcaccMemory", $2 );
  2500. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: MCACC memory: selected memory is: $2";
  2501. # Display updates
  2502. # uses a translation table for each letter (char) to display the letters properly
  2503. } elsif ( substr( $line, 0, 2 ) eq "FL" ) {
  2504. my $hex = substr( $line, 4, 28);
  2505. my @a = map $hash->{helper}{CHARS}->{$_}, $hex =~ /(..)/g;
  2506. my $display = join('',@a);
  2507. readingsBulkUpdate( $hash, "displayPrevious", ReadingsVal( $name, "display","" ) );
  2508. readingsBulkUpdate( $hash, "display", $display );
  2509. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Display update to: $display";
  2510. # eq
  2511. } elsif ( $line =~ m/^ATC([0|1])/ ) {
  2512. if ( $1 == "1" ) {
  2513. readingsBulkUpdate( $hash, "eq", "on" );
  2514. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: eq is on";
  2515. }
  2516. else {
  2517. readingsBulkUpdate( $hash, "eq", "off" );
  2518. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: eq is off";
  2519. }
  2520. # standing wave
  2521. } elsif ( $line =~ m/^ATD([0|1])/ ) {
  2522. if ( $1 == "1" ) {
  2523. readingsBulkUpdate( $hash, "standingWave", "on" );
  2524. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: standingWave is on";
  2525. }
  2526. else {
  2527. readingsBulkUpdate( $hash, "standingWave", "off" );
  2528. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: standingWave is off";
  2529. }
  2530. # key received
  2531. } elsif ( $line =~ m/^NXA$/ ) {
  2532. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Network player: Key pressed";
  2533. # screen type and screen name
  2534. } elsif ( $line =~ m/^(GCH|GCI)(\d{2})(\d)(\d)(\d)(\d)(\d)\"(.*)\"$/ ) {
  2535. # Format:
  2536. # $2: screen type
  2537. # 00:Message
  2538. # 01:List
  2539. # 02:Playing(Play)
  2540. # 03:Playing(Pause)
  2541. # 04:Playing(Fwd)
  2542. # 05:Playing(Rev)
  2543. # 06:Playing(Stop)
  2544. # 99:Drawing invalid
  2545. # $3: 0:Same hierarchy 1:Updated hierarchy (Next or Previous list)
  2546. # $4: Top menu key flag
  2547. # 0:Invalidity
  2548. # 1:Effectiveness
  2549. # $5: Tools (menu, edit,iPod Control) Key Information
  2550. # 0:Invalidity
  2551. # 1:Effectiveness
  2552. # $6: Return Key Information
  2553. # 0:Invalidity
  2554. # 1:Effectiveness
  2555. # $7: always 0
  2556. # $8: Screen name (UTF8) max. 128 byte
  2557. my $screenType = $hash->{helper}{SCREENTYPES}{$2};
  2558. readingsBulkUpdate( $hash, "screenType", $screenType );
  2559. readingsBulkUpdate( $hash, "screenName", $8 );
  2560. readingsBulkUpdate( $hash, "screenHierarchy", $3 );
  2561. readingsBulkUpdate( $hash, "screenTopMenuKey", $4 );
  2562. readingsBulkUpdate( $hash, "screenToolsKey", $5 );
  2563. readingsBulkUpdate( $hash, "screenReturnKey", $6 );
  2564. # to update the OSD/screen while playing from iPad/network a command has to be sent regulary
  2565. if ($2 eq "02" ) {
  2566. RemoveInternalTimer( $hash, "PIONEERAVR_screenUpdate" );
  2567. # reset screenUpdate timer -> again in 5s
  2568. my $checkInterval = 5;
  2569. my $next = gettimeofday() + $checkInterval;
  2570. $hash->{helper}{nextScreenUpdate} = $next;
  2571. InternalTimer( $next, "PIONEERAVR_screenUpdate", $hash, 0 );
  2572. readingsBulkUpdate( $hash, "playStatus", "playing" );
  2573. } elsif ( $2 eq "03" ) {
  2574. readingsBulkUpdate( $hash, "playStatus", "paused" );
  2575. } elsif ( $2 eq "04" ) {
  2576. readingsBulkUpdate( $hash, "playStatus", "fast-forward" );
  2577. } elsif ( $2 eq "05" ) {
  2578. readingsBulkUpdate( $hash, "playStatus", "fast-rewind" );
  2579. } elsif ( $2 eq "06" ) {
  2580. readingsBulkUpdate( $hash, "playStatus", "stopped" );
  2581. }
  2582. # stateAV
  2583. if ( $2 eq "02" || $2 eq "03" || $2 eq "04" || $2 eq "05" || $2 eq "06" ) {
  2584. my $stateAV = PIONEERAVR_GetStateAV($hash);
  2585. readingsBulkUpdate( $hash, "stateAV", $stateAV )
  2586. if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
  2587. }
  2588. # screen type and screen name for XC-HM72 (XC-HM72 has screen name in $9 and no screen update command)
  2589. } elsif ( $line =~ m/^(GCP)(\d{2})(\d)(\d)(\d)(\d)(\d)(.*)\"(.*)\"$/ ) {
  2590. # Format:
  2591. # $2: screen type
  2592. # 00:Message
  2593. # 01:List
  2594. # 02:Playing(Play)
  2595. # 03:Playing(Pause)
  2596. # 04:Playing(Fwd)
  2597. # 05:Playing(Rev)
  2598. # 06:Playing(Stop)
  2599. # 99:Drawing invalid
  2600. # $3: 0:Same hierarchy 1:Updated hierarchy (Next or Previous list)
  2601. # $4: Top menu key flag
  2602. # 0:Invalidity
  2603. # 1:Effectiveness
  2604. # $5: Tools (menu, edit,iPod Control) Key Information
  2605. # 0:Invalidity
  2606. # 1:Effectiveness
  2607. # $6: Return Key Information
  2608. # 0:Invalidity
  2609. # 1:Effectiveness
  2610. # $7: always 0
  2611. # $8: 10 digits (XC-HM72) or nothing
  2612. # $9: Screen name (UTF8) max. 128 byte
  2613. my $screenType = $hash->{helper}{SCREENTYPES}{$2};
  2614. readingsBulkUpdate( $hash, "screenType", $screenType );
  2615. readingsBulkUpdate( $hash, "screenName", $9 );
  2616. readingsBulkUpdate( $hash, "screenHierarchy", $3 );
  2617. readingsBulkUpdate( $hash, "screenTopMenuKey", $4 );
  2618. readingsBulkUpdate( $hash, "screenToolsKey", $5 );
  2619. readingsBulkUpdate( $hash, "screenReturnKey", $6 );
  2620. # to update the OSD/screen while playing from iPad/network a command has to be sent regulary
  2621. if ($2 eq "02" ) {
  2622. RemoveInternalTimer( $hash, "PIONEERAVR_screenUpdate" );
  2623. # It seems that XC-HM72 does not support the screen update command
  2624. ## reset screenUpdate timer -> again in 5s
  2625. #my $checkInterval = 5;
  2626. #my $next = gettimeofday() + $checkInterval;
  2627. #$hash->{helper}{nextScreenUpdate} = $next;
  2628. #InternalTimer( $next, "PIONEERAVR_screenUpdate", $hash, 0 );
  2629. #readingsBulkUpdate( $hash, "playStatus", "playing" );
  2630. } elsif ( $2 eq "03" ) {
  2631. readingsBulkUpdate( $hash, "playStatus", "paused" );
  2632. } elsif ( $2 eq "04" ) {
  2633. readingsBulkUpdate( $hash, "playStatus", "fast-forward" );
  2634. } elsif ( $2 eq "05" ) {
  2635. readingsBulkUpdate( $hash, "playStatus", "fast-rewind" );
  2636. } elsif ( $2 eq "06" ) {
  2637. readingsBulkUpdate( $hash, "playStatus", "stopped" );
  2638. }
  2639. # stateAV
  2640. if ( $2 eq "02" || $2 eq "03" || $2 eq "04" || $2 eq "05" || $2 eq "06" ) {
  2641. my $stateAV = PIONEERAVR_GetStateAV($hash);
  2642. readingsBulkUpdate( $hash, "stateAV", $stateAV )
  2643. if ( ReadingsVal( $name, "stateAV", "-" ) ne $stateAV );
  2644. }
  2645. # Source information
  2646. } elsif ( $line =~ m/^(GHP|GHH)(\d{2})$/ ) {
  2647. my $sourceInfo = $hash->{helper}{SOURCEINFO}{$2};
  2648. readingsBulkUpdate( $hash, "sourceInfo", $sourceInfo );
  2649. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Screen source information: $2 $sourceInfo";
  2650. # total screen lines
  2651. } elsif ( $line =~ m/^(GDP|GDH)(\d{5})(\d{5})(\d{5})$/ ) {
  2652. readingsBulkUpdate( $hash, "screenLineNumberFirst", $2 + 0 );
  2653. readingsBulkUpdate( $hash, "screenLineNumberLast", $3 + 0 );
  2654. readingsBulkUpdate( $hash, "screenLineNumbersTotal", $4 + 0 );
  2655. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Screen Item number of line 1(5byte): $2, Item number of last line(5byte): $3, Total number of items List(5byte): $4 ";
  2656. # Screen line numbers
  2657. } elsif ( $line =~ m/^(GBP|GBH|GBI)(\d{2})$/ ) {
  2658. readingsBulkUpdate( $hash, "screenLineNumbers", $2 + 0 );
  2659. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Screen line numbers = $2";
  2660. # screenInformation
  2661. } elsif ( $line =~ m/^(GEP|GEH|GEI)(\d{2})(\d)(\d{2})\"(.*)\"$/ ) {
  2662. # Format:
  2663. # $2: Line number
  2664. # $3: Focus (yes(1)/no(0)/greyed out(9)
  2665. # $4: Line data type:
  2666. # 00:Normal(no mark type)
  2667. # 01:Directory
  2668. # 02:Music
  2669. # 03:Photo
  2670. # 04:Video
  2671. # 05:Now Playing
  2672. # 20:Track
  2673. # 21:Artist
  2674. # 22:Album
  2675. # 23:Time
  2676. # 24:Genre
  2677. # 25:Chapter number
  2678. # 26:Format
  2679. # 27:Bit Per Sample
  2680. # 28:Sampling Rate
  2681. # 29:Bitrate
  2682. # 31:Buffer
  2683. # 32:Channel
  2684. # 33:Station
  2685. # $5: Display line information (UTF8)
  2686. my $lineDataType = $hash->{helper}{LINEDATATYPES}{$4};
  2687. # screen lines
  2688. my $screenLine = "screenLine".$2;
  2689. my $screenLineType = "screenLineType".$2;
  2690. readingsBulkUpdate( $hash, $screenLine, $5 );
  2691. readingsBulkUpdate( $hash, $screenLineType, $lineDataType );
  2692. if ( $3 == 1 ) {
  2693. readingsBulkUpdate( $hash, "screenLineHasFocus", $2 );
  2694. }
  2695. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: screen line $2 ($screenLine) type: $lineDataType: " . dq( $5 );
  2696. # for being coherent with http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  2697. if ( $4 eq "20" or $4 eq "21" or $4 eq "22" ) {
  2698. readingsBulkUpdate( $hash, $lineDataType, $5);
  2699. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: reading update for displayDataType $lineDataType: " . dq( $5 );
  2700. }
  2701. # Tuner channel names
  2702. } elsif ( $line =~ m/^TQ(\w\d)\"(.{8})\"$/ ) {
  2703. $hash->{helper}{TUNERCHANNELNAMES}{$1} = $2;
  2704. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: tunerChannel: $1 has the name: " .dq($2);
  2705. # Tuner channel
  2706. } elsif ( $line =~ m/^PR(\w)0(\d)$/ ) {
  2707. readingsBulkUpdate( $hash, "channelStraight", $1.$2 );
  2708. readingsBulkUpdate( $hash, "channelName", $hash->{helper}{TUNERCHANNELNAMES}{$1.$2} );
  2709. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Current tunerChannel: " . $1.$2;
  2710. if ( $1 eq "A" ) {
  2711. readingsBulkUpdate( $hash, "channel", $2 );
  2712. } else {
  2713. readingsBulkUpdate( $hash, "channel", "-" );
  2714. }
  2715. # Tuner frequency
  2716. # FRFXXXYY -> XXX.YY Mhz
  2717. } elsif ( $line =~ m/^FRF([0|1])([0-9]{2})([0-9]{2})$/ ) {
  2718. my $tunerFrequency = $2.".".$3;
  2719. if ( $1 == 1 ) {
  2720. $tunerFrequency = $1.$tunerFrequency;
  2721. }
  2722. readingsBulkUpdate( $hash, "tunerFrequency", $tunerFrequency );
  2723. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: tunerFrequency: " . $tunerFrequency;
  2724. # all network settings
  2725. } elsif ( $line =~ m/^SUL(\d)(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d{3})(\d)(\".*\")(\d{5})$/ ) {
  2726. #readingsBulkUpdate( $hash, "macAddress", $1.":".$2.":".$3.":".$4.":".$5.":".$6);
  2727. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: Network settings is " . $1;
  2728. if ( $1 == 0 ) {
  2729. $hash->{dhcp}= "off";
  2730. } else {
  2731. $hash->{dhcp}= "on";
  2732. }
  2733. $hash->{ipAddress} = sprintf( "%d.%d.%d.%d",$2 ,$3 ,$4 ,$5 );
  2734. $hash->{netmask} = sprintf( "%d.%d.%d.%d",$6,$7,$8,$9 );
  2735. $hash->{defaultGateway} = sprintf( "%d.%d.%d.%d",$10,$11,$12,$13 );
  2736. $hash->{dns1} = sprintf( "%d.%d.%d.%d",$14,$15,$16,$17 );
  2737. $hash->{dns2} = sprintf( "%d.%d.%d.%d",$18,$19,$20,$21 );
  2738. if ( $22 == 0 ) {
  2739. $hash->{proxy} = "off";
  2740. } else {
  2741. $hash->{proxy} = "on";
  2742. $hash->{proxyName} = $23;
  2743. $hash->{proxyPort} = 0 + $24;
  2744. }
  2745. # network ports 1-4
  2746. } elsif ( $line =~ m/^SUM(\d{5})(\d{5})(\d{5})(\d{5})$/ ) {
  2747. # network port1
  2748. if ( $1 == 99999 ) {
  2749. $hash->{networkPort1} = "disabled";
  2750. } else {
  2751. $hash->{networkPort1} = 0 + $1;
  2752. }
  2753. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: NetworkPort1 is " . $1;
  2754. # network port2
  2755. if ( $2 == 99999 ) {
  2756. $hash->{networkPort2} = "disabled";
  2757. } else {
  2758. $hash->{networkPort2} = 0 + $2;
  2759. }
  2760. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: NetworkPort2 is " . $2;
  2761. # network port3
  2762. if ( $3 == 99999 ) {
  2763. $hash->{networkPort3} = "disabled";
  2764. } else {
  2765. $hash->{networkPort3} = 0 + $3;
  2766. }
  2767. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: NetworkPort3 is " . $3;
  2768. # network port4
  2769. if ( $4 == 99999 ) {
  2770. $hash->{networkPort4} = "disabled";
  2771. } else {
  2772. $hash->{networkPort4} = 0 + $4;
  2773. }
  2774. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: NetworkPort4 is " . $4;
  2775. # MAC address
  2776. } elsif ( $line =~ m/^SVB(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})$/ ) {
  2777. $hash->{macAddress} = $1.":".$2.":".$3.":".$4.":".$5.":".$6;
  2778. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: NetworkPort1 is " . $1;
  2779. # avrModel
  2780. } elsif ( $line =~ m/^RGD<\d{3}><(.*)\/(.*)>$/ ) {
  2781. $hash->{avrModel} = $1;
  2782. $hash->{avrSoftwareType} = $2;
  2783. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: avrModel is " . $1;
  2784. # Software version
  2785. } elsif ( $line =~ m/^SSI\"(.*)\"$/ ) {
  2786. $hash->{softwareVersion} = $1;
  2787. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: softwareVersion is " . $1;
  2788. # ERROR MESSAGES
  2789. # E02<CR+LF> NOT AVAILABLE NOW Detected the Command line which could not work now.
  2790. # E03<CR+LF> INVALID COMMAND Detected an invalid Command with this model.
  2791. # E04<CR+LF> COMMAND ERROR "Detected inappropriate Command line.
  2792. # Detected IP-only Commands on RS232C (GIA,GIC,FCA,FCB,GIH and GII)."
  2793. # E06<CR+LF> PARAMETER ERROR Detected inappropriate Parameter.
  2794. # B00<CR+LF> BUSY Now AV Receiver is Busy. Please wait few seconds.
  2795. } elsif ( $line =~ m/^E0(\d)$/ ) {
  2796. my $errorMessage ="PIONEERAVR $name: Received Error code from PioneerAVR: $line";
  2797. if ( $1 == 2 ) {
  2798. $errorMessage .= " (NOT AVAILABLE NOW - Detected the Command line which could not work now.)";
  2799. } elsif ( $1 == 3 ) {
  2800. $errorMessage .= " (INVALID COMMAND - Detected an invalid Command with this model.)";
  2801. } elsif ( $1 == 4 ) {
  2802. $errorMessage .= " (COMMAND ERROR - Detected inappropriate Command line.)";
  2803. } elsif ( $1 == 6 ) {
  2804. $errorMessage .= " (PARAMETER ERROR - Detected inappropriate Parameter.)";
  2805. }
  2806. Log3 $hash, 5, $errorMessage;
  2807. } elsif ( $line =~ m/^B00$/ ) {
  2808. Log3 $hash, 5,"PIONEERAVR $name: Error nr $line received (BUSY Now AV Receiver is Busy. Please wait few seconds.)";
  2809. # network standby
  2810. # STJ1 -> on -> Pioneer AV receiver can be switched on from standby
  2811. # STJ0 -> off -> Pioneer AV receiver cannot be switched on from standby
  2812. } elsif ( $line =~ m/^STJ([0|1])/) {
  2813. if ( $1 == "1" ) {
  2814. $hash->{networkStandby} = "on";
  2815. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: networkStandby is on";
  2816. } else {
  2817. $hash->{networkStandby} = "off";
  2818. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: networkStandby is off";
  2819. }
  2820. # commands for other zones (Volume, mute, power)
  2821. # Zone 2 command
  2822. } elsif ( $line =~ m/^ZV(\d\d)$|^Z2MUT(\d)$|^Z2F(\d\d)$|^APR(0|1)$/ ) {
  2823. $msgForZone = "zone2";
  2824. Log3 $hash, 5, "PIONEERAVR $name: received $line - message for zone2!";
  2825. # Zone 3 command
  2826. } elsif ( $line =~ m/^YV(\d\d)$|^Z3MUT(\d)$|^Z3F(\d\d)$|^BPR(0|1)$/ ) {
  2827. $msgForZone = "zone3";
  2828. Log3 $hash, 5, "PIONEERAVR $name: received $line - message for zone3!";
  2829. # hdZone command
  2830. } elsif ( $line =~ m/^ZEA(\d\d)$|^ZEP(0|1)$/ ) {
  2831. $msgForZone = "hdZone";
  2832. Log3 $hash, 5, "PIONEERAVR $name: received $line - message for hdZone!";
  2833. } else {
  2834. Log3 $hash, 5, "PIONEERAVR $name: received $line - don't know what this means - help me!";
  2835. }
  2836. # if PIONEERAVRZONE device exists for that zone, dispatch the command
  2837. # otherwise try to autocreate the device
  2838. unless( $msgForZone eq "" ) {
  2839. my $hashZone = $modules{PIONEERAVRZONE}{defptr}{$msgForZone};
  2840. Log3 $hash, 5, "PIONEERAVR $name: received message for Zone: ".$msgForZone;
  2841. if( !$hashZone ) {
  2842. my $ret = "UNDEFINED PIONEERAVRZONE_$msgForZone PIONEERAVRZONE $msgForZone";
  2843. Log3 $name, 3, "PIONEERAVR $name: $ret, please define it";
  2844. DoTrigger( "global", $ret );
  2845. }
  2846. # dispatch "zone" - commands to other zones
  2847. Dispatch( $hash, $line, undef ); # dispatch result to PIONEERAVRZONEs
  2848. Log3 $hash, 5, "PIONEERAVR $name: ".dq( $line ) ." interpreted as: not for the Main zone -> dispatch to PIONEERAVRZONEs zone: $msgForZone";
  2849. $msgForZone = "";
  2850. }
  2851. }
  2852. readingsEndUpdate( $hash, 1);
  2853. $hash->{PARTIAL} = $buf;
  2854. }
  2855. #####################################
  2856. sub
  2857. PIONEERAVR_Attr($@)
  2858. {
  2859. my @a = @_;
  2860. my $hash= $defs{$a[1]};
  2861. return undef;
  2862. }
  2863. #####################################
  2864. # helper functions
  2865. #####################################
  2866. #Function to show special chars (e.g. \n\r) in logs
  2867. sub dq($) {
  2868. my ( $s )= @_;
  2869. $s = "<nothing>" unless( defined( $s ) );
  2870. return "\"" . escapeLogLine( $s ) . "\"";
  2871. }
  2872. #####################################
  2873. #PIONEERAVR_Log() is used to show the data sent and received from/to PIONEERAVR if attr logTraffic is set
  2874. sub PIONEERAVR_Log($$$) {
  2875. my ( $hash, $loglevel, $logmsg ) = @_;
  2876. my $name = $hash->{NAME};
  2877. $loglevel = AttrVal( $name, "logTraffic", undef ) unless( defined( $loglevel ) );
  2878. return unless( defined( $loglevel ) );
  2879. Log3 $hash, $loglevel , "PIONEERAVR $name (loglevel: $loglevel) logTraffic: $logmsg";
  2880. }
  2881. #####################################
  2882. sub PIONEERAVR_DevInit($) {
  2883. my ( $hash ) = @_;
  2884. my $name = $hash->{NAME};
  2885. if ( lc( ReadingsVal( $name, "state", "?" ) ) eq "opened" ) {
  2886. DoTrigger( $name, "CONNECTED" );
  2887. }
  2888. else {
  2889. DoTrigger( $name, "DISCONNECTED" );
  2890. }
  2891. }
  2892. #####################################
  2893. sub PIONEERAVR_Reopen($) {
  2894. my ( $hash ) = @_;
  2895. my $name = $hash->{NAME};
  2896. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_Reopen()";
  2897. DevIo_CloseDev( $hash );
  2898. my $ret = DevIo_OpenDev( $hash, 1, undef );
  2899. if ( $hash->{STATE} eq "opened" ) {
  2900. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_Reopen() -> now opened";
  2901. if ( AttrVal( $name, "statusUpdateReconnect", "enable" ) eq "enable" ) {
  2902. PIONEERAVR_statusUpdate( $hash );
  2903. } else {
  2904. # update state by requesting power on/off status from the Pioneer AVR
  2905. PIONEERAVR_Write( $hash, "?P" );
  2906. }
  2907. }
  2908. return $ret;
  2909. }
  2910. #####################################
  2911. # writing to the Pioneer AV receiver
  2912. # connection check 3s (or attr timout seconds) after writing
  2913. sub PIONEERAVR_Write($$) {
  2914. my ( $hash, $msg ) = @_;
  2915. my $name = $hash->{NAME};
  2916. $msg = $msg."\r\n";
  2917. my $logMsg = "SimpleWrite " . dq( $msg );
  2918. PIONEERAVR_Log( $hash, undef, $logMsg );
  2919. DevIo_SimpleWrite( $hash, $msg, 0 );
  2920. # do connection check latest after TIMEOUT
  2921. my $next = gettimeofday() + AttrVal( $name, "timeout", "5" );
  2922. if ( !defined( $hash->{helper}{nextConnectionCheck} )
  2923. || $hash->{helper}{nextConnectionCheck} > $next )
  2924. {
  2925. $hash->{helper}{nextConnectionCheck} = $next;
  2926. RemoveInternalTimer($hash, "PIONEERAVR_connectionCheck");
  2927. InternalTimer( $next, "PIONEERAVR_connectionCheck", $hash, 0 );
  2928. }
  2929. }
  2930. ######################################################################################
  2931. # PIONEERAVR_connectionCheck is called if PIONEERAVR received no data for 120s
  2932. # we send a "new line" and expect (if the connection is up) to receive "R"
  2933. # DevIo_Expect() is used for this
  2934. # DevIO_Expect() sends a command (just a "new line") and waits up to 5s for a reply
  2935. # if there is a reply DevIO_Expect() returns the reply
  2936. # if there is no reply
  2937. # - DevIO_Expect() tries to close and reopen the connection
  2938. # - sends the command again
  2939. # - waits again up to 5 seconds for a reply
  2940. # - if there is a reply the state is set to "opened"
  2941. # - if there is no reply the state is set to "disconnected"
  2942. #
  2943. sub PIONEERAVR_connectionCheck ($) {
  2944. my ( $hash ) = @_;
  2945. my $name = $hash->{NAME};
  2946. my $verbose = AttrVal( $name, "verbose", "" );
  2947. RemoveInternalTimer( $hash, "PIONEERAVR_connectionCheck" );
  2948. $hash->{STATE} = "opened"; # assume we have an open connection
  2949. $attr{$name}{verbose} = 0 if ( $verbose eq "" || $verbose < 4 );
  2950. my $connState =
  2951. DevIo_Expect( $hash,
  2952. "\r\n",
  2953. AttrVal( $name, "timeout", "5" ) );
  2954. # successful connection
  2955. if ( defined($connState) ) {
  2956. # reset connectionCheck timer
  2957. my $checkInterval = AttrVal( $name, "connectionCheck", "60" );
  2958. if ( $checkInterval ne "off" ) {
  2959. my $next = gettimeofday() + $checkInterval;
  2960. $hash->{helper}{nextConnectionCheck} = $next;
  2961. InternalTimer( $next, "PIONEERAVR_connectionCheck", $hash, 0 );
  2962. }
  2963. if ($connState =~ m/^R\r?\n?$/) {
  2964. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_connectionCheck() --- connstate=R -> do nothing: ".dq($connState)." PARTIAL: ".dq( $hash->{PARTIAL});
  2965. } else {
  2966. $hash->{PARTIAL} .= $connState;
  2967. Log3 $name, 5, "PIONEERAVR $name: PIONEERAVR_connectionCheck() --- connstate<>R -> do nothing: ".dq($connState)." PARTIAL: ".dq( $hash->{PARTIAL});
  2968. }
  2969. }
  2970. $attr{$name}{verbose} = $verbose if ( $verbose ne "" );
  2971. delete $attr{$name}{verbose} if ( $verbose eq "" );
  2972. }
  2973. sub PIONEERAVR_screenUpdate($) {
  2974. my ($hash) = @_;
  2975. my $name = $hash->{NAME};
  2976. my $cmd = "updateScreen";
  2977. my $playerCmd = "";
  2978. Log3 $name, 3, "PIONEERAVR $name: PIONEERAVR_screenUpdate()";
  2979. if ( defined( $hash->{helper}{main}{CURINPUTNR} ) ) {
  2980. my $inputNr = $hash->{helper}{main}{CURINPUTNR};
  2981. if ($inputNr eq "17") {
  2982. $playerCmd = $cmd."Ipod";
  2983. #### homeMediaGallery, sirius, internetRadio, pandora, mediaServer, favorites, spotify
  2984. } elsif (($inputNr eq "26") ||($inputNr eq "27") || ($inputNr eq "38") || ($inputNr eq "41") || ($inputNr eq "44") || ($inputNr eq "45") || ($inputNr eq "53")) {
  2985. $playerCmd = $cmd."Network";
  2986. } else {
  2987. my $err = "PIONEERAVR $name: The command $cmd for input nr. $inputNr is not possible!";
  2988. Log3 $name, 3, $err;
  2989. return $err;
  2990. }
  2991. my $setCmd = $hash->{helper}{SETS}{main}{$playerCmd};
  2992. PIONEERAVR_Write( $hash, $setCmd);
  2993. } else {
  2994. Log3 $name, 3, "PIONEERAVR $name: PIONEERAVR_screenUpdate(): can't find the inputNr";
  2995. }
  2996. }
  2997. #########################################################
  2998. sub PIONEERAVR_statusUpdate($) {
  2999. my ($hash) = @_;
  3000. my $name = $hash->{NAME};
  3001. Log3 $name, 3, "PIONEERAVR $name: PIONEERAVR_statusUpdate()";
  3002. foreach my $zone ( keys %{$hash->{helper}{GETS}} ) {
  3003. foreach my $key ( keys %{$hash->{helper}{GETS}{$zone}} ) {
  3004. PIONEERAVR_Write( $hash, $hash->{helper}{GETS}->{$zone}->{$key});
  3005. select(undef, undef, undef, 0.1);
  3006. }
  3007. }
  3008. PIONEERAVR_askForInputNames( $hash,5);
  3009. }
  3010. #########################################################
  3011. sub PIONEERAVR_askForInputNames($$) {
  3012. my ($hash, $loglevel) = @_;
  3013. my $name = $hash->{NAME};
  3014. my $comstr = '';
  3015. my $now120 = gettimeofday()+120;
  3016. my $delay = 0.1;
  3017. RemoveInternalTimer( $hash, "PIONEERAVR_connectionCheck" );
  3018. InternalTimer( $now120, "PIONEERAVR_connectionCheck", $hash, 0 );
  3019. # we ask for the inputs 1 to 59 if an input name exists (command: ?RGB00 ... ?RGB59)
  3020. # and if the input is disabled (command: ?SSC0003 ... ?SSC5903)
  3021. # at least the model VSX-923 needs a break of 0.1s between each command, otherwise it closes the tcp port
  3022. for ( my $i=0; $i<60; $i++ ) {
  3023. #select( undef, undef, undef, 0.1 );
  3024. $comstr = sprintf '?RGB%02d', $i;
  3025. PIONEERAVR_Write( $hash,$comstr );
  3026. select( undef, undef, undef, $delay );
  3027. #digital(audio) input terminal (coax, optical, analog)
  3028. $comstr = sprintf '?SSC%02d00',$i;
  3029. PIONEERAVR_Write( $hash,$comstr );
  3030. select( undef, undef, undef, $delay );
  3031. #hdmi input terminal?
  3032. $comstr = sprintf '?SSC%02d01',$i;
  3033. PIONEERAVR_Write( $hash,$comstr );
  3034. select( undef, undef, undef, $delay );
  3035. #component video input terminal ?
  3036. $comstr = sprintf '?SSC%02d02',$i;
  3037. PIONEERAVR_Write( $hash,$comstr );
  3038. select( undef, undef, undef, $delay );
  3039. #input enabled/disabled?
  3040. $comstr = sprintf '?SSC%02d03',$i;
  3041. PIONEERAVR_Write( $hash,$comstr );
  3042. select( undef, undef, undef, $delay );
  3043. #inputLevelAdjust (-12dB ... +12dB)
  3044. $comstr = sprintf '?ILA%02d',$i;
  3045. PIONEERAVR_Write( $hash,$comstr );
  3046. }
  3047. }
  3048. sub PIONEERAVR_GetStateAV($) {
  3049. my ($hash) = @_;
  3050. my $name = $hash->{NAME};
  3051. if ( ReadingsVal( $name, "presence", "absent" ) eq "absent" ) {
  3052. return "absent";
  3053. } elsif ( ReadingsVal( $name, "power", "off" ) eq "off" ) {
  3054. return "off";
  3055. } elsif ( ReadingsVal( $name, "mute", "off" ) eq "on" ) {
  3056. return "muted";
  3057. } elsif (defined( $hash->{helper}{main}{CURINPUTNR})) {
  3058. my $iNr = $hash->{helper}{main}{CURINPUTNR};
  3059. if ( $hash->{helper}{INPUTNAMES}->{$iNr}{playerCommands} eq "1")
  3060. {
  3061. if ( ReadingsVal( $name, "playStatus", "" ) ne "" )
  3062. {
  3063. return ReadingsVal( $name, "playStatus", "stopped" );
  3064. } else {
  3065. return ReadingsVal( $name, "power", "off" );
  3066. }
  3067. } else {
  3068. return ReadingsVal( $name, "power", "off" );
  3069. }
  3070. } else {
  3071. return ReadingsVal( $name, "power", "off" );
  3072. }
  3073. }
  3074. #####################################
  3075. # Callback from 95_remotecontrol for command makenotify.
  3076. sub PIONEERAVR_RCmakenotify($$) {
  3077. my ($nam, $ndev) = @_;
  3078. my $nname = "notify_$nam";
  3079. fhem( "define $nname notify $nam set $ndev remoteControl ".'$EVENT',1);
  3080. Log3 undef, 2, "PIONEERAVR [remotecontrol:PIONEERAVR] Notify created: $nname";
  3081. return "Notify created by PIONEERAVR: $nname";
  3082. }
  3083. #####################################
  3084. # Default-remote control layout for PIONEERAVR
  3085. sub RC_layout_PioneerAVR() {
  3086. my $ret;
  3087. my @row;
  3088. $row[0] = "toggle:POWEROFF";
  3089. $row[1] = "volumeUp:UP,mute toggle:MUTE,inputUp:CHUP";
  3090. $row[2] = ":VOL,:blank,:PROG";
  3091. $row[3] = "volumeDown:DOWN,:blank,inputDown:CHDOWN";
  3092. $row[4] = "remoteControl audioParameter:AUDIO,remoteControl cursorUp:UP,remoteControl videoParameter:VIDEO";
  3093. $row[5] = "remoteControl cursorLeft:LEFT,remoteControl cursorEnter:ENTER,remoteControl cursorRight:RIGHT";
  3094. $row[6] = "remoteControl homeMenu:HOMEsym,remoteControl cursorDown:DOWN,remoteControl cursorReturn:RETURN";
  3095. $row[7] = "attr rc_iconpath icons/remotecontrol";
  3096. $row[8] = "attr rc_iconprefix black_btn_";
  3097. # unused available commands
  3098. return @row;
  3099. }
  3100. #####################################
  3101. 1;
  3102. =pod
  3103. =item device
  3104. =item summary control for PIONEER AV receivers via network or serial connection
  3105. =item summary_DE Steuerung von PIONEER AV Receiver per Netzwerk oder seriell
  3106. =begin html
  3107. <a name="PIONEERAVR"></a>
  3108. <h3>PIONEERAVR</h3>
  3109. <ul>
  3110. This module allows to remotely control a Pioneer AV receiver (only the Main zone, other zones are controlled by the module PIONEERAVRZONE)
  3111. equipped with an Ethernet interface or a RS232 port.
  3112. It enables Fhem to
  3113. <ul>
  3114. <li>switch ON/OFF the receiver</li>
  3115. <li>adjust the volume</li>
  3116. <li>set the input source</li>
  3117. <li>and configure some other parameters</li>
  3118. </ul>
  3119. <br><br>
  3120. This module is based on the <a href="http://www.pioneerelectronics.com/StaticFiles/PUSA/Files/Home%20Custom%20Install/Elite%20&%20Pioneer%20FY14AVR%20IP%20&%20RS-232%207-31-13.zip">Pioneer documentation</a>
  3121. and tested with a Pioneer AV receiver VSX-923 from <a href="http://www.pioneer.de">Pioneer</a>.
  3122. <br><br>
  3123. Note: this module requires the Device::SerialPort or Win32::SerialPort module
  3124. if the module is connected via serial Port or USB.
  3125. <br><br>
  3126. This module tries to
  3127. <ul>
  3128. <li>keep the data connection between Fhem and the Pioneer AV receiver open. If the connection is lost, this module tries to reconnect once</li>
  3129. <li>forwards data to the module PIONEERAVRZONE to control the ZONEs of a Pioneer AV receiver</li>
  3130. </ul>
  3131. As long as Fhem is connected to the Pioneer AV receiver no other device (e.g. a smart phone) can connect to the Pioneer AV receiver on the same port.
  3132. Some Pioneer AV receivers offer more than one port though. From Pioneer recommend port numbers:00023,49152-65535, Invalid port numbers:00000,08102
  3133. <br><br>
  3134. <a name="PIONEERAVRdefine"></a>
  3135. <b>Define</b>
  3136. <ul>
  3137. <code>define &lt;name&gt; PIONEERAVR telnet &lt;IPAddress:Port&gt;</code><br><br>
  3138. or<br><br>
  3139. <code>define &lt;name&gt; PIONEERAVR serial &lt;SerialDevice&gt;[&lt;@BaudRate&gt;]</code>
  3140. <br><br>
  3141. Defines a Pioneer AV receiver device (communication interface and main zone control). The keywords <code>telnet</code> or
  3142. <code>serial</code> are fixed. Default port on Pioneer AV receivers is 23 (according to the above mentioned Pioneer documetation) or 8102 (according to posts in the Fhem forum)<br>
  3143. Note: PIONEERAVRZONE devices to control zone2, zone3 and/or HD-zone are autocreated on reception of the first message for those zones.<br><br>
  3144. Examples:
  3145. <ul>
  3146. <code>define VSX923 PIONEERAVR telnet 192.168.0.91:23</code><br>
  3147. <code>define VSX923 PIONEERAVR serial /dev/ttyS0</code><br>
  3148. <code>define VSX923 PIONEERAVR serial /dev/ttyUSB0@9600</code><br>
  3149. </ul>
  3150. <br>
  3151. </ul>
  3152. <a name="PIONEERAVRset"></a>
  3153. <b>Set</b>
  3154. <ul>
  3155. <code>set &lt;name&gt; &lt;what&gt; [&lt;value&gt;]</code>
  3156. <br><br>
  3157. where &lt;what&gt; is one of
  3158. <li><b>bass <-6 ... 6></b> - Bass from -6dB to + 6dB (is only available if tone = on and the ListeningMode supports it)</li>
  3159. <li><b>channel <1 ... 9></b> - To change the tuner preset. Only available for input = 2 (Tuner)</li>
  3160. <li><b>channelDown</b> - Changes to the next lower tuner preset. Only available for input = 2 (Tuner)</li>
  3161. <li><b>channelStraight <A1...G9></b> - </li> To change the tuner preset with values as they are shown in the display of the Pioneer AV receiver eg. "A1". Only available for input = 2 (Tuner)
  3162. <li><b>channelUp</b> - Changes to the next higher tuner preset. Only available for input = 2 (Tuner)</li>
  3163. <li><b>down</b> - "arrow key down". Available for the same inputs as "play"</li>
  3164. <li><b>enter</b> - "Enter key". Available for the same inputs as "play" </li>
  3165. <li><b>eq <on|off></b> - Turns the equalizer on or off</li>
  3166. <li><b>fwd</b> - Fast forward. Available for the same inputs as "play"</li>
  3167. <li><b>hdmiOut <1+2|1|2|off></b> - Switches the HDMI output 1 and/or 2 of the Pioneer AV Receivers on or off.</li>
  3168. <li><b>input <not on the Pioneer hardware deactivated input></b> The list of possible (i.e. not deactivated)
  3169. inputs is read in during Fhem start and with <code>get <name> statusRequest</code>. Renamed inputs are shown with their new (renamed) name</li>
  3170. <li><b>inputDown</b> - Select the next lower input for the Main Zone</li>
  3171. <li><b>inputUp</b> - Select the next higher input for the Main Zone</li>
  3172. <li><b>left</b> - "Arrow key left". Available for the same inputs as "play"</li>
  3173. <li><b>listeningMode</b> - Sets a ListeningMode e.g. autoSourround, direct, action,...</li>
  3174. <li><b>mcaccMemory <1...6></b> - Sets one of the 6 predefined MCACC settings for the Main Zone</li>
  3175. <li><b>menu</b> - "Menu-key" of the remote control. Available for the same inputs as "play"</li>
  3176. <li><b>mute <on|off|toggle></b> - Mute the Main Zone of the Pioneer AV Receiver. "mute = on" means: Zero volume</li>
  3177. <li><b>networkStandby <on|off></b> - Turns Network standby on or off. To turn on a Pioneer AV Receiver with this module from standby, Network Standby must be "on". <code>set &lt;name&gt; networkStandby on</code> should do this</li>
  3178. <li><b>next</b> - Available for the same inputs as "play"</li>
  3179. <li><b>off</b> - Switch the Main Zone to standby</li>
  3180. <li><b>on</b> - Switch the Main Zone on from standby. This can only work if "Network Standby" is "on" in the Pioneer AV Receiver. Refer to "networkStandby" above.</li>
  3181. <li><b>pause</b> - Pause replay. Available for the same inputs as "play"</li>
  3182. <li><b>play</b> - Starts replay for the following inputs:
  3183. <ul>
  3184. <li>usbDac</li>
  3185. <li>ipodUsb</li>
  3186. <li>xmRadio</li>
  3187. <li>homeMediaGallery</li>
  3188. <li>sirius</li>
  3189. <li>adapterPort</li>
  3190. <li>internetRadio</li>
  3191. <li>pandora</li>
  3192. <li>mediaServer</li>
  3193. <li>favorites</li>
  3194. <li>mhl</li>
  3195. </ul>
  3196. </li>
  3197. <li><b>prev</b> - Changes to the previous title. Available for the same inputs as "play".</li>
  3198. <li><b>raw <PioneerKommando></b> - Sends the command <code>&lt;PioneerCommand&gt;</code> unchanged to the Pioneer AV receiver. A list of all available commands is available in the Pioneer documentation mentioned above</li>
  3199. <li><b>remoteControl <attr></b> - where <attr> is one of:
  3200. <ul>
  3201. <li>cursorDown</li>
  3202. <li>cursorRight</li>
  3203. <li>cursorLeft</li>
  3204. <li>cursorEnter</li>
  3205. <li>cursorReturn</li>
  3206. <li>homeMenu</li>
  3207. <li>statusDisplay</li>
  3208. <li>audioParameter</li>
  3209. <li>hdmiOutputParameter</li>
  3210. <li>videoParameter</li>
  3211. <li>homeMenu</li>
  3212. Simulates the keys of the remote control. Warning: The cursorXX keys cannot change the inputs -> set <name> up ... can be used for this
  3213. </ul>
  3214. </li>
  3215. <li><b>reopen</b> - Tries to reconnect Fhem to the Pioneer AV Receiver</li>
  3216. <li><b>repeat</b> - Repeat for the following inputs: AdapterPort, Ipod, Favorites, InternetRadio, MediaServer. Cycles between
  3217. <ul>
  3218. <li>no repeat</li>
  3219. <li>repeat current title</li>
  3220. <li>repeat all titles</li>
  3221. </ul>
  3222. </li>
  3223. <li><b>return</b> - "Return key". Available for the same inputs as "play"</li>
  3224. <li><b>rev</b> - "rev key". Available for the same inputs as "play"</li>
  3225. <li><b>right</b> - "Arrow key right". Available for the same inputs as "play"</li>
  3226. <li><b>selectLine01 - selectLine08</b> - Available for the same inputs as "play". If there is an OSD you can select the lines directly</li>
  3227. <li><b>shuffle</b> - Random replay. For the same inputs available as "repeat". Toggles between random on and off</li>
  3228. <li><b>signalSelect <auto|analog|digital|hdmi|cycle></b> - Signal select function </li>
  3229. <li><b>speakers <off|A|B|A+B></b> - Turns speaker A and or B on or off.</li>
  3230. <li><b>standingWave <on|off></b> - Turns Standing Wave on or off for the Main Zone</li>
  3231. <li><b>statusRequest</b> - Asks the Pioneer AV Receiver for information to update the modules readings</li>
  3232. <li><b>stop</b> - Stops replay. Available for the same inputs as "play"</li>
  3233. <li><b>toggle</b> - Toggle the Main Zone to/from Standby</li>
  3234. <li><b>tone <on|bypass></b> - Turns tone on or in bypass</li>
  3235. <li><b>treble <-6 ... 6></b> - Treble from -6dB to + 6dB (works only if tone = on and the ListeningMode permits it)</li>
  3236. <li><b>up</b> - "Arrow key up". Available for the same inputs as "play"</li>
  3237. <li><b>volume <0 ... 100></b> - Volume of the Main Zone in % of the maximum volume</li>
  3238. <li><b>volumeDown</b> - Reduce the volume of the Main Zone by 0.5dB</li>
  3239. <li><b>volumeUp</b> - Increase the volume of the Main Zone by 0.5dB</li>
  3240. <li><b>volumeStraight<-80.5 ... 12></b> - Set the volume of the Main Zone with values from -80 ... 12 (As it is displayed on the Pioneer AV receiver</li>
  3241. <li><a href="#setExtensions">set extensions</a> are supported (except <code>&lt;blink&gt;</code> )</li>
  3242. <br><br>
  3243. Example:
  3244. <ul>
  3245. <code>set VSX923 on</code><br>
  3246. </ul>
  3247. <br>
  3248. <code>set &lt;name&gt; reopen</code>
  3249. <br><br>
  3250. Closes and reopens the device. Could be handy if the connection between Fhem and the Pioneer AV receiver is lost and cannot be
  3251. reestablished automatically.
  3252. <br><br>
  3253. </ul>
  3254. <a name="PIONEERAVRget"></a>
  3255. <b>Get</b>
  3256. does not return any value but asks the Pioneer AVR for the current status (e.g. of the volume). As soon as the Pioneer AVR replies (the time, till the Pioneer AVR replies is unpredictable), the readings or internals of this pioneerAVR modul are updated.
  3257. <ul>
  3258. <li><b>loadInputNames</b> - reads the names of the inputs from the Pioneer AV receiver and checks if those inputs are enabled</li>
  3259. <li><b>audioInfo</b> - get the current audio parameters from the Pioneer AV receiver (e.g. audioInputSignal, audioInputFormatXX, audioOutputFrequency)</li>
  3260. <li><b>display</b> - updates the reading 'display' and 'displayPrevious' with what is shown on the display of the Pioneer AV receiver</li>
  3261. <li><b>bass</b> - updates the reading 'bass'</li>
  3262. <li><b>channel</b> - </li>
  3263. <li><b>currentListIpod</b> - updates the readings currentAlbum, currentArtist, etc. </li>
  3264. <li><b>currentListNetwork</b> - </li>
  3265. <li><b>display</b> - </li>
  3266. <li><b>input</b> - </li>
  3267. <li><b>listeningMode</b> - </li>
  3268. <li><b>listeningModePlaying</b> - </li>
  3269. <li><b>macAddress</b> - </li>
  3270. <li><b>avrModel</b> - get the model of the Pioneer AV receiver, eg. VSX923 </li>
  3271. <li><b>mute</b> - </li>
  3272. <li><b>networkPorts</b> - get the open tcp/ip ports of the Pioneer AV Receiver</li>
  3273. <li><b>networkSettings</b> - get the IP network settings (ip, netmask, gateway,dhcp, dns1, dns2, proxy) of the Pioneer AV Receiver. The values are stored as INTERNALS not as READINGS </li>
  3274. <li><b>networkStandby</b> - get the current setting of networkStandby -> the value of networkStandby (on|off) is stored as an INTERNAL not as a READING</li>
  3275. <li><b>power</b> - get the Power state of the Pioneer AV receiver </li>
  3276. <li><b>signalSelect</b> - </li>
  3277. <li><b>softwareVersion</b> - get the software version of the software currently running in the Pioneer AV receiver. The value is stored as INTERNAL</li>
  3278. <li><b>speakers</b> - </li>
  3279. <li><b>speakerSystem</b> - </li>
  3280. <li><b>tone</b> - </li>
  3281. <li><b>tunerFrequency</b> - get the current frequency the tuner is set to</li>
  3282. <li><b>tunerChannelNames</b> - </li>
  3283. <li><b>treble</b> - </li>
  3284. <li><b>volume</b> - </li>
  3285. </ul>
  3286. <br><br>
  3287. <a name="PIONEERAVRattr"></a>
  3288. <b>Attributes</b>
  3289. <br><br>
  3290. <ul>
  3291. <li>
  3292. <b>connectionCheck</b> &nbsp;&nbsp;1..120,off&nbsp;&nbsp; Pings the Pioneer AVR every X seconds to verify connection status. Defaults to 60 seconds.
  3293. </li>
  3294. <li>
  3295. <b>timeout</b> &nbsp;&nbsp;1,2,3,4,5,7,10,15&nbsp;&nbsp; Max time in seconds till the Pioneer AVR replies to a ping. Defaults to 3 seconds.
  3296. </li>
  3297. <li><b>checkStatusStart &lt;enable|disable&gt;</b> - Enables/disables the status update (read all values from the Pioneer AV receiver, can take up to one minute) when the module is loaded.(Default: enable)</li>
  3298. <li><b>checkStatusReconnect &lt;enable|disable&gt;</b> - Enables/disables the status update (read all values from the Pioneer AV receiver, can take up to one minute) when the connection to the Pioneer AV receiver is reestablished.(Default: enable)</li>
  3299. <li><b>logTraffic &lt;loglevel&gt;</b> - Enables logging of sent and received datagrams with the given loglevel.
  3300. Control characters in the logged datagrams are escaped, i.e. a double backslash is shown for a single backslash,
  3301. \n is shown for a line feed character,...</li>
  3302. <li><b><a href="#verbose">verbose</a></b> - 0: log es less as possible, 5: log as much as possible</li>
  3303. <li><b>volumeLimit &lt;0 ... 100&gt;</b> - limits the volume to the given value</li>
  3304. <li><b>volumeLimitStraight &lt;-80 ... 12&gt;</b> - limits the volume to the given value</li>
  3305. </ul>
  3306. <br><br>
  3307. <b>Generated Readings/Events:</b>
  3308. <br/><br/>
  3309. <ul>
  3310. <li><b>audioAutoPhaseControlMS</b> - currently configured Auto Phase Control in ms</li>
  3311. <li><b>audioAutoPhaseControlRevPhase</b> - acurrently configured Auto Phase Control reverse Phase -> 1 means: reverse phase</li>
  3312. <li><b>audioInputFormat<XXX></b> - Shows if the channel XXX is available in the audio input signal (1 means: is available)</li>
  3313. <li><b>audioInputFrequency</b> - Frequency of the input signal</li>
  3314. <li><b>audioInputSignal</b> - Type of the input signal (z.B. ANALOG, PCM, DTS,...)</li>
  3315. <li><b>audioOutputFormat<XXX></b> - Shows if the channel XXX is available in the audio output sgnal (1 means: is available)</li>
  3316. <li><b>audioOutputFrequency</b> - Frequency of the audio output signal</li>
  3317. <li><b>bass</b> - currently set bass</li>
  3318. <li><b>channel</b> - Tuner Preset (1...9)</li>
  3319. <li><b>channelStraight</b> - Tuner Preset as diplayed in the display of the Pioneer AV Receiver, e.g. A2</li>
  3320. <li><b>display</b> - Currently dispayed text in the display of the Pioneer AV Receiver</li>
  3321. <li><b>displayPrevious</b> - Previous displayed text</li>
  3322. <li><b>eq</b> - Equalizer status of the Pioneer AV Receiver (on|off)</li>
  3323. <li><b>hdmiOut</b> - Shows the currently selected HDMI-output(s)?</li>
  3324. <li><b>input</b> - shows the currently selected input</li>
  3325. <li><b>inputsList</b> - ":" separated list of all activated inputs</li>
  3326. <li><b>listeningMode</b> - Currently set Listening Mode</li>
  3327. <li><b>listeningModePlaying</b> - Currently used Listening Mode</li>
  3328. <li><b>mcaccMemory</b> - MCACC Setting</li>
  3329. <li><b>mute</b> - Mute (on|off)</li>
  3330. <li><b>power</b> - Main Zone on or standby?</li>
  3331. <li><b>pqlsWorking</b> - currently set PQLS</li>
  3332. <li><b>presence</b> - Is the Pioneer AV Receiver reachable via ethernet?</li>
  3333. <li><b>screenHirarchy</b> - Hirarchy of the currently shown On Screen Displays (OSD)</li>
  3334. <li><b>screenLine01...08</b> - Content of the lines 01...08 of the OSD</li>
  3335. <li><b>screenLineHasFocus</b> - Which line of the OSD has the focus?</li>
  3336. <li><b>screenLineNumberFirst</b> - Long lists are shown in the OSD in smaller pages with 8 lines. This shows which elemnt of the lang list is the currently shown first line.</li>
  3337. <li><b>screenLineNumberLast</b> - Long lists are shown in the OSD in smaller pages with 8 lines. This shows which elemnt of the lang list is the currently shown last line.</li>
  3338. <li><b>screenLineNumbersTotal</b> - How many lines has the full list</li>
  3339. <li><b>screenLineNumbers</b> - How many lines has the OSD</li>
  3340. <li><b>screenLineType01...08</b> - Which type has line 01...08? E.g. "directory", "Now playing", "current Artist",...</li>
  3341. <li><b>screenName</b> - Name of the OSD</li>
  3342. <li><b>screenReturnKey</b> - Is the "Return-Key" in this OSD available?</li>
  3343. <li><b>screenTopMenuKey</b> - Is the "Menu-Key" in this OSD available?</li>
  3344. <li><b>screenToolsKey</b> - Is the "Tools-Key" (Menu, edit, ipod control) in this OSD available?</li>
  3345. <li><b>screenType</b> - Type of the OSD, e.g. "message", "List", "playing(play)",...</li>
  3346. <li><b>speakerSystem</b> - Shows how the rear surround speaker connectors and the B-speaker connectors are used</li>
  3347. <li><b>speakers</b> - Which speaker output connectors are active?</li>
  3348. <li><b>standingWave</b> - Standing wave</li>
  3349. <li>
  3350. <b>state</b> - Is set while connecting from fhem to the Pioneer AV Receiver (disconnected|innitialized|off|on|opened)
  3351. </li>
  3352. <li>
  3353. <b>stateAV</b> - Status from user perspective combining readings presence, power, mute and playStatus to a useful overall status (on|off|absent|stopped|playing|paused|fast-forward|fast-rewind).
  3354. </li>
  3355. <li><b>tone</b> - Is the tone control turned on?</li>
  3356. <li><b>treble</b> - Current value of treble</li>
  3357. <li><b>tunerFrequency</b> - Tuner frequency</li>
  3358. <li><b>volume</b> - Current value of volume (0%-100%)</li>
  3359. <li><b>volumeStraight</b> - Current value of volume os displayed in the display of the Pioneer AV Receiver</li>
  3360. </ul>
  3361. <br><br>
  3362. </ul>
  3363. =end html
  3364. =begin html_DE
  3365. <a name="PIONEERAVR"></a>
  3366. <h3>PIONEERAVR</h3>
  3367. <ul>
  3368. Dieses Modul erlaubt es einen Pioneer AV Receiver via Fhem zu steuern (nur die MAIN-Zone, etwaige andere Zonen können mit dem Modul PIONEERAVRZONE gesteuert werden) wenn eine Datenverbindung via Ethernet oder RS232 hergestellt werden kann.
  3369. Es erlaubt Fhem
  3370. <ul>
  3371. <li>Den Receiver ein/auszuschalten</li>
  3372. <li>die Lautstärke zu ändern</li>
  3373. <li>die Eingangsquelle auszuwählen</li>
  3374. <li>und weitere Parameter zu kontrollieren</li>
  3375. </ul>
  3376. <br><br>
  3377. Dieses Modul basiert auf der <a href="http://www.pioneerelectronics.com/StaticFiles/PUSA/Files/Home%20Custom%20Install/Elite%20&%20Pioneer%20FY14AVR%20IP%20&%20RS-232%207-31-13.zip">Pioneer documentation</a>
  3378. und ist mit einem Pioneer AV Receiver VSX-923 von <a href="http://www.pioneer.de">Pioneer</a> getestet.
  3379. <br><br>
  3380. Achtung: Dieses Modul benötigt die Perl-Module Device::SerialPort oder Win32::SerialPort
  3381. wenn die Datenverbindung via USB bzw. rs232 Port erfolgt.
  3382. <br><br>
  3383. Dieses Modul versucht
  3384. <ul>
  3385. <li>die Datenverbindung zwischen Fhem und Pioneer AV Receiver offen zu halten. Wenn die Verbindung abbricht, versucht das Modul
  3386. einmal die Verbindung wieder herzustellen</li>
  3387. <li>Daten vom/zum Pioneer AV Receiver dem Modul PIONEERAVRZONE (für die Kontrolle weiterer Zonen des Pioneer AV Receiver)
  3388. zur Verfügung zu stellen.</li>
  3389. </ul>
  3390. Solange die Datenverbindung zwischen Fhem und dem Pioneer AV Receiver offen ist, kann kein anderes Gerät (z.B. ein Smartphone)
  3391. auf dem gleichen Port eine Verbindung zum Pioneer AV Receiver herstellen.
  3392. Einige Pioneer AV Receiver bieten mehr als einen Port für die Datenverbindung an. Pioneer empfiehlt Port 23 sowie 49152-65535, "Invalid number:00000,08102".
  3393. <br><br>
  3394. <a name="PIONEERAVRdefine"></a>
  3395. <b>Define</b>
  3396. <ul>
  3397. <code>define &lt;name&gt; PIONEERAVR telnet &lt;IPAddress:Port&gt;</code><br><br>
  3398. or<br><br>
  3399. <code>define &lt;name&gt; PIONEERAVR serial &lt;SerialDevice&gt;[&lt;@BaudRate&gt;]</code>
  3400. <br><br>
  3401. Definiert ein Fhem device für einen Pioneer AV Receiver (Kommunikationsschnittstelle und Steuerung der Main - Zone). Die Schlüsselwörter <code>telnet</code> bzw.
  3402. <code>serial</code> sind fix. Der Standard Port für die Ethernet Verbindung bei Pioneer AV Receiver ist 23
  3403. (laut der oben angeführten Pioneer Dokumentation) - oder 8102 (laut Fhem-Forumsberichten).<br>
  3404. Note: PIONEERAVRZONE-Devices zur Steuerung der Zone2, Zone3 und/oder HD-Zone werden per autocreate beim Eintreffen der ersten Nachricht für eine der Zonen erzeugt.
  3405. <br><br>
  3406. Beispiele:
  3407. <ul>
  3408. <code>define VSX923 PIONEERAVR telnet 192.168.0.91:23</code><br>
  3409. <code>define VSX923 PIONEERAVR serial /dev/ttyS0</code><br>
  3410. <code>define VSX923 PIONEERAVR serial /dev/ttyUSB0@9600</code><br>
  3411. </ul>
  3412. <br>
  3413. </ul>
  3414. <a name="PIONEERAVRset"></a>
  3415. <b>Set</b>
  3416. <ul>
  3417. <code>set &lt;name&gt; &lt;was&gt; [&lt;value&gt;]</code>
  3418. <br><br>
  3419. "was" ist eines von
  3420. <li><b>bass <-6 ... 6></b> - Bass von -6dB bis + 6dB (funktioniert nur wenn tone = on und der ListeningMode es erlaubt)</li>
  3421. <li><b>channel <1 ... 9></b> - Setzt den Tuner Preset ("gespeicherten Sender"). Nur verfügbar, wenn Input = 2 (Tuner), wie in http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV beschrieben</li>
  3422. <li><b>channelDown</b> - Setzt den nächst niedrigeren Tuner Preset ("gespeicherten Sender"). Wenn vorher channel = 2, so wird nachher channel = 1. Nur verfügbar, wenn Input = 2 (Tuner).</li>
  3423. <li><b>channelStraight <A1...G9></b> - </li> Setzt den Tuner Preset ("gespeicherten Sender") mit Werten, wie sie im Display des Pioneer AV Receiver angezeigt werden (z.B. A1). Nur verfügbar, wenn Input = 2 (Tuner).
  3424. <li><b>channelUp</b> - Setzt den nächst höheren Tuner Preset ("gespeicherten Sender"). Nur verfügbar, wenn Input = 2 (Tuner).</li>
  3425. <li><b>down</b> - "Pfeiltaste nach unten". Für die gleichen Eingangsquellen wie "play"</li>
  3426. <li><b>enter</b> - "Eingabe" - Entspricht der "Enter-Taste" der Fernbedienung. Für die gleichen Eingangsquellen wie "play"</li>
  3427. <li><b>eq <on|off></b> - Schalten den Equalizer ein oder aus.</li>
  3428. <li><b>fwd</b> - Schnellvorlauf. Für die gleichen Eingangsquellen wie "play"</li>
  3429. <li><b>hdmiOut <1+2|1|2|off></b> - Schaltet die HDMI-Ausgänge 1 und/oder 2 des Pioneer AV Receivers ein bzw. aus.</li>
  3430. <li><b>input <nicht am Pioneer AV Receiver deaktivierte Eingangsquelle></b> - Schaltet die Eingangsquelle (z.B. CD, HDMI 1,...) auf die Ausgänge der Main-Zone. Die Liste der verfügbaren (also der nicht deaktivierten)
  3431. Eingangsquellen wird beim Start von Fhem und auch mit <code>get <name> statusRequest</code> eingelesen. Wurden die Eingänge am Pioneer AV Receiver umbenannt, wird der neue Name des Eingangs angezeigt.</li>
  3432. <li><b>inputDown</b> - vorherige Eingangsquelle der Main Zone auswählen</li>
  3433. <li><b>inputUp</b> - nächste Eingangsquelle der Main Zone auswählen</li>
  3434. <li><b>left</b> - "Pfeiltaste nach links". Für die gleichen Eingangsquellen wie "play"</li>
  3435. <li><b>listeningMode</b> - Setzt einen ListeningMode, z.B. autoSourround, direct, action,...</li>
  3436. <li><b>mcaccMemory <1...6></b> - Setzt einen der bis zu 6 gespeicherten MCACC Einstellungen der Main Zone</li>
  3437. <li><b>menu</b> - "Menu-Taste" der Fernbedienung. Für die gleichen Eingangsquellen wie "play"</li>
  3438. <li><b>mute <on|off|toggle></b> - Stummschalten der Main Zone des Pioneer AV Receivers. "mute = on" bedeutet: stumm</li>
  3439. <li><b>networkStandby <on|off></b> - Schaltet Network standby ein oder aus. Um einen Pioneer AV Receiver mit diesem Modul aus dem Standby einzuschalten, muss Network Standby = on sein. Mit <code>set &lt;name&gt; networkStandby on</code> sollte sich das machen lassen.</li>
  3440. <li><b>next</b> - für die gleichen Eingangsquellen wie "play"</li>
  3441. <li><b>off</b> - Ausschalten der Main Zone in den Standby Modus.</li>
  3442. <li><b>on</b> - Einschalten der Main Zone aus dem Standby Modus. Das funktioniert nur, wenn am Pioneer AV Receiver "Network Standby" "on" eingestellt ist. Siehe dazu auch "networkStandby" weiter unten.</li>
  3443. <li><b>pause</b> - Unterbricht die Wiedergabe für die gleichen Eingangsquellen wie "play"</li>
  3444. <li><b>play</b> - Startet die Wiedergabe für folgende Eingangsquellen:
  3445. <ul>
  3446. <li>usbDac</li>
  3447. <li>ipodUsb</li>
  3448. <li>xmRadio</li>
  3449. <li>homeMediaGallery</li>
  3450. <li>sirius</li>
  3451. <li>adapterPort</li>
  3452. <li>internetRadio</li>
  3453. <li>pandora</li>
  3454. <li>mediaServer</li>
  3455. <li>favorites</li>
  3456. <li>mhl</li>
  3457. </ul>
  3458. </li>
  3459. <li><b>prev</b> - Wechselt zum vorherigen Titel. Für die gleichen Eingangsquellen wie "play".</li>
  3460. <li><b>raw <PioneerKommando></b> - Sendet den Befehl <code><PioneerKommando></code> unverändert an den Pioneer AV Receiver. Eine Liste der verfügbaren Pioneer Kommandos ist in dem Link zur Pioneer Dokumentation oben enthalten</li>
  3461. <li><b>remoteControl <attr></b> - wobei <attr> eines von folgenden sein kann:
  3462. <ul>
  3463. <li>cursorDown</li>
  3464. <li>cursorRight</li>
  3465. <li>cursorLeft</li>
  3466. <li>cursorEnter</li>
  3467. <li>cursorReturn</li>
  3468. <li>homeMenu</li>
  3469. <li>statusDisplay</li>
  3470. <li>audioParameter</li>
  3471. <li>hdmiOutputParameter</li>
  3472. <li>videoParameter</li>
  3473. <li>homeMenu</li>
  3474. Simuliert die Tasten der Fernbedienung. Achtung: mit cursorXX können die Eingänge nicht beeinflusst werden -> set <name> up ... kann zur Steuerung der Inputs verwendet werden.
  3475. </ul>
  3476. </li>
  3477. <li><b>reopen</b> - Versucht die Datenverbindung zwischen Fhem und dem Pioneer AV Receiver wieder herzustellen</li>
  3478. <li><b>repeat</b> - Wiederholung für folgende Eingangsquellen: AdapterPort, Ipod, Favorites, InternetRadio, MediaServer. Wechselt zyklisch zwischen
  3479. <ul>
  3480. <li>keine Wiederholung</li>
  3481. <li>Wiederholung des aktuellen Titels</li>
  3482. <li>Wiederholung aller Titel</li>
  3483. </ul>
  3484. </li>
  3485. <li><b>return</b> - "Zurück"... Entspricht der "Return-Taste" der Fernbedienung. Für die gleichen Eingangsquellen wie "play"</li>
  3486. <li><b>rev</b> - "Rückwärtssuchlauf". Für die gleichen Eingangsquellen wie "play"</li>
  3487. <li><b>right</b> - "Pfeiltaste nach rechts". Für die gleichen Eingangsquellen wie "play"</li>
  3488. <li><b>selectLine01 - selectLine08</b> - für die gleichen Eingangsquellen wie "play".Wird am Bildschirm ein Pioneer-Menu angezeigt, kann hiermit die gewünschte Zeile direkt angewählt werden</li>
  3489. <li><b>shuffle</b> - Zufällige Wiedergabe für die gleichen Eingangsquellen wie "repeat". Wechselt zyklisch zwischen Zufallswiedergabe "ein" und "aus".</li>
  3490. <li><b>signalSelect <auto|analog|digital|hdmi|cycle></b> - Setzt den zu verwendenden Eingang (bei Eingängen mit mehreren Anschlüssen) </li>
  3491. <li><b>speakers <off|A|B|A+B></b> - Schaltet die Lautsprecherausgänge ein/aus.</li>
  3492. <li><b>standingWave <on|off></b> - Schaltet Standing Wave der Main Zone aus/ein</li>
  3493. <li><b>statusRequest</b> - Fragt Informationen vom Pioneer AV Receiver ab und aktualisiert die readings entsprechend</li>
  3494. <li><b>stop</b> - Stoppt die Wiedergabe für die gleichen Eingangsquellen wie "play"</li>
  3495. <li><b>toggle</b> - Ein/Ausschalten der Main Zone in/von Standby</li>
  3496. <li><b>tone <on|bypass></b> - Schaltet die Klangsteuerung ein bzw. auf bypass</li>
  3497. <li><b>treble <-6 ... 6></b> - Höhen (treble) von -6dB bis + 6dB (funktioniert nur wenn tone = on und der ListeningMode es erlaubt)</li>
  3498. <li><b>up</b> - "Pfeiltaste nach oben". Für die gleichen Eingangsquellen wie "play"</li>
  3499. <li><b>volume <0 ... 100></b> - Lautstärke der Main Zone in % der Maximallautstärke</li>
  3500. <li><b>volumeDown</b> - Lautstärke der Main Zone um 0.5dB verringern</li>
  3501. <li><b>volumeUp</b> - Lautstärke der Main Zone um 0.5dB erhöhen</li>
  3502. <li><b>volumeStraight<-80.5 ... 12></b> - Direktes Einstellen der Lautstärke der Main Zone mit einem Wert, wie er am Display des Pioneer AV Receiver angezeigt wird</li>
  3503. <li><a href="#setExtensions">set extensions</a> (ausser <code>&lt;blink&gt;</code> ) werden unterstützt</li>
  3504. <br><br>
  3505. Beispiel:
  3506. <ul>
  3507. <code>set VSX923 on</code><br>
  3508. </ul>
  3509. <br>
  3510. <code>set &lt;name&gt; reopen</code>
  3511. <br><br>
  3512. Schließt und öffnet erneut die Datenverbindung von Fhem zum Pioneer AV Receiver.
  3513. Kann nützlich sein, wenn die Datenverbindung nicht automatisch wieder hergestellt werden kann.
  3514. <br><br>
  3515. </ul>
  3516. <a name="PIONEERAVRget"></a>
  3517. <b>Get</b>
  3518. <ul>
  3519. <code>get &lt;name&gt; raw &lt;Befehl&gt;</code>
  3520. <br><br>
  3521. liefert bei diesem Modul keine Werte zurück, sondern fragt den Pioneer AVR nach dem aktuellen Status (z.B. der Lautstärke). Sobald der Pioneer AVR antwortet (die Zeit, bis der Pioneer AVR antwortet, ist nicht vorhersehbar), aktualisiert das Modul die Readings bzw. Internals des PioneerAVR devices.
  3522. Falls unten keine Beschreibung für das "get-Kommando" angeführt ist, siehe gleichnamiges "Set-Kommando"
  3523. <li><b>loadInputNames</b> - liest die Namen der Eingangsquellen vom Pioneer AV Receiver und überprüft, ob sie aktiviert sind</li>
  3524. <li><b>audioInfo</b> - Holt die aktuellen Audio Parameter vom Pioneer AV receiver (z.B. audioInputSignal, audioInputFormatXX, audioOutputFrequency)</li>
  3525. <li><b>display</b> - Aktualisiert das reading 'display' und 'displayPrevious' mit der aktuellen Anzeige des Displays Pioneer AV Receiver</li>
  3526. <li><b>bass</b> - aktualisiert das reading 'bass'</li>
  3527. <li><b>channel</b> - </li>
  3528. <li><b>currentListIpod</b> - aktualisiert die readings currentAlbum, currentArtist, etc. </li>
  3529. <li><b>currentListNetwork</b> - </li>
  3530. <li><b>input</b> - </li>
  3531. <li><b>listeningMode</b> - </li>
  3532. <li><b>listeningModePlaying</b> - </li>
  3533. <li><b>macAddress</b> - </li>
  3534. <li><b>avrModel</b> - Versucht vom Pioneer AV Receiver die Modellbezeichnung (z.B. VSX923) einzulesen und im gleichnamigen INTERNAL abzuspeichern</li>
  3535. <li><b>mute</b> - </li>
  3536. <li><b>networkPorts</b> - Versucht vom Pioneer AV Receiver die offenen Ethernet Ports einzulesen und als INTERNAL networkPort1 ... networkPort4 abzuspeichern</li>
  3537. <li><b>networkSettings</b> - Versucht vom Pioneer AV Receiver die Netzwerkparameter (IP, Gateway, Netmask, Proxy, DHCP, DNS1, DNS2) einzulesen und in INTERNALS abzuspeichern</li>
  3538. <li><b>networkStandby</b> - Versucht vom Pioneer AV Receiver den Parameter networkStandby (kann on oder off sein) einzulesen und als INTERNAL abzuspeichern</li>
  3539. <li><b>power</b> - Versucht vom Pioneer AV Receiver in Erfahrung zu bringen, ob die Main Zone eingeschaltet oder in Standby ist.</li>
  3540. <li><b>signalSelect</b> - </li>
  3541. <li><b>softwareVersion</b> - Fragt den Pioneer AV Receiver nach der aktuell im Receiver verwendeten Software Version und speichert diese als INTERNAL</li>
  3542. <li><b>speakers</b> - </li>
  3543. <li><b>speakerSystem</b> - Fragt die aktuell verwendete Lautsprecheranwendung vom Pioneer AV Receiver ab. Mögliche Werte sind z.B. "ZONE 2", "Normal(SB/FH)", "5.1ch C+Surr Bi-Amp",...</li>
  3544. <li><b>tone</b> - </li>
  3545. <li><b>tunerFrequency</b> - Fragt die aktuell eingestellte Frequenz des Tuners ab</li>
  3546. <li><b>tunerChannelNames</b> - Sollten für die Tuner Presets Namen im Pioneer AV Receiver gespeichert sein, werden sie hiermit abgefragt</li>
  3547. <li><b>treble</b> - </li>
  3548. <li><b>volume</b> - </li>
  3549. </ul>
  3550. <br><br>
  3551. <a name="PIONEERAVRattr"></a>
  3552. <b>Attribute</b>
  3553. <br><br>
  3554. <ul>
  3555. <li>
  3556. <b>connectionCheck</b> &nbsp;&nbsp;1..120,off&nbsp;&nbsp; Pingt den Pioneer AV Receiver alle X Sekunden um den Datenverbindungsstatus zu überprüfen. Standard: 60 Sekunden.
  3557. </li>
  3558. <li>
  3559. <b> timeout</b> &nbsp;&nbsp;1,2,3,4,5,7,10,15&nbsp;&nbsp;Zeit in Sekunden, innerhalb der der Pioneer AV Receiver auf einen Ping antwortet. Standard: 3 Sekunden.
  3560. </li>
  3561. <li>
  3562. <b>statusUpdateStart &lt;enable|disable&gt;</b> - Ein-/Ausschalten des Status Updates (lesen aller Parameter vom Pioneer AV Receiver, dauert bis zu einer Minute) beim Start des Moduls.
  3563. Mit "disable" lässt sich das Status Update abschalten, FHEM startet schneller, das Pioneer Modul zeigt eventuell nicht korrekte readings.
  3564. </li>
  3565. <li><b>statusUpdateReconnect &lt;enable|disable&gt;</b> - Ein-/Ausschalten des Status Updates (lesen aller Parameter vom Pioneer AV Receiver, dauert bis zu einer Minute) nach dem Wiederherstellen der Datenverbindung zum Pioneer AV Receiver.
  3566. Mit "disable" lässt sich das Status Update abschalten, FHEM bleibt reaktiver beim reconnect, das Pioneer Modul zeigt eventuell nicht korrekte readings.</li>
  3567. <li><b>logTraffic &lt;loglevel&gt;</b> - Ermöglicht das Protokollieren ("Loggen") der Datenkommunikation vom/zum Pioneer AV Receiver.
  3568. Steuerzeichen werden angezeigt z.B. ein doppelter Rückwärts-Schrägstrich wird als einfacher Rückwärts-Schrägstrich angezeigt,
  3569. \n wird für das Steuerzeichen "line feed" angezeigt, etc.</li>
  3570. <li><b><a href="#verbose">verbose</a></b> - Beeinflusst die Menge an Informationen, die dieses Modul protokolliert. 0: möglichst wenig in die Fhem Logdatei schreiben, 5: möglichst viel in die Fhem Logdatei schreiben</li>
  3571. <li><b>volumeLimit &lt;0 ... 100&gt;</b> - beschränkt die maximale Lautstärke (in %). Selbst wenn manuell am Pioneer AV Receiver eine höher Lautstärke eingestellt wird, regelt Fhem die Lautstärke auf volumeLimit zurück.</li>
  3572. <li><b>volumeLimitStraight &lt; -80 ... 12&gt;</b> - beschränkt die maximale Lautstärke (Werte wie am Display des Pioneer AV Receiver angezeigt). Selbst wenn manuell am Pioneer AV Receiver eine höher Lautstärke eingestellt wird, regelt Fhem die Lautstärke auf volumeLimit zurück.</li>
  3573. </ul>
  3574. <br><br>
  3575. <b>Generated Readings/Events:</b>
  3576. <br/><br/>
  3577. <ul>
  3578. <li><b>audioAutoPhaseControlMS</b> - aktuell konfigurierte Auto Phase Control in ms</li>
  3579. <li><b>audioAutoPhaseControlRevPhase</b> - aktuell konfigurierte Auto Phase Control reverse Phase -> 1 bedeutet: reverse phase</li>
  3580. <li><b>audioInputFormat<XXX></b> - Zeigt ob im Audio Eingangssignal der Kanal XXX vorhanden ist (1 bedeutet: ist vorhanden)</li>
  3581. <li><b>audioInputFrequency</b> - Frequenz des Eingangssignals</li>
  3582. <li><b>audioInputSignal</b> - Art des Inputsignals (z.B. ANALOG, PCM, DTS,...)</li>
  3583. <li><b>audioOutputFormat<XXX></b> - Zeigt ob im Audio Ausgangssignal der Kanal XXX vorhanden ist (1 bedeutet: ist vorhanden)</li>
  3584. <li><b>audioOutputFrequency</b> - Frequenz des Ausgangssignals</li>
  3585. <li><b>bass</b> - aktuell konfigurierte Bass-Einstellung</li>
  3586. <li><b>channel</b> - Tuner Preset (1...9)</li>
  3587. <li><b>channelStraight</b> - Tuner Preset wie am Display des Pioneer AV Receiver angezeigt, z.B. A2</li>
  3588. <li><b>display</b> - Text, der aktuell im Display des Pioneer AV Receivers angezeigt wird</li>
  3589. <li><b>displayPrevious</b> - Zuletzt im Display angezeigter Text</li>
  3590. <li><b>eq</b> - Status des Equalizers des Pioneer AV Receivers (on|off)</li>
  3591. <li><b>hdmiOut</b> - welche HDMI-Ausgänge sind aktiviert?</li>
  3592. <li><b>input</b> - welcher Eingang ist ausgewählt</li>
  3593. <li><b>inputsList</b> - Mit ":" getrennte Liste der aktivierten/verfügbaren Eingänge</li>
  3594. <li><b>listeningMode</b> - Welcher Hörmodus (Listening Mode) ist eingestellt</li>
  3595. <li><b>listeningModePlaying</b> - Welcher Hörmodus (Listening Mode) wird aktuell verwendet</li>
  3596. <li><b>mcaccMemory</b> - MCACC Voreinstellung</li>
  3597. <li><b>mute</b> - Stummschaltung</li>
  3598. <li><b>power</b> - Main Zone eingeschaltet oder in Standby?</li>
  3599. <li><b>pqlsWorking</b> - aktuelle PQLS Einstellung</li>
  3600. <li><b>presence</b> - Kann der Pioneer AV Receiver via Ethernet erreicht werden?</li>
  3601. <li><b>screenHirarchy</b> - Hierarchie des aktuell angezeigten On Screen Displays (OSD)</li>
  3602. <li><b>screenLine01...08</b> - Inhalt der Zeile 01...08 des OSD</li>
  3603. <li><b>screenLineHasFocus</b> - Welche Zeile des OSD hat den Fokus?</li>
  3604. <li><b>screenLineNumberFirst</b> - Lange Listen werden im OSD zu einzelnen Seiten mit je 8 Zeilen angezeigt. Die oberste Zeile im OSD repräsentiert welche Zeile in der gesamten Liste?</li>
  3605. <li><b>screenLineNumberLast</b> - Lange Listen werden im OSD zu einzelnen Seiten mit je 8 Zeilen angezeigt. Die unterste Zeile im OSD repräsentiert welche Zeile in der gesamten Liste?</li>
  3606. <li><b>screenLineNumbersTotal</b> - Wie viele Zeilen hat die im OSD anzuzeigende Liste insgesamt?</li>
  3607. <li><b>screenLineNumbers</b> - Wie viele Zeilen hat das OSD</li>
  3608. <li><b>screenLineType01...08</b> - Welchen Typs ist die Zeile 01...08? Z.B. "directory", "Now playing", "current Artist",...</li>
  3609. <li><b>screenName</b> - Name des OSD</li>
  3610. <li><b>screenReturnKey</b> - Steht die "Return-Taste" in diesem OSD zur Verfügung?</li>
  3611. <li><b>screenTopMenuKey</b> - Steht die "Menu-Taste" in diesem OSD zur Verfügung?</li>
  3612. <li><b>screenToolsKey</b> - Steht die "Tools-Taste" (Menu, Edit, iPod control) in diesem OSD zur Verfügung?</li>
  3613. <li><b>screenType</b> - Typ des OSD, z.B. "message", "List", "playing(play)",...</li>
  3614. <li><b>speakerSystem</b> - Zeigt, wie die hinteren Surround-Lautsprecheranschlüsse und die B-Lautsprecheranschlüsse verwendet werden</li>
  3615. <li><b>speakers</b> - Welche Lautsprecheranschlüsse sind aktiviert?</li>
  3616. <li><b>standingWave</b> - Einstellung der Steuerung stark resonanter tiefer Frequenzen im Hörraum</li>
  3617. <li>
  3618. <b>state</b> - Wird beim Verbindungsaufbau von Fhem mit dem Pioneer AV Receiver gesetzt. Mögliche Werte sind disconnected, innitialized, off, on, opened
  3619. </li>
  3620. <li>
  3621. <b>stateAV</b> - Status aus der Sicht des USers: Kombiniert die readings presence, power, mute und playStatus zu einem Status (on|off|absent|stopped|playing|paused|fast-forward|fast-rewind).
  3622. </li>
  3623. <li><b>tone</b> - Ist die Klangsteuerung eingeschalten?</li>
  3624. <li><b>treble</b> - Einstellung des Höhenreglers</li>
  3625. <li><b>tunerFrequency</b> - Tunerfrequenz</li>
  3626. <li><b>volume</b> - Eingestellte Lautstärke (0%-100%)</li>
  3627. <li><b>volumeStraight</b> - Eingestellte Lautstärke, so wie sie auch am Display des Pioneer AV Receivers angezeigt wird</li>
  3628. </ul>
  3629. <br/><br/>
  3630. </ul>
  3631. =end html_DE
  3632. =cut