Home Assistant Community

Switch using Telnet Commands to 8x8 ATEN HDMI Matrix

#1

I seen in some previous posts that the switch command can be used to send Telnet commands. I have tested my HDMI matrix using Telnet and I can control it as expected, however my issue is that I cant send the commands from Hass.IO as the telnet session requires a username and password.

Is there a way to do this ?

Globalcache iTach IP2SL
#2

anyone know how to pass credentials in telnet session ?

#3

Does this help? https://serverfault.com/questions/92736/send-login-credentials-and-commands-using-shell-script-via-telnet

#4

Did a bit of digging an found some sort of advice, though at this moment it doesn’t seem to be working. It must be stated that when I run the commands below in Putty it works as expected.

In my configuration.yaml I have the following;

switch:
  - platform: command_line
    switches:
      xboxone_2_homeoffice:
       command_on: /config/hdmimatrix/xboxone2office.sh
       friendly_name: "Xbox One to Office TV"

This switch then calls a script file which has the following in it;

{ sleep 1; echo -e “username”; echo -e “password”; echo -e “ss 03,06”; echo -e “exit”; } | telnet 192.168.1.10

I have also run from the SSH on the HASS.IO the following command

chmod 755 /config/hdmimatrix/xboxone2office.sh

Now as expected the swich now appears in the states but when run it doesn’t make the changes expected, in fact it doesn’t appear to do anything at all.

Im probably missing something but I have been looking at it that long now my head hurts lol

#5

Your script doesn’t look like the one I pointed to on serverfault. For a start you surround your echo commands with curly brackets { }, whereas the example uses plain brackets ( ).

#6

Morning @nickrout, further searching in the community took me to the following topic, this is where the deviation in syntax came from

Still doesn’t work though so will try it with normal brackets and see.

#7

you can check this topic here

#8

@elRadix you any idea how I could install Expect on Hass.IO ?

#9

if you can logon in ssh in hassio (using the ssh addon I guess) you could try these commands…

apk update
apk add busybox-extras
apk add expect

ps. I’m not an hassio user

#10

Thanks @elRadix seems to look positive … just need to find where it was installed now

#11

try

which telnet
which expect

I guess you’ll have to re-execute these command when there is a new HA update…or create a script to run at hass start with an automation ie. shell_command