Telnet switch - can't get status

Hi, I’m trying to control my projector via the telnet switch. The problem is that the status doesn’t update. I can turn the projector ON via HomeAssistant so I know the connections is OK.

This is what I have:
switch:
platform: telnet
switches:
projector:
resource: “10.0.0.36”
port: 23
command_on: “~0000 1”
command_off: “~0000 0”
command_state: “~00124 1”
value_template: ‘{{ value == “OK1” }}’

The logs say: Empty response for command: ~00124 1

I have done telnet to the projector and all three commands work. The return for “~00124 1” is “OK1” when on and “OK0” when off. Why doesn’t Home Assistant get a return?

Has anyone used this and can give me some help?

The docs says “If not defined the switch will assume successful state changes.”, but how to I not define something that’s “required”? I don’t need it to check for state, I just need the switch to flip so I can turn it off…

From https://home-assistant.io/components/switch.telnet/ :
command_state (Required): Command to determine the state of the switch. If not defined the switch will assume successful state changes.
value_template (Required): The template evaluating to true will indicate that the switch is on.

Were you able to solve this problem. I’m having the exact same issue trying to configure a telnet switch to control an Optoma projector.

ended up doing this instead:

I’m having the same issue with my Optoma projector.

On my computer shell I tested the telnet command ~00150 1 \r and it correctly returns me the status string. But Home Assistant will show me the same error.

If I find a solution I will post it here

In an actual telnet, how long does it take for the answer to come back?
The default timeout before HA assumes “no response” is quite low (200ms)

Im having kind of the same problem… Optoma UHD60…
My problem is that when Im using telnet I always get “F” as result the first time… after the initial request, I always get the correct answer:

Escape character is '^]'.
Optoma_PJ> ~00124 1
F
Optoma_PJ> ~00124 1
OK1
Optoma_PJ> ~00124 1
OK1

Reply on my own post…
Seems like the Optoma answers with more info than needed… After doing some tcpdump this is what I figured:

Transmission Control Protocol, Src Port: 23, Dst Port: 55035, Seq: 1, Ack: 11, Len: 16 Telnet 
Data: OK1\r\n 
Data: Optoma_PJ>

So a simple solution is:
value_template:
"{{ 'OK1' in value }}"

1 Like

This worked perfectly! Thanks!