Controlling TiVo Set Top Box (STB) via Network
Contents
Using the TIVO Premier as a set top box for HD-PVR
Author | Dave Aurzada |
Description | An expect script for changing channels on TiVo Premier STBs using telnet. |
Supports |
Summary
This page is a document of my experiences trying to use a TiVo Premier as a set top box in MythTV. I quickly tired of the $18/mth that Verizon wanted to charge me for their crippled DVR. I knew the new TIVOs will take a cable card, so I picked one up off Craig's list for $99 and ordered a cable card for my Verizon FIOS ($5/mth, no install fee). Next, I ordered a Hauppauge HD-PVR and began my adventure. Note, you do not have to pay for a TiVo subscription for this hack to work.
Initially, I had lots of problems with the HD-PVR (because my firmware was much newer than my Ubuntu 10.04 OS). Eventually, I upgraded to the latest version of Mythbuntu, and my problems quickly disappeared. After many attempts to find IR codes for the TiVo, I found this little perl:
Background
www.tivocommunity.com/tivo-vb/showthread.php?t=392385
<quote>
As many of you may have already heard, TiVo added support for Crestron systems back in software version 9.1 but there isn't a whole lot of information available about from TiVo or from Crestron.
After thinking about it for a small while, my curiosity was piqued, and I decided to try and figure out the protocol Crestron was using to talk to an unhacked TiVo, and how we non-Crestron users could somehow harness it.
As it turns out both the TiVo HD and Series3 units now listen on port 31339 for connections from a Crestron device. What is really interesting about this discovery is that this service is enabled and accessible by default on a stock Series3 running software 9.1 and up. There is NO HACKING REQUIRED to use this interface.
The protocol and its commands aren't published, but some heavy digging on Crestron and debugging the tivoapp binary resulted in some interested finds.
If you telnet into your TiVo on port 31339, you will be presented with the following:
CH_STATUS <CHANNEL> <STATUS>
This prompt reflects the current status of the TiVo and will tell you the current channel being watched, and if it's being recorded.
Once the telnet session is started, the following commands are available:
KEYBOARD - The current purpose and syntax of this command is unknown.
TELEPORT <PLACE>- I'm not sure why this command exists, because I believe anything that TELEPORT does can also be accomplished via IRCODE. That said, the four currently known places you can "teleport" to are TIVO, LIVETV, GUIDE, and NOWPLAYING.
SETCH <CHANNEL> - This command will change the channel on the current tuner being watched to the channel number defined. If the current tuner is recording a program, it will change the other tuner. If both tuners are recording, the channel will not change and the TiVo will respond with "CH_FAILED RECORDING "Show Title". Using this command when a recording is being played back will result in "CH_FAILED NO_LIVE".
FORCECH <CHANNEL> - This command will force the current tuner to the tune the desired channel regardless of what it's doing. If a recording is being recorded it will cancel the recording and change the channel without confirmation.
IRCODE <COMMAND> - IRCODE seems to mimic the old "sendkey" command in almost every way. While it can't handle multiple commands on one line, almost all of the commands listed in sendkey.tcl are valid and working.
The following is a list of IRCODE commands that I have verified as working:
Code:
UP DOWN LEFT RIGHT SELECT TIVO LIVETV THUMBSUP THUMBSDOWN CHANNELUP CHANNELDOWN RECORD DISPLAY DIRECTV NUM0 NUM1 NUM2 NUM3 NUM4 NUM5 NUM6 NUM7 NUM8 NUM9 ENTER CLEAR PLAY PAUSE SLOW FORWARD REVERSE STANDBY NOWSHOWING REPLAY ADVANCE DELIMITER GUIDE
If take too long to type a command, it will result in COMMAND_TIMEOUT since the interface was designed to receive whole and complete commands, and was not designed to be used manually via telnet.
</quote>
With help, I created an expect script to telnet to the TiVo and change the channel. You need to remember to enable the networking for the TiVo via the settings menu and install expect (sudo apt-get install expect), but otherwise, it is pretty straight forward.
HD-PVR change script
#!/usr/bin/expect set timeout 1 set channel [lindex $argv 0] spawn telnet 192.168.1.6 31339 #TiVo responds CH_STATUS <ch#> LOCAL expect "LOCAL" send "FORCECH $channel\r" #TiVo responds CH_STATUS <$channel> LOCALE expect "LOCALE" #Need to send ^] send "\x1d" expect "telnet>" send "QUIT\r"