Difference between revisions of "Controlling DirecTV Set Top Box (STB) via Network"
m (formatting and category)
m (Comment about a false error after a successful tuning.)
|Line 121:||Line 121:|
Revision as of 15:25, 23 December 2010
|Description||A Perl script for changing channels on DirectTV STBs using the web interface.|
Some DirecTV set top boxes now allow certain operations via the DirecTV HTTP Server on port 8080. The H23 is one example. The set top box must be plugged in to the network in order for this to work.
Documentation on the internet is lacking at the moment, but it is possible currently to change the channel and to gather current (tuned) channel information. The attached perl script allows users to change the channel or gather current channel data. The DirecTV set top box always returns data in JSON.
Attached is my first crack at a script. I'm pretty green at perl so this is quite a hack, but it works. The script takes the following arguments:
Always list the IP address of the receiver first. Next, type the amount of seconds to sleep after changing the channel. Next, type "tune" to change the channel, or "getTuned" to display the JSON for the current listing If you chose "tune", now enter the channel number
I found that on my Ubuntu installation, I had to install the JSON library using CPAN. I followed these instructions:
sudo cpan install JSON exit
Note: My H24 receiver has been throwing false errors after successfully tuning, specifically "(30) Error: OK." from line 84. It seems that the check in line 71 is comparing 'OK' with 'OK.' and failing, of course. One could easily modify the check value to be 'OK.' as well, but I assume other boxes may be outputting 'OK' without the period. Alternatively, one could look for both with an 'OR' statement, as in 'if($check_ok eq "OK" || $check_ok eq "OK.")' or one could trim off any and all trailing characters from the result string, as in 'if( substr( $check_ok, 0, 2 ) eq "OK" )' or even just look for "OK" as a substring: 'if( $check_ok =~ /OK/ )'. I shall leave it for someone with a better idea of the possible range of output to decide what is best and delete this note afterward.