Skip to content

Instantly share code, notes, and snippets.

@gocarlos
Created April 24, 2016 16:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gocarlos/64acb8d8ce2e7032e62bdb243dbe507b to your computer and use it in GitHub Desktop.
Save gocarlos/64acb8d8ce2e7032e62bdb243dbe507b to your computer and use it in GitHub Desktop.
Snippet to turn of the TV Sharp LC-60LE635E and similar with another computer remotelly
1. install telnet on your computer
2. install expect on your comptuer
3. create the a file withthe code of turnOnTV.sh
4. change permissions on that file (chmod 500 turnOnTV.sh)
5. create eventually a cron job to run this script.(50 5 * * * expect ~/scripts/turnOnTV.sh)
You need to set permission to file be read by the owner (400) and allow it execution by the owner (100).
100 + 400 = 500
chmod 500 filename.sh; ./filename.sh
manual here: http://www.sharp.ch/cps/rde/xbcr/documents/documents/om/11_lcd-tv/LC60LE635E-RU-LE636E-S_OM_DE.pdf
#!/usr/bin/expect
# the adress of the tv has to be set on the tv, port is 10002
# connection over telnet...
spawn telnet -l yo 192.168.0.114 10002
expect "login:"
# yo is the username set in the tv
send "yo"
send "\r\n"
expect "Pawword: "
# no password was set --> press enter
send "\r\n"
# one is logged in so one can turn the tv on:
send "POWR1 "
send "\r\n"
# turn the channel
send "ITVD93 "
send "\r\n"
# tv is on, one can log out...
send "quit"
send "\r\n"
expect eof
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment