Oct-22-2017, 12:05 PM
Trying to send a command to my stereo. I can open a standard telnet session from command prompt in windows and simply connect using the IP and port 23 and then type PO which turns the power on and this work perfectly. I would like to have a way to automate this so that I can have a home automation program run the Python script to do this. I have never used Python, but it looks like the following should work: but I must have something wrong? Please help
import telnetlib
import sys
HOST = "192.168.1.140"
VSXCommand = raw_input("PO")
Telnet.open(HOST{[23])
Telnet.write(VSXCommand)
Telnet.close()
I saved this as testpython.py and ran it and a quick window(which looks like a command prompt window) pops up and then disappears, but the receiver does not turn on. Thanks in advance for any help!

import telnetlib
import sys
HOST = "192.168.1.140"
VSXCommand = raw_input("PO")
Telnet.open(HOST{[23])
Telnet.write(VSXCommand)
Telnet.close()
I saved this as testpython.py and ran it and a quick window(which looks like a command prompt window) pops up and then disappears, but the receiver does not turn on. Thanks in advance for any help!