Telnet shell-script in Automator

automatorcommand lineterminal

I'm partly new to Automator and since there is no application for Mac to control my Pioneer AVR I use some commands in the Terminal. But I'd like to automate some of my commands with the terminal.
I have to say that I don't know much about the Terminal and Networking. But I know that it's not so easy in Automator or in Xcode (with swift) like in the Terminal.
In the Terminal I use this code:

telnet vsx-923.fritz.box.

Response:

Trying 123.456.789.10...
Connected to vsx-923.fritz.box.
Escape character is '^]'.
BridgeCo AG Telnet server


vd //which means Volume down

Response:

FL004D2E564F4C20202D33302E356442
VOL100

In Automator in the Shell-Script I typed

telnet vsx-923.fritz.box.
vd

Where I got the error "Connection closed by foreign host."
In a forum I found out that I had to use echo
why I get a response now.
But If I type in

telnet vsx-923.fritz.box.
echo 'vd'

I only get the response that the avr is connected but for the Volume I don't get a response.

In the future hopefully I am able to build an application, but for now It'll be enough to make it this way.
I hope you can help me with the solution.
Here you get the PDF of the pioneer commands if you'd like to have them. http://www.pioneerelectronics.com/StaticFiles/PUSA/Files/Home%20Custom%20Install/VSX-1120-K-RS232.PDF

Thanks in advance.

Jonas

Best Answer

Your command vd you are sending obviously requires a CR-LF at the end of the line.

I would not recommend using telnet - instead, use netcat:

echo vd | nc -c vsx-923.fritz.box 23

nc -csends CR-LF at the line ending.