Difference between revisions of "TV Wakeup Timer"

From MythTV Official Wiki
Jump to: navigation, search
m
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
I perfer to have the TV wake me up instead of an alarm clock.  With version [http://www.mythtv.org/wiki/index.php/Release_Notes_-_0.19 0.19] and the new TCP Port Frontend control you can do it.  Setup the TV to turn on at whatever time you wish to get up.  And then run the following script with cron at the same time.   
+
{{Warning box|This script uses a telnet client to access and control the frontend.  The frontend does not have a telnet server, but rather a raw unicode socket server.  Any telnet control codes will be handled as unicode text by the frontend, and any non-ASCII text will be handled as control codes by the client.}}
 +
 
 +
I prefer to have the TV wake me up instead of an alarm clock.  With version [http://www.mythtv.org/wiki/index.php/Release_Notes_-_0.19 0.19] and the new TCP Port Frontend control you can do it.  Setup the TV to turn on at whatever time you wish to get up.  And then run the following script with [[cron]] at the same time.   
  
 
The script connects to the frontend via telnet, switches to LiveTV and changes the channel.
 
The script connects to the frontend via telnet, switches to LiveTV and changes the channel.
 
+
{{Perl|tv_wakeup.pl|
 
<pre>
 
<pre>
 
#!/usr/bin/perl
 
#!/usr/bin/perl
Line 34: Line 36:
 
$telnet->print('exit');
 
$telnet->print('exit');
 
</pre>
 
</pre>
 +
}}
 +
 
{{Note box|The telnet feature that this script uses is disabled by default.  Enable it via the mythfrontend setup screen under the Default settings page, and then restart mythfrontend.}}
 
{{Note box|The telnet feature that this script uses is disabled by default.  Enable it via the mythfrontend setup screen under the Default settings page, and then restart mythfrontend.}}
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 
[[Category:Scripts]]
 
[[Category:Scripts]]

Latest revision as of 00:20, 17 March 2011

Warning.png Warning: This script uses a telnet client to access and control the frontend. The frontend does not have a telnet server, but rather a raw unicode socket server. Any telnet control codes will be handled as unicode text by the frontend, and any non-ASCII text will be handled as control codes by the client.

I prefer to have the TV wake me up instead of an alarm clock. With version 0.19 and the new TCP Port Frontend control you can do it. Setup the TV to turn on at whatever time you wish to get up. And then run the following script with cron at the same time.

The script connects to the frontend via telnet, switches to LiveTV and changes the channel.

Application-x-perl.png tv_wakeup.pl

#!/usr/bin/perl

use Net::Telnet;

$host = "localhost";
$port = 6546;
$channel = 67;

$telnet = new Net::Telnet ( Timeout=>10,
                            Port=>$port,
                            Errmode=>'die');

my $length = length($channel);
my $counter = 0;
my $temp;

$telnet->open( $host );

$telnet->waitfor('/#/i');
$telnet->print('jump livetv');
$telnet->waitfor('/#/i');

while( $counter < $length ) {
  $telnet->print("key " . substr($channel,$counter,1) );
  $telnet->waitfor('/#/i');
  $counter++;
}

$telnet->print('exit');


Important.png Note: The telnet feature that this script uses is disabled by default. Enable it via the mythfrontend setup screen under the Default settings page, and then restart mythfrontend.