I came to this thread while trying to send hex commands over TCP to a board containing an ESP, a microcontroller and relays. I fought several hours with it, debugging, so I thought what follows might save some time for others: For some reason, echo -e “\xA0” pipe netcat… was actually sending the ASCII string. Changing to simple quotes solved the problem miraculously. echo -e ‘\xA0’ pipe netcat…
Not that miraculous, you need to do some reading on quoting in a shell. Most of which I have forgotten as I don’t do much shell scripting now. However I do recall there is a distinct different between single and double quotes.
i finally found a working solution for this problem on HASSIO (or the new HA)
to send raw ip packet data to any device in your network all you need to do is the following:
what you need to do is download a static binary for netcat from this location: https://github.com/therealsaumil/static-arm-bins/blob/f46fded7181694862fec4d3a39ce41059e494a01/nc-arm-static
then copy that file to /config/ and rename it to “nc”
then you can call netcat from the HA container.
example:
in my case i created a shell_command in my config file which calls two *.sh scripts
one script for turning the fireplace on and one for turning it off.
the on script sends a byte sequence to an ip address and a port with netcat.
you just have to specify the path to the nc file in the *.sh script.
all you have to do then is make a boolean switch and make setting it to “on” call the fireplace_on.sh script and setting it to “off” make it call the fireplace_off.sh script.
I’m really struggling with my integration of a Sonance 6 zone whole home audio amp. I currently control it with a phone app called Irule and a global cache ip2sl device that takes TCP/IP commands and sends serial commands to the Sonance. I can use Putty to connect to the ip2sl and send commands that are recognized. I’ve tried the suggestion shown here with various tweaks but no luck.
I’d like to have a button card with 4 buttons for each zone: power on, off, vol+, and vol-. I have the commands and with a putty telnet connection I can send :Z21 as the zone 2 on command without issue. The itach comes with testing software and I can successfully send the command through that with various formats depending on the settings in that software of raw, mixed or hex. :Z21\x0D hex 3a 5a 32 31 0d or \x3a\x5a\x32\x31\x0d. With telnet only :Z21 works, carriage return is likely provided by the pressing enter.
I’ve tinkered with what is in the quotes, trying all combinations of things I’m able to send via Putty telnet session and the testing software but am not getting a result.
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