I just got the notification that command line switches were being re-formatted and would stop working in 2023.12. I’m on 2023.11.2 and tried to re-format the one switch I have based on the new docs, but I can’t get my switch to work!
old config:
switch:
- platform: command_line
switches:
nec_tv:
command_on: echo -e "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x31\x03\x73\x0D" | nc !secret nec_tv_ip 7142
command_off: echo -e "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x34\x03\x76\x0D" | nc !secret nec_tv_ip 7142
friendly_name: NEC TV
and I’ve replaced that with:
command_line:
- switch:
name: NEC TV
unique_id: nec_tv
command_on: echo -e "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x31\x03\x73\x0D" | nc 192.168.1.240 7142 -c
command_off: echo -e "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x34\x03\x76\x0D" | nc !secret nec_tv_ip 7142 -c
HA accepts the config and I can see my switch but trying to toggle it on or off I get:
Logger: homeassistant.components.command_line
Source: components/command_line/switch.py:183
Integration: Command Line (documentation, issues)
First occurred: 9:47:31 PM (1 occurrences)
Last logged: 9:47:31 PM
Command failed: echo -e "\x01\x30\x41\x30\x41\x30\x43\x02\x43\x32\x30\x33\x44\x36\x30\x30\x30\x31\x03\x73\x0D" | nc !secret nec_tv_ip 7142 -c
I’ve tried running the echo command from my HAOS host with both the on and off commands and it works, but it just seems that HA can’t do it in the command line switch. Has anyone else been able to get switches like this working in the new format? It won’t let me go back to the old format even while its not fully deprecated. Thanks in advance!