Maybe it’s because of the line endings - echo normally adds a LF (linefeed) character to the end of a string.
Depending on what your device expects, you can try
echo -ne "..."
(where the -n supresses any newline characters) and add a "\n" (<LF>) or "\r\n"(<CR><LF>) manually - depending on what your device is looking for (this should be in the protocol specifications).
For debugging, you could point the IP address to another system, run nc in server mode there (-l <port> option) and pipe that into a tool like e.g. hexdump just to see if your command a) works at all and b) is sending the exact string you’re expecting.
Hi to all!
I was wondering how to make a TCP Call to my SR201 Web realy bougth on Bang Good, and found this article very helpful.
Thanks to all because I managed to create a switch reading around this article in minutes.
Now I would like to ask one question:
I use HOMEKIT to monitor devices with my phone, the SWITCH appears n the devices shown in homekit, but when I press the switch (it works), but it remain on, even if the switch turns off by itself after 1 second.
NOTE: I do not use command_state_off because the switch turns on and off by itself (like a push button or a switch with inching mode on). The icon on homeassistant behave well, it turns on and off after 1 second, but in homekit the switch keep to stay pressed (on) i need to push it again.
Full logs
2022-09-03 11:14:34.435 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:34.438 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration rpi_gpio which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:34.439 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration dht which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:34.441 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:34.443 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration next_holiday which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:34.445 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration duckdns_ipv4_ipv6 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:34.447 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration arpscan_tracker which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-03 11:14:45.921 WARNING (MainThread) [homeassistant.components.number] custom_components.localtuya.number::LocaltuyaNumber is overriding deprecated methods on an instance of NumberEntity, this is not valid and will be unsupported from Home Assistant 2022.10. Please report it to the custom integration author.
22-09-03 11:49:57 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 11:51:04 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-09-03 11:54:59 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:00:01 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:05:03 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:10:05 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:15:07 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.check] Starting system checks with state CoreState.RUNNING
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.NETWORK_CONNECTION_PROBLEM/ContextType.SYSTEM
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DNS_SERVER_IPV6_ERROR/ContextType.DNS_SERVER
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.PWNED/ContextType.ADDON
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.FREE_SPACE/ContextType.SYSTEM
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.SECURITY/ContextType.CORE
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DNS_SERVER_FAILED/ContextType.DNS_SERVER
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.TRUST/ContextType.SUPERVISOR
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.check] System checks complete
22-09-03 12:19:59 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
22-09-03 12:20:00 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
22-09-03 12:20:00 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state CoreState.RUNNING
22-09-03 12:20:00 INFO (MainThread) [supervisor.resolution.fixup] System autofix complete
22-09-03 12:20:09 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:21:00 INFO (MainThread) [supervisor.updater] Fetching update data from https://version.home-assistant.io/stable.json
22-09-03 12:21:05 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-09-03 12:25:11 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:30:13 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:34:21 INFO (MainThread) [supervisor.host.info] Updating local host information
22-09-03 12:34:22 INFO (MainThread) [supervisor.host.services] Updating service information
22-09-03 12:34:22 INFO (MainThread) [supervisor.host.network] Updating local network information
22-09-03 12:34:23 INFO (MainThread) [supervisor.host.sound] Updating PulseAudio information
22-09-03 12:34:23 INFO (MainThread) [supervisor.host.manager] Host information reload completed
22-09-03 12:35:15 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:40:17 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:45:19 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:50:21 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 12:51:05 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-09-03 12:55:23 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:00:25 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:05:27 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:10:29 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:15:31 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.check] Starting system checks with state CoreState.RUNNING
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.NETWORK_CONNECTION_PROBLEM/ContextType.SYSTEM
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DNS_SERVER_IPV6_ERROR/ContextType.DNS_SERVER
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.PWNED/ContextType.ADDON
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.FREE_SPACE/ContextType.SYSTEM
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.SECURITY/ContextType.CORE
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DNS_SERVER_FAILED/ContextType.DNS_SERVER
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.TRUST/ContextType.SUPERVISOR
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.check] System checks complete
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state CoreState.RUNNING
22-09-03 13:20:00 INFO (MainThread) [supervisor.resolution.fixup] System autofix complete
22-09-03 13:20:33 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:21:06 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-09-03 13:25:35 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:30:37 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:31:45 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from core_ssh
22-09-03 13:31:45 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from core_ssh
22-09-03 13:31:45 INFO (MainThread) [supervisor.api.middleware.security] /host/info access from core_ssh
22-09-03 13:31:45 INFO (MainThread) [supervisor.api.middleware.security] /core/info access from core_ssh
22-09-03 13:33:10 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
22-09-03 13:33:11 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_vscode
22-09-03 13:33:11 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
22-09-03 13:35:39 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:36:24 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API connection is closed
22-09-03 13:40:28 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
22-09-03 13:40:29 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_vscode
22-09-03 13:40:29 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
22-09-03 13:40:41 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:45:43 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:50:45 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
22-09-03 13:51:06 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
22-09-03 13:55:47 WARNING (MainThread) [supervisor.addons.options] Option 'cnames' does not exist in the schema for Mosquitto broker (core_mosquitto)
If I use -v in Terminal & SSH it returns OPEN and the command is not executed
\x08\ Number of bytes to be sent
xe9\ Command (as they call it in the documentation)
x21\ Frame limiter (as they call it in the documentation)
x31\x32\x33\x34\ password
x44\ Deactivation code
x21\Frame limiter (as they call it in the documentation)
x5e Checksun
I was trying to use the TCP sensor to communicate with the alarm, but I couldn’t.
I don’t know if it was in the cache, but I deleted it from the yaml file and it kept showing up in the UI.
Only after several restarts it disappeared.
I thought it was blocking the port, but apparently it’s not.
2022-09-06 15:48:15.277 WARNING (SyncWorker_0) [homeassistant.components.tcp.common] Timeout (10 second(s)) waiting for a response after sending '\né!686173[!J' to 192.168.0.15 on port 9009
I have the same problem. Can you tell me how you solve this issue?
I send the below command_line and doesnt do anything, WIth udp which i have worked before the commands works immidiately and if the remote device was out of the network i had error at HA. Now with tcp nothing, I will appreciate if you can help me with this issue. I have managed to send with third party softwares the command from my pc to the remote device
I didn’t see that you replied.
I will check it today and i will inform you about the result.
I will try this type of syntax at ssh terminal of Hassos?
Thank you very much!
Is there any way to send payload as template (state of some sensor) ??
Pretty lot of devices simply listens for some info (temp, hum, state, status). Without any response.
So TCP sensor is perfect way to send them data - no need to use command_line or shell_command, no automations…
As for now it can send value, but doesn’t convert template to value.