70_VIERA.pm 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. # $Id: 70_VIERA.pm 10463 2016-01-11 18:03:07Z teevau $
  2. ##############################################################################
  3. #
  4. # 70_VIERA.pm
  5. #
  6. # a module to send messages or commands to a Panasonic TV
  7. # inspired by Samsung TV Module from Gabriel Bentele <gabriel at bentele.de>
  8. # written 2013 by Tobias Vaupel <fhem at 622 mbit dot de>
  9. #
  10. #
  11. # Version = 1.24
  12. #
  13. # Version History:
  14. # - 1.24 - 2015-07-08
  15. # -- Using non blocking as default for status update. Use attr to use blocking mode.
  16. # -- Replaced when/given with if/elsif
  17. # -- Added color buttons for remoteControl Layout
  18. # -- Added remoteControl Layout with SVG
  19. # -- InternalTimer is deleted at define. Avoid multiple internalTimer running in parallel when redefining device
  20. # -- Added TCP-Port to internal PORT instead of fixed coding
  21. # -- increased byte length at command read (IO::Socket::INET) from 1 to 1024
  22. # -- in very few cases the TV is answering with HTTP Code 400 BAD REQUEST. This is considered now and is interpreted as device on instead of off.
  23. #
  24. # - 1.23 - 2014-08-01
  25. # -- Add parameter "HDMI1" - "HDMI4" for command remoteControl to select HDMI input directly
  26. # -- Add command "input" to select a HDMI port, TV or SD-Card as source
  27. #
  28. # - 1.22 - 2013-12-28
  29. # -- fixed set command remoteControl
  30. #
  31. # - 1.21 - 2013-08-19
  32. # -- Log() deprecated/replaced by Log3()
  33. # -- GetStatus() is called after set volume/mute to update readings immediately
  34. #
  35. # - 1.20 - 2013-08-16
  36. # -- added support according to http://www.fhemwiki.de/wiki/DevelopmentGuidelinesAV
  37. #
  38. # - 1.11 - 2013-08-13
  39. # -- added "noArg" at get/set-command
  40. # -- changed format of return() in VIERA_Get() for get-command drop down menu in FHEMWEB
  41. #
  42. # - 1.10 - 2013-06-29
  43. # -- Added support for module 95_remotecontrol
  44. # -- New functions: sub VIERA_RClayout_TV(); sub VIERA_RCmakenotify($$);
  45. # -- Updated VIERA_Initialize for remotecontrol
  46. #
  47. # - 1.00 - 2013-03-16
  48. # -- First release
  49. #
  50. ##############################################################################
  51. package main;
  52. use strict;
  53. use warnings;
  54. use IO::Socket::INET;
  55. use feature qw/say switch/;
  56. use Time::HiRes qw(gettimeofday sleep);
  57. use Blocking;
  58. # Forward declaration for remotecontrol module
  59. sub VIERA_RClayout_TV();
  60. sub VIERA_RClayout_TV_SVG();
  61. sub VIERA_RCmakenotify($$);
  62. my %VIERA_remoteControl_args = (
  63. "NRC_CH_DOWN-ONOFF" => "Channel down",
  64. "NRC_CH_UP-ONOFF" => "Channel up",
  65. "NRC_VOLUP-ONOFF" => "Volume up",
  66. "NRC_VOLDOWN-ONOFF" => "Volume down",
  67. "NRC_MUTE-ONOFF" => "Mute",
  68. "NRC_TV-ONOFF" => "TV",
  69. "NRC_CHG_INPUT-ONOFF" => "AV",
  70. "NRC_RED-ONOFF" => "Red",
  71. "NRC_GREEN-ONOFF" => "Green",
  72. "NRC_YELLOW-ONOFF" => "Yellow",
  73. "NRC_BLUE-ONOFF" => "Blue",
  74. "NRC_VTOOLS-ONOFF" => "VIERA tools",
  75. "NRC_CANCEL-ONOFF" => "Cancel / Exit",
  76. "NRC_SUBMENU-ONOFF" => "Option",
  77. "NRC_RETURN-ONOFF" => "Return",
  78. "NRC_ENTER-ONOFF" => "Control Center click / enter",
  79. "NRC_RIGHT-ONOFF" => "Control RIGHT",
  80. "NRC_LEFT-ONOFF" => "Control LEFT",
  81. "NRC_UP-ONOFF" => "Control UP",
  82. "NRC_DOWN-ONOFF" => "Control DOWN",
  83. "NRC_3D-ONOFF" => "3D button",
  84. "NRC_SD_CARD-ONOFF" => "SD-card",
  85. "NRC_DISP_MODE-ONOFF" => "Display mode / Aspect ratio",
  86. "NRC_MENU-ONOFF" => "Menu",
  87. "NRC_INTERNET-ONOFF" => "VIERA connect",
  88. "NRC_VIERA_LINK-ONOFF"=> "VIERA link",
  89. "NRC_EPG-ONOFF" => "Guide / EPG",
  90. "NRC_TEXT-ONOFF" => "Text / TTV",
  91. "NRC_STTL-ONOFF" => "STTL / Subtitles",
  92. "NRC_INFO-ONOFF" => "Info",
  93. "NRC_INDEX-ONOFF" => "TTV index",
  94. "NRC_HOLD-ONOFF" => "TTV hold / image freeze",
  95. "NRC_R_TUNE-ONOFF" => "Last view",
  96. "NRC_POWER-ONOFF" => "Power off",
  97. "NRC_REW-ONOFF" => "Rewind",
  98. "NRC_PLAY-ONOFF" => "Play",
  99. "NRC_FF-ONOFF" => "Fast forward",
  100. "NRC_SKIP_PREV-ONOFF" => "Skip previous",
  101. "NRC_PAUSE-ONOFF" => "Pause",
  102. "NRC_SKIP_NEXT-ONOFF" => "Skip next",
  103. "NRC_STOP-ONOFF" => "Stop",
  104. "NRC_REC-ONOFF" => "Record",
  105. "NRC_D1-ONOFF" => "Digit 1",
  106. "NRC_D2-ONOFF" => "Digit 2",
  107. "NRC_D3-ONOFF" => "Digit 3",
  108. "NRC_D4-ONOFF" => "Digit 4",
  109. "NRC_D5-ONOFF" => "Digit 5",
  110. "NRC_D6-ONOFF" => "Digit 6",
  111. "NRC_D7-ONOFF" => "Digit 7",
  112. "NRC_D8-ONOFF" => "Digit 8",
  113. "NRC_D9-ONOFF" => "Digit 9",
  114. "NRC_D0-ONOFF" => "Digit 0",
  115. "NRC_P_NR-ONOFF" => "P-NR (Noise reduction)",
  116. "NRC_R_TUNE-ONOFF" => "Seems to do the same as INFO",
  117. "NRC_HDMI1" => "Switch to HDMI input 1",
  118. "NRC_HDMI2" => "Switch to HDMI input 2",
  119. "NRC_HDMI3" => "Switch to HDMI input 3",
  120. "NRC_HDMI4" => "Switch to HDMI input 4",
  121. );
  122. # Initialize the module and tell FHEM name of additional functions
  123. # Param1: Hash of FHEM-Device
  124. # Return: no return code
  125. sub VIERA_Initialize($){
  126. my ($hash) = @_;
  127. $hash->{DefFn} = "VIERA_Define";
  128. $hash->{SetFn} = "VIERA_Set";
  129. $hash->{GetFn} = "VIERA_Get";
  130. $hash->{UndefFn} = "VIERA_Undefine";
  131. $hash->{AttrList} = "blocking:1,0 $readingFnAttributes";
  132. $data{RC_layout}{VIERA_TV} = "VIERA_RClayout_TV";
  133. $data{RC_layout}{VIERA_TV_SVG} = "VIERA_RClayout_TV_SVG";
  134. $data{RC_makenotify}{VIERA} = "VIERA_RCmakenotify";
  135. }
  136. # Callback when 'define' is used at FHEM
  137. # Param1: Hash of FHEM-Device
  138. # Param2: String of 'define' command
  139. # Return: Help text for FHEMWEB
  140. sub VIERA_Define($$){
  141. my ($hash, $def) = @_;
  142. my @args = split("[ \t][ \t]*", $def);
  143. my $name = $hash->{NAME};
  144. if(int(@args) < 3 && int(@args) > 4) {
  145. my $msg = "wrong syntax: define <name> VIERA <host> [<interval>]";
  146. Log3 $name, 2, "VIERA: $msg";
  147. return $msg;
  148. }
  149. $hash->{helper}{HOST} = $args[2];
  150. $hash->{helper}{PORT} = 55000;
  151. if(defined($args[3]) and $args[3] > 10) {
  152. $hash->{helper}{INTERVAL}=$args[3];
  153. }
  154. else {
  155. $hash->{helper}{INTERVAL}=30;
  156. }
  157. CommandAttr(undef,$name.' webCmd off') if( !defined( AttrVal($hash->{NAME}, "webCmd", undef)) );
  158. BlockingKill($hash->{helper}{RUNNING_PID_GET}) if(defined($hash->{helper}{RUNNING_PID_GET}));
  159. delete($hash->{helper}{RUNNING_PID_GET});
  160. RemoveInternalTimer($hash);
  161. InternalTimer(gettimeofday()+$hash->{helper}{INTERVAL}, "VIERA_GetStatus", $hash, 0);
  162. Log3 $name, 2, "VIERA: defined with host: $hash->{helper}{HOST} and interval: $hash->{helper}{INTERVAL}";
  163. readingsSingleUpdate($hash,"state","Initialized",1);
  164. return undef;
  165. }
  166. # Callback when 'set' is used at FHEM
  167. # Param1: Hash of FHEM-Device
  168. # Param2: String of 'set' command
  169. # Return: Help text for FHEMWEB
  170. sub VIERA_Set($@){
  171. my ($hash, @a) = @_;
  172. my $name = $hash->{NAME};
  173. my $host = $hash->{helper}{HOST};
  174. my $count = @a;
  175. my $key = "";
  176. my $tab = "";
  177. my $usage = "choose one of off:noArg mute:on,off " .
  178. "remoteControl:" . join(",", sort keys %VIERA_remoteControl_args) . " " .
  179. "volume:slider,0,1,100 volumeUp:noArg volumeDown:noArg ".
  180. "channel channelUp:noArg channelDown:noArg input:hdmi1,hdmi2,hdmi3,hdmi4,sdCard,tv";
  181. $usage =~ s/(NRC_|-ONOFF)//g;
  182. my $what = lc($a[1]);
  183. return "VIERA: Device is not present or reachable, power on or check ethernet connection" if(ReadingsVal($name,"presence","absent")ne "present" && $what ne "?");
  184. return "VIERA: No argument given, $usage" if(!defined($a[1]));
  185. my $state = lc($a[2]) if(defined($a[2]));
  186. if ($what eq "mute"){
  187. Log3 $name, 3, "VIERA: Set mute $state";
  188. if ($state eq "on") {$state = 1;} else {$state = 0;}
  189. VIERA_connection($hash, VIERA_BuildXML_RendCtrl($hash, "Set", "Mute", $state));
  190. VIERA_GetStatus($hash, 1);
  191. }
  192. elsif ($what eq "volume"){
  193. return "VIERA: Volume range is too high! Use Value 0 till 100 for volume." if($state < 0 || $state > 100);
  194. Log3 $name, 3, "VIERA: Set volume $state";
  195. VIERA_connection($hash, VIERA_BuildXML_RendCtrl($hash, "Set", "Volume", $state));
  196. VIERA_GetStatus($hash, 1);
  197. }
  198. elsif ($what eq "volumeup"){
  199. return "VIERA: Volume range is too high!" if(ReadingsVal($name, "volume", "0") > 100);
  200. Log3 $name, 3, "VIERA: Set volumeUp";
  201. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"VOLUP"));
  202. VIERA_GetStatus($hash, 1);
  203. }
  204. elsif ($what eq "volumedown"){
  205. return "VIERA: Volume range is too low!" if(ReadingsVal($name, "volume", "0") < 1);
  206. Log3 $name, 3, "VIERA: Set volumeDown";
  207. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"VOLDOWN"));
  208. VIERA_GetStatus($hash, 1);
  209. }
  210. elsif ($what eq "channel"){
  211. return "VIERA: Channel is too high or low!" if($state < 1 || $state > 9999);
  212. Log3 $name, 3, "VIERA: Set channel $state";
  213. for(my $i = 0; $i <= length($state)-1; $i++) {
  214. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"D" . substr($state, $i, 1)));
  215. sleep 0.1;
  216. }
  217. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"ENTER"));
  218. }
  219. elsif ($what eq "channelup"){
  220. Log3 $name, 3, "VIERA: Set channelUp";
  221. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"CH_UP"));
  222. }
  223. elsif ($what eq "channeldown"){
  224. Log3 $name, 3, "VIERA: Set channelDown";
  225. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"CH_DOWN"));
  226. }
  227. elsif ($what eq "remotecontrol"){
  228. if($state eq "?"){
  229. $usage = "choose one of the states:\n";
  230. foreach $key (sort keys %VIERA_remoteControl_args){
  231. if(length($key) < 17){ $tab = "\t\t"; }else{ $tab = "\t"; }
  232. $usage .= "$key $tab=> $VIERA_remoteControl_args{$key}\n";
  233. }
  234. $usage =~ s/(NRC_|-ONOFF)//g;
  235. return $usage;
  236. }
  237. else{
  238. $state = uc($state);
  239. Log3 $name, 3, "VIERA: Set remoteControl $state";
  240. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,$state));
  241. }
  242. }
  243. elsif ($what eq "off"){
  244. Log3 $name, 3, "VIERA: Set off";
  245. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,"POWER"));
  246. }
  247. elsif ($what eq "statusrequest"){
  248. Log3 $name, 3, "VIERA: Set statusRequest";
  249. VIERA_GetStatus($hash, 1);
  250. }
  251. elsif ($what eq "input"){
  252. $state = uc($state);
  253. return "VIERA: Input $state isn't available." if($state ne "HDMI1" && $state ne "HDMI2" && $state ne "HDMI3" && $state ne "HDMI4" && $state ne "SDCARD" && $state ne "TV");
  254. $state = "SD_CARD" if ($state eq "SDCARD");
  255. Log3 $name, 3, "VIERA: Set input $state";
  256. VIERA_connection($hash, VIERA_BuildXML_NetCtrl($hash,$state));
  257. }
  258. elsif ($what eq "?"){
  259. return "$usage";
  260. }
  261. else {
  262. Log3 $name, 3, "VIERA: Unknown argument $what, $usage";
  263. return "Unknown argument $what, $usage";
  264. }
  265. return undef;
  266. }
  267. # Callback when 'get' is used at FHEM
  268. # Param1: Hash of FHEM-Device
  269. # Param2: String of 'set' command
  270. # Return: Help text for FHEMWEB
  271. sub VIERA_Get($@){
  272. my ($hash, @a) = @_;
  273. my $what;
  274. my $usage = "choose one of mute:noArg volume:noArg power:noArg presence:noArg";
  275. my $name = $hash->{NAME};
  276. return "VIERA: No argument given, $usage" if(int(@a) != 2);
  277. $what = lc($a[1]);
  278. if($what =~ /^(volume|mute|power|presence)$/) {
  279. if (defined($hash->{READINGS}{$what})) {
  280. ReadingsVal($name, $what, "undefined");
  281. }
  282. else{
  283. return "no such reading: $what";
  284. }
  285. }
  286. else{
  287. return "Unknown argument $what, $usage";
  288. }
  289. }
  290. # Callback when 'delete' is used at FHEM or FHEM is restarting/shutdown
  291. # Param1: Hash of FHEM-Device
  292. # Param2: Name of FHEM-Device
  293. # Return: undef
  294. sub VIERA_Undefine($$){
  295. my($hash, $name) = @_;
  296. # Stop the internal GetStatus-Loop and exist
  297. RemoveInternalTimer($hash);
  298. BlockingKill($hash->{helper}{RUNNING_PID_GET}) if(defined($hash->{helper}{RUNNING_PID_GET}));
  299. return undef;
  300. }
  301. # Function is called periodically by InternalTimer and fetch informations from device. The decision if blocking or nonBlocking is used is made here.
  302. # Param1: Hash of FHEM-Device
  303. # Param2: Optional, if set to 1 fetch information from device without interrupting InternalTimer
  304. sub VIERA_GetStatus($;$){
  305. my ($hash, $local) = @_;
  306. my $name = $hash->{NAME};
  307. my $host = $hash->{helper}{HOST};
  308. my $blocking = AttrVal($name, "blocking", 0); #use non-blocking in standard. Just use blocking when set by attr
  309. #if $local is set to 1 just fetch informations from device without interrupting InternalTimer
  310. $local = 0 unless(defined($local));
  311. InternalTimer(gettimeofday()+$hash->{helper}{INTERVAL}, "VIERA_GetStatus", $hash, 0) unless($local == 1);
  312. return "" if(!defined($hash->{helper}{HOST}) or !defined($hash->{helper}{INTERVAL}));
  313. if ($blocking == 0) {
  314. Log3 $name, 4, "VIERA[VIERA_GetStatus]: Using non blocking...";
  315. $hash->{helper}{RUNNING_PID_GET} = BlockingCall("VIERA_GetDoIt", $hash, "VIERA_GetDone", 10, "VIERA_GetAbortFn", $hash) unless(exists($hash->{helper}{RUNNING_PID_GET}));
  316. if($hash->{helper}{RUNNING_PID_GET}) {
  317. Log3 $name, 4, "VIERA[VIERA_GetStatus]: VIERA_GetDoIt() BlockingCall process started with PID $hash->{helper}{RUNNING_PID_GET}{pid}";
  318. }
  319. else {
  320. Log3 $name, 3, "VIERA[VIERA_GetStatus]: BlockingCall process start failed for VIERA_GetDoIt()";
  321. }
  322. return;
  323. }
  324. Log3 $name, 4, "VIERA[VIERA_GetStatus]: Using blocking...";
  325. my $returnVol = VIERA_connection($hash, VIERA_BuildXML_RendCtrl($hash, "Get", "Volume", ""));
  326. Log3 $name, 5, "VIERA[VIERA_GetStatus]: Vol-Request returned: $returnVol" if(defined($returnVol));
  327. if(not defined($returnVol) or $returnVol eq "") {
  328. Log3 $name, 4, "VIERA[VIERA_GetStatus]: Vol-Request NO SOCKET!";
  329. if( ReadingsVal($name,"state","absent") ne "absent") {
  330. readingsBeginUpdate($hash);
  331. readingsBulkUpdate($hash, "state", "absent");
  332. readingsBulkUpdate($hash, "power", "off");
  333. readingsBulkUpdate($hash, "presence", "absent");
  334. readingsEndUpdate($hash, 1);
  335. }
  336. return;
  337. }
  338. my $returnMute = VIERA_connection($hash, VIERA_BuildXML_RendCtrl($hash, "Get", "Mute", ""));
  339. Log3 $name, 5, "VIERA[VIERA_GetStatus]: Mute-Request returned: $returnMute" if(defined($returnMute));
  340. if(not defined($returnMute) or $returnMute eq "") {
  341. Log3 $name, 4, "VIERA[VIERA_GetStatus]: Mute-Request NO SOCKET!";
  342. if( ReadingsVal($name,"state","absent") ne "absent") {
  343. readingsBeginUpdate($hash);
  344. readingsBulkUpdate($hash, "state", "absent");
  345. readingsBulkUpdate($hash, "power", "off");
  346. readingsBulkUpdate($hash, "presence", "absent");
  347. readingsEndUpdate($hash, 1);
  348. }
  349. return;
  350. }
  351. readingsBeginUpdate($hash);
  352. if($returnVol =~ /<CurrentVolume>(.+)<\/CurrentVolume>/){
  353. Log3 $name, 4, "VIERA[VIERA_GetStatus]: Set reading volume to $1";
  354. if( $1 != ReadingsVal($name, "volume", "0") ) {readingsBulkUpdate($hash, "volume", $1);}
  355. }
  356. if($returnMute =~ /<CurrentMute>(.+)<\/CurrentMute>/){
  357. my $myMute = $1;
  358. if ($myMute == 0) { $myMute = "off"; } else { $myMute = "on";}
  359. Log3 $name, 4, "VIERA[VIERA_GetStatus]: Set reading mute to $myMute";
  360. if( $myMute ne ReadingsVal($name, "mute", "0") ) {readingsBulkUpdate($hash, "mute", $myMute);}
  361. }
  362. if( ReadingsVal($name,"state","absent") ne "on") {
  363. readingsBulkUpdate($hash, "state", "on");
  364. readingsBulkUpdate($hash, "power", "on");
  365. readingsBulkUpdate($hash, "presence", "present");
  366. }
  367. readingsEndUpdate($hash, 1);
  368. return $hash->{STATE};
  369. }
  370. # To sent RAW-Data as TCP Client to device
  371. # param1: Hash of FHEM-Device
  372. # param2: RAW Data
  373. #return: RAW answer when successful or undef if no socket is available.
  374. sub VIERA_connection($$){
  375. my ($hash, $data) = @_;
  376. my $name = $hash->{NAME};
  377. my $buffer = "";
  378. my $buff = "";
  379. my $blocking = "NonBlocking-VIERA_connection()" if (AttrVal($name, "blocking", 0) == 0);
  380. $blocking = "Blocking-VIERA_connection()" if (AttrVal($name, "blocking", 0) == 1);
  381. my $sock = new IO::Socket::INET (
  382. PeerAddr => $hash->{helper}{HOST},
  383. PeerPort => $hash->{helper}{PORT},
  384. Proto => 'tcp',
  385. Timeout => 2
  386. );
  387. if(defined ($sock)) {
  388. Log3 $hash, 5, "VIERA[$blocking]: Send Data to $hash->{helper}{HOST}:$hash->{helper}{PORT}:\n$data";
  389. print $sock $data;
  390. while ((read $sock, $buff, 1024) > 0){
  391. $buffer .= $buff;
  392. }
  393. Log3 $hash, 5, "VIERA[$blocking]: $hash->{helper}{HOST} buffer response:\n$buffer";
  394. $sock->close();
  395. return $buffer;
  396. }
  397. else {
  398. Log3 $hash, 4, "VIERA[$blocking]: $hash->{helper}{HOST}: not able to open socket";
  399. return undef;
  400. }
  401. }
  402. # Callback from 95_remotecontrol for command makenotify.
  403. # Param1: Name of remoteControl device
  404. # Param2: Name of target FHEM device
  405. sub VIERA_RCmakenotify($$) {
  406. my ($nam, $ndev) = @_;
  407. my $nname="notify_$nam";
  408. fhem("define $nname notify $nam set $ndev remoteControl ".'$EVENT',1);
  409. Log3 undef, 2, "[remoteControl:VIERA] Notify created: $nname";
  410. return "Notify created by VIERA: $nname";
  411. }
  412. # Callback from 95_remotecontrol for command layout. Creates non svg layout
  413. sub VIERA_RClayout_TV() {
  414. my @row;
  415. my $i = 0;
  416. $row[$i++]="power:POWEROFF2, TV, CHG_INPUT:HDMI";
  417. $row[$i++]="MENU, disp_mode:ASPECT, epg:GUIDE";
  418. $row[$i++]="VIERA_LINK, VTOOLS, INTERNET";
  419. $row[$i++]=":blank, :blank, :blank";
  420. $row[$i++]="INFO:INFO2, UP, cancel:EXIT";
  421. $row[$i++]="LEFT, ENTER, RIGHT";
  422. $row[$i++]="SUBMENU, DOWN, RETURN";
  423. $row[$i++]="red:RED, :blank, green:GREEN";
  424. $row[$i++]="yellow:YELLOW, :blank, blue:BLUE";
  425. $row[$i++]="d1:1, d2:2, d3:3";
  426. $row[$i++]="d4:4, d5:5, d6:6";
  427. $row[$i++]="d7:7, d8:8, d9:9";
  428. $row[$i++]="MUTE, d0:0, r_tune:PRECH";
  429. $row[$i++]=":blank, :blank, :blank";
  430. $row[$i++]="VOLUP, :blank, ch_up:CHUP";
  431. $row[$i++]=":VOL, :blank, :PROG";
  432. $row[$i++]="VOLDOWN, :blank, ch_down:CHDOWN";
  433. $row[$i++]=":blank, :blank, :blank";
  434. $row[$i++]="rew:REWIND, PLAY, FF";
  435. $row[$i++]="STOP, PAUSE, REC";
  436. #Replace two or more spaces with one space
  437. for (@row) {s/\s+/ /g}
  438. $row[$i++]="attr rc_iconpath icons/remotecontrol";
  439. $row[$i++]="attr rc_iconprefix black_btn_";
  440. return @row;
  441. }
  442. # Callback from 95_remotecontrol for command layout. Creates svg layout
  443. sub VIERA_RClayout_TV_SVG() {
  444. my @row;
  445. my $i = 0;
  446. $row[$i++]="power:rc_POWER.svg, TV:rc_TV2.svg, CHG_INPUT:rc_AV.svg";
  447. $row[$i++]="MENU:rc_MENU.svg, disp_mode:rc_ASPECT.svg, epg:rc_EPG.svg";
  448. $row[$i++]="VIERA_LINK:rc_VIERA_LINK.svg, VTOOLS:rc_VIERA_TOOLS.svg, INTERNET:rc_WEB.svg";
  449. $row[$i++]=":rc_BLANK.svg, :rc_BLANK.svg, :rc_BLANK.svg";
  450. $row[$i++]="INFO:rc_INFO2.svg, UP:rc_UP.svg, cancel:rc_EXIT.svg";
  451. $row[$i++]="LEFT:rc_LEFT.svg, ENTER:rc_dot.svg, RIGHT:rc_RIGHT.svg";
  452. $row[$i++]="SUBMENU:rc_OPTIONS.svg, DOWN:rc_DOWN.svg, RETURN:rc_BACK.svg";
  453. $row[$i++]="red:rc_RED.svg, :rc_BLANK.svg, green:rc_GREEN.svg";
  454. $row[$i++]="yellow:rc_YELLOW.svg, :rc_BLANK.svg, blue:rc_BLUE.svg";
  455. $row[$i++]="d1:rc_1.svg, d2:rc_2.svg, d3:rc_3.svg";
  456. $row[$i++]="d4:rc_4.svg, d5:rc_5.svg, d6:rc_6.svg";
  457. $row[$i++]="d7:rc_7.svg, d8:rc_8.svg, d9:rc_9.svg";
  458. $row[$i++]="MUTE:rc_MUTE.svg, d0:rc_0.svg, r_tune:rc_BACK.svg";
  459. $row[$i++]=":rc_BLANK.svg, :rc_BLANK.svg, :rc_BLANK.svg";
  460. $row[$i++]="VOLUP:rc_UP.svg, :rc_BLANK.svg, ch_up:rc_UP.svg";
  461. $row[$i++]=":rc_VOL.svg, :rc_BLANK.svg, :rc_PROG.svg";
  462. $row[$i++]="VOLDOWN:rc_DOWN.svg, :rc_BLANK.svg, ch_down:rc_DOWN.svg";
  463. $row[$i++]=":rc_BLANK.svg, :rc_BLANK.svg, :rc_BLANK.svg";
  464. $row[$i++]="rew:rc_REW.svg, PLAY:rc_PLAY.svg, FF:rc_FF.svg";
  465. $row[$i++]="STOP:rc_STOP.svg, PAUSE:rc_PAUSE.svg, REC:rc_REC.svg";
  466. #Replace two or more spaces with one space
  467. for (@row) {s/\s+/ /g}
  468. return @row;
  469. }
  470. # Create RAW Data to sent pressed keys of remoteControl to device.
  471. # Param1: Hash of FHEM-Device
  472. # Param2: Name of key to send
  473. # Return: RAW html request for xml soap
  474. sub VIERA_BuildXML_NetCtrl($$){
  475. my ($hash, $command) = @_;
  476. my $host = $hash->{helper}{HOST};
  477. my $port = $hash->{helper}{PORT};
  478. my $callsoap = "";
  479. my $message = "";
  480. my $head = "";
  481. my $size = "";
  482. $callsoap .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
  483. $callsoap .= "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
  484. $callsoap .= "<s:Body>";
  485. $callsoap .= "<u:X_SendKey xmlns:u=\"urn:panasonic-com:service:p00NetworkControl:1\">";
  486. $callsoap .= "<X_KeyEvent>NRC_$command-ONOFF</X_KeyEvent>";
  487. $callsoap .= "</u:X_SendKey>";
  488. $callsoap .= "</s:Body>";
  489. $callsoap .= "</s:Envelope>";
  490. $size = length($callsoap);
  491. $head .= "POST /nrc/control_0 HTTP/1.1\r\n";
  492. $head .= "Host: $host:$port\r\n";
  493. $head .= "SOAPACTION: \"urn:panasonic-com:service:p00NetworkControl:1#X_SendKey\"\r\n";
  494. $head .= "Content-Type: text/xml; charset=\"utf-8\"\r\n";
  495. $head .= "Content-Length: $size\r\n";
  496. $head .= "\r\n";
  497. $message .= $head;
  498. $message .= $callsoap;
  499. #Log3 $hash, 5, "VIERA: Building XML SOAP (NetworkControl) for command $command to host $host:\n$message";
  500. return $message;
  501. }
  502. # Create RAW Data to send or get volume/mute state
  503. # Param1: Hash of FHEM-Device
  504. # Param2: get|set
  505. # Param3: volume|mute
  506. # Param4: value for set command
  507. # Return: RAW html request for xml soap
  508. sub VIERA_BuildXML_RendCtrl($$$$){
  509. my ($hash, $methode, $command, $value) = @_;
  510. my $host = $hash->{helper}{HOST};
  511. my $port = $hash->{helper}{PORT};
  512. my $callsoap = "";
  513. my $message = "";
  514. my $head = "";
  515. my $size = "";
  516. #Log3 $hash, 5, "VIERA: $command with $value to $host";
  517. $callsoap .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n";
  518. $callsoap .= "<s:Envelope s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n";
  519. $callsoap .= "<s:Body>\r\n";
  520. $callsoap .= "<u:$methode$command xmlns:u=\"urn:schemas-upnp-org:service:RenderingControl:1\">\r\n";
  521. $callsoap .= "<InstanceID>0</InstanceID>\r\n";
  522. $callsoap .= "<Channel>Master</Channel>\r\n";
  523. $callsoap .= "<Desired$command>$value</Desired$command>\r\n" if(defined($value));
  524. $callsoap .= "</u:$methode$command>\r\n";
  525. $callsoap .= "</s:Body>\r\n";
  526. $callsoap .= "</s:Envelope>\r\n";
  527. $size = length($callsoap);
  528. $head .= "POST /dmr/control_0 HTTP/1.0\r\n";
  529. $head .= "Host: $host:$port\r\n";
  530. $head .= "SOAPACTION: \"urn:schemas-upnp-org:service:RenderingControl:1#$methode$command\"\r\n";
  531. $head .= "Content-Type: text/xml; charset=\"utf-8\"\r\n";
  532. $head .= "Content-Length: $size\r\n";
  533. $head .= "\r\n";
  534. $message .= $head;
  535. $message .= $callsoap;
  536. #Log3 $hash, 5, "VIERA: Building XML SOAP (RenderingControl) for command $command with value $value to host $host:\n$message";
  537. return $message;
  538. }
  539. # Get volume and mute state from device. This function is called non blocking!
  540. # Param1: Hash of FHEM-Device
  541. # Return: <name of fhem-device>|<volume level>|<mute state>
  542. sub VIERA_GetDoIt($) {
  543. my ($hash) = @_;
  544. my $myVol = "";
  545. my $myMute = "";
  546. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: BlockingCall for ".$hash->{NAME}." start...";
  547. my $returnVol = VIERA_connection($hash, VIERA_BuildXML_RendCtrl($hash, "Get", "Volume", ""));
  548. Log3 $hash, 5, "VIERA[NonBlocking-VIERA_GetDoIt()]: GetStatusVol-Request returned: $returnVol" if(defined($returnVol));
  549. if(not defined($returnVol) or $returnVol eq "") {
  550. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: GetStatusVol-Request NO SOCKET!";
  551. return $hash->{NAME}. "|".
  552. "error-noSocket" . "|".
  553. "error-noSocket";
  554. }
  555. my $returnMute = VIERA_connection($hash, VIERA_BuildXML_RendCtrl($hash, "Get", "Mute", ""));
  556. Log3 $hash, 5, "VIERA[NonBlocking-VIERA_GetDoIt()]: GetStatusMute-Request returned: $returnMute" if(defined($returnMute));
  557. if(not defined($returnMute) or $returnMute eq "") {
  558. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: GetStatusMute-Request NO SOCKET!";
  559. return $hash->{NAME}. "|".
  560. "error-noSocket" . "|".
  561. "error-noSocket";
  562. }
  563. if ($returnVol =~ /HTTP\/1\.1 ([\d]{3}) (.*)/) {
  564. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: Received HTTP Code $1 $2";
  565. $myVol = "error-$1 $2" if ($1 ne "200");
  566. }
  567. if($returnVol =~ /<CurrentVolume>(.+)<\/CurrentVolume>/){
  568. $myVol = $1;
  569. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: Received volume with level $myVol";
  570. }
  571. if ($returnMute =~ /HTTP\/1\.1 ([\d]{3}) (.*)/) {
  572. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: Received HTTP Code $1 $2";
  573. $myMute = "error-$1 $2" if ($1 ne "200");
  574. }
  575. if($returnMute =~ /<CurrentMute>(.+)<\/CurrentMute>/){
  576. $myMute = $1;
  577. if ($myMute == 0) { $myMute = "off"; } else { $myMute = "on";}
  578. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDoIt()]: Received mute state $myMute";
  579. }
  580. return $hash->{NAME}. "|".
  581. "$myVol" . "|".
  582. "$myMute";
  583. }
  584. # Callback of non blocking function VIERA_GetDoIt. Parse the results and set readings at fhem-device
  585. # Param1: <name of fhem-device>|<volume level>|<mute state>
  586. # volume level = 0 - 100
  587. # mute state = 1 or 0
  588. # If no socket is available Par1 and Par2 contains "error"
  589. # Return: no return code
  590. ####################################################
  591. sub VIERA_GetDone($) {
  592. my ($string) = @_;
  593. return unless(defined($string));
  594. my @a = split("\\|",$string);
  595. my $name = shift(@a);
  596. my $myVol = shift(@a);
  597. my $myMute = shift(@a);
  598. my $hash = $defs{$name};
  599. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDone()]: Param: $string";
  600. if ($myVol =~ /error-(.*)/ || $myMute =~ /error-(.*)/) {
  601. if ($1 eq "noSocket") {
  602. Log3 $name, 4, "VIERA[NonBlocking-VIERA_GetDone()]: Seems to be there is no socket available. Guessing TV is off!";
  603. if (ReadingsVal($name,"state","absent") ne "absent") {
  604. readingsBeginUpdate($hash);
  605. readingsBulkUpdate($hash, "state", "absent");
  606. readingsBulkUpdate($hash, "power", "off");
  607. readingsBulkUpdate($hash, "presence", "absent");
  608. readingsEndUpdate($hash, 1);
  609. }
  610. delete($hash->{helper}{RUNNING_PID_GET});
  611. return;
  612. }
  613. else {
  614. Log3 $name, 3, "VIERA[NonBlocking-VIERA_GetDone()]: TV answered with $1. Seems to be on but delivering no data";
  615. return;
  616. }
  617. }
  618. readingsBeginUpdate($hash);
  619. if ($myVol != ReadingsVal($name, "volume", "0")) {
  620. Log3 $hash, 4, "VIERA[NonBlocking-VIERA_GetDone()]: Set reading volume to $myVol";
  621. readingsBulkUpdate($hash, "volume", $myVol);
  622. }
  623. if ($myMute ne ReadingsVal($name, "mute", "0")) {
  624. Log3 $name, 4, "VIERA[NonBlocking-VIERA_GetDone()]: Set reading mute to $myMute";
  625. readingsBulkUpdate($hash, "mute", $myMute);
  626. }
  627. if (ReadingsVal($name,"state","absent") ne "on") {
  628. readingsBulkUpdate($hash, "state", "on");
  629. readingsBulkUpdate($hash, "power", "on");
  630. readingsBulkUpdate($hash, "presence", "present");
  631. }
  632. readingsEndUpdate($hash, 1);
  633. delete($hash->{helper}{RUNNING_PID_GET});
  634. }
  635. # Callback of non blocking when function VIERA_GetDoIt runs into timeout.
  636. # Param1: Hash of FHEM-Device
  637. # Return: no return code
  638. sub VIERA_GetAbortFn($) {
  639. my ($hash) = @_;
  640. delete($hash->{helper}{RUNNING_PID_GET});
  641. Log3 $hash, 2, "VIERA[NonBlocking-VIERA_GetAbortFn()]: BlockingCall for $hash->{NAME} was aborted, timeout reached";
  642. }
  643. 1;
  644. =pod
  645. =begin html
  646. <a name="VIERA"></a>
  647. <h3>VIERA</h3>
  648. <ul>
  649. <a name="VIERAdefine"></a>
  650. <b>Define</b>
  651. <ul>
  652. <code>define &lt;name&gt; VIERA &lt;host&gt; [&lt;interval&gt;]</code>
  653. <br><br>
  654. This module controls Panasonic TV device over ethernet. It's possible to
  655. power down the tv, change volume or mute/unmute the TV. Also this modul is simulating
  656. the remote control and you are able to send different command buttons actions of remote control.
  657. The module is tested with Panasonic plasma TV tx-p50vt30e
  658. <br><br>
  659. Defining a VIERA device will schedule an internal task (interval can be set
  660. with optional parameter &lt;interval&gt; in seconds, if not set, the value is 30
  661. seconds), which periodically reads the status of volume and mute status and triggers
  662. notify/filelog commands.
  663. <br><br>
  664. <b>Notes:</b><br>
  665. <ul>Activate volume remotecontrol by DLNA: Menu -> Setup -> Network Setup -> Network Link Settings -> DLNA RemoteVolume -> On</ul>
  666. <br>
  667. Example:
  668. <ul><code>
  669. define myTV1 VIERA 192.168.178.20<br><br>
  670. define myTV1 VIERA 192.168.178.20 60 #with custom interval of 60 seconds
  671. </code></ul>
  672. </ul>
  673. <br>
  674. <a name="VIERAset"></a>
  675. <b>Set</b>
  676. <ul>
  677. <code>set &lt;name&gt; &lt;command&gt; [&lt;value&gt;]</code>
  678. <br><br>
  679. Currently, the following commands are defined.
  680. <ul>
  681. <code>
  682. off<br>
  683. mute [on|off]<br>
  684. volume [0-100]<br>
  685. volumeUp<br>
  686. volumeDown<br>
  687. channel [1-9999]<br>
  688. channelUp<br>
  689. channelDown<br>
  690. statusRequest<br>
  691. remoteControl &lt;command&gt;<br>
  692. input [hdmi1|hdmi2|hdmi3|hdmi4|sdCard|tv]<br>
  693. </code>
  694. </ul>
  695. </ul>
  696. <ul>
  697. <br>
  698. <u>Remote control (depending on your model, maybe)</u><br>
  699. For this application the following commands are available:<br>
  700. <ul><code>
  701. 3D => 3D button<br>
  702. BLUE => Blue<br>
  703. CANCEL => Cancel / Exit<br>
  704. CHG_INPUT => AV<br>
  705. CH_DOWN => Channel down<br>
  706. CH_UP => Channel up<br>
  707. D0 => Digit 0<br>
  708. D1 => Digit 1<br>
  709. D2 => Digit 2<br>
  710. D3 => Digit 3<br>
  711. D4 => Digit 4<br>
  712. D5 => Digit 5<br>
  713. D6 => Digit 6<br>
  714. D7 => Digit 7<br>
  715. D8 => Digit 8<br>
  716. D9 => Digit 9<br>
  717. DISP_MODE => Display mode / Aspect ratio<br>
  718. DOWN => Control DOWN<br>
  719. ENTER => Control Center click / enter<br>
  720. EPG => Guide / EPG<br>
  721. FF => Fast forward<br>
  722. GREEN => Green<br>
  723. HOLD => TTV hold / image freeze<br>
  724. INDEX => TTV index<br>
  725. INFO => Info<br>
  726. INTERNET => VIERA connect<br>
  727. LEFT => Control LEFT<br>
  728. MENU => Menu<br>
  729. MUTE => Mute<br>
  730. PAUSE => Pause<br>
  731. PLAY => Play<br>
  732. POWER => Power off<br>
  733. P_NR => P-NR (Noise reduction)<br>
  734. REC => Record<br>
  735. RED => Red<br>
  736. RETURN => Return<br>
  737. REW => Rewind<br>
  738. RIGHT => Control RIGHT<br>
  739. R_TUNE => Seems to do the same as INFO<br>
  740. SD_CARD => SD-card<br>
  741. SKIP_NEXT => Skip next<br>
  742. SKIP_PREV => Skip previous<br>
  743. STOP => Stop<br>
  744. STTL => STTL / Subtitles<br>
  745. SUBMENU => Option<br>
  746. TEXT => Text / TTV<br>
  747. TV => TV<br>
  748. UP => Control UP<br>
  749. VIERA_LINK => VIERA link<br>
  750. VOLDOWN => Volume down<br>
  751. VOLUP => Volume up<br>
  752. VTOOLS => VIERA tools<br>
  753. YELLOW => Yellow<br>
  754. </code></ul>
  755. <br>
  756. Example:<br>
  757. <ul><code>
  758. set &lt;name&gt; mute on<br>
  759. set &lt;name&gt; volume 20<br>
  760. set &lt;name&gt; remoteControl CH_DOWN<br>
  761. </code></ul>
  762. </ul>
  763. <br>
  764. <a name="VIERAget"></a>
  765. <b>Get</b>
  766. <ul>
  767. <code>get &lt;name&gt; &lt;what&gt;</code>
  768. <br><br>
  769. Currently, the following commands are defined and return the current state of the TV.
  770. <ul><code>
  771. mute<br>
  772. volume<br>
  773. power<br>
  774. presence<br>
  775. </code></ul>
  776. </ul>
  777. <br>
  778. <a name="VIERAattr"></a>
  779. <b>Attributes</b>
  780. <ul>blocking [0|1]</ul>
  781. <br>
  782. <a name="VIERAevents"></a>
  783. <b>Generated events:</b>
  784. <ul>
  785. <li>volume</li>
  786. <li>mute</li>
  787. <li>presence</li>
  788. <li>power</li>
  789. <li>state</li>
  790. </ul>
  791. </ul>
  792. =end html
  793. =begin html_DE
  794. <a name="VIERA"></a>
  795. <h3>VIERA</h3>
  796. <ul>
  797. <a name="VIERAdefine"></a>
  798. <b>Define</b>
  799. <ul>
  800. <code>define &lt;name&gt; VIERA &lt;host&gt; [&lt;interval&gt;]</code>
  801. <br><br>
  802. Dieses Modul steuert einen Panasonic Fernseher &uuml;ber das Netzwerk. Es ist m&ouml;glich den Fernseher
  803. auszuschalten, die Lautst&auml;rke zu &auml;ndern oder zu muten bzw. unmuten. Dieses Modul kann zus&auml;tzlich
  804. die Fernbedienung simulieren. Somit k&ouml;nnen also die Schaltaktionen einer Fernbedienung simuliert werden.
  805. Getestet wurde das Modul mit einem Panasonic Plasma TV tx-p50vt30e
  806. <br><br>
  807. Beim definieren des Ger&auml;tes in FHEM wird ein interner Timer gestartet, welcher zyklisch alle 30 Sekunden
  808. den Status der Lautst&auml;rke und des Mute-Zustand ausliest. Das Intervall des Timer kann &uuml;ber den Parameter &lt;interval&gt;
  809. ge&auml;ndert werden. Wird kein Interval angegeben, liest das Modul alle 30 Sekunden die Werte aus und triggert ein notify.
  810. <br><br>
  811. <b>Anmerkung:</b><br>
  812. <ul>Aktivieren von Fernbedienung der Lautst&auml;rke per DLNA: Men&uuml; -> Setup -> Netzwerk-Setup -> Netzwerkverbindungsein. -> DLNA-Fernbed. Lautst. -> Ein</ul>
  813. <br>
  814. Beispiel:
  815. <ul><code>
  816. define myTV1 VIERA 192.168.178.20<br><br>
  817. define myTV1 VIERA 192.168.178.20 60 #Mit einem Interval von 60 Sekunden
  818. </code></ul>
  819. </ul>
  820. <br>
  821. <a name="VIERAset"></a>
  822. <b>Set</b>
  823. <ul>
  824. <code>set &lt;name&gt; &lt;command&gt; [&lt;value&gt;]</code>
  825. <br><br>
  826. Zur Zeit sind die folgenden Befehle implementiert:
  827. <ul><code>
  828. off<br>
  829. mute [on|off]<br>
  830. volume [0-100]<br>
  831. volumeUp<br>
  832. volumeDown<br>
  833. channel [1-9999]<br>
  834. channelUp<br>
  835. channelDown<br>
  836. statusRequest<br>
  837. remoteControl &lt;command&gt;<br>
  838. input [hdmi1|hdmi2|hdmi3|hdmi4|sdCard|tv]<br>
  839. </code></ul>
  840. </ul>
  841. <ul>
  842. <br>
  843. <u>Fernbedienung (Kann vielleicht nach Modell variieren)</u><br>
  844. Das Modul hat die folgenden Fernbedienbefehle implementiert:<br>
  845. <ul><code>
  846. 3D => 3D Knopf<br>
  847. BLUE => Blau<br>
  848. CANCEL => Cancel / Exit<br>
  849. CHG_INPUT => AV<br>
  850. CH_DOWN => Kanal runter<br>
  851. CH_UP => Kanal hoch<br>
  852. D0 => Ziffer 0<br>
  853. D1 => Ziffer 1<br>
  854. D2 => Ziffer 2<br>
  855. D3 => Ziffer 3<br>
  856. D4 => Ziffer 4<br>
  857. D5 => Ziffer 5<br>
  858. D6 => Ziffer 6<br>
  859. D7 => Ziffer 7<br>
  860. D8 => Ziffer 8<br>
  861. D9 => Ziffer 9<br>
  862. DISP_MODE => Anzeigemodus / Seitenverh&auml;ltnis<br>
  863. DOWN => Navigieren runter<br>
  864. ENTER => Navigieren enter<br>
  865. EPG => Guide / EPG<br>
  866. FF => Vorspulen<br>
  867. GREEN => Gr&uuml;n<br>
  868. HOLD => Bild einfrieren<br>
  869. INDEX => TTV index<br>
  870. INFO => Info<br>
  871. INTERNET => VIERA connect<br>
  872. LEFT => Navigieren links<br>
  873. MENU => Men&uuml;<br>
  874. MUTE => Mute<br>
  875. PAUSE => Pause<br>
  876. PLAY => Play<br>
  877. POWER => Power off<br>
  878. P_NR => P-NR (Ger&auml;uschreduzierung)<br>
  879. REC => Aufnehmen<br>
  880. RED => Rot<br>
  881. RETURN => Enter<br>
  882. REW => Zur&uuml;ckspulen<br>
  883. RIGHT => Navigieren Rechts<br>
  884. R_TUNE => Vermutlich die selbe Funktion wie INFO<br>
  885. SD_CARD => SD-card<br>
  886. SKIP_NEXT => Skip next<br>
  887. SKIP_PREV => Skip previous<br>
  888. STOP => Stop<br>
  889. STTL => Untertitel<br>
  890. SUBMENU => Option<br>
  891. TEXT => TeleText<br>
  892. TV => TV<br>
  893. UP => Navigieren Hoch<br>
  894. VIERA_LINK => VIERA link<br>
  895. VOLDOWN => Lauter<br>
  896. VOLUP => Leiser<br>
  897. VTOOLS => VIERA tools<br>
  898. YELLOW => Gelb<br>
  899. </code></ul>
  900. <br>
  901. Beispiel:<br>
  902. <ul><code>
  903. set &lt;name&gt; mute on<br>
  904. set &lt;name&gt; volume 20<br>
  905. set &lt;name&gt; remoteControl CH_DOWN<br>
  906. </code></ul>
  907. </ul>
  908. <br>
  909. <a name="VIERAget"></a>
  910. <b>Get</b>
  911. <ul>
  912. <code>get &lt;name&gt; &lt;what&gt;</code>
  913. <br><br>
  914. Die folgenden Befehle sind definiert und geben den entsprechenden Wert zur&uuml;ck, der vom Fernseher zur&uuml;ckgegeben wurde.
  915. <ul><code>
  916. mute<br>
  917. volume<br>
  918. power<br>
  919. presence<br>
  920. </code></ul>
  921. </ul>
  922. <br>
  923. <a name="VIERAattr"></a>
  924. <b>Attribute</b>
  925. <ul>blocking [0|1]</ul>
  926. <br>
  927. <a name="VIERAevents"></a>
  928. <b>Generierte events:</b>
  929. <ul>
  930. <li>volume</li>
  931. <li>mute</li>
  932. <li>presence</li>
  933. <li>power</li>
  934. <li>state</li>
  935. </ul>
  936. </ul>
  937. =end html_DE
  938. =cut