TCP Commands From HA To Audio Matrix

Then I and others have told you or tried to tell you. If you cannot make it work as a command at the shell level, your issue has 100% absolutely nothing to do with Hone Assistant.

Make it work without anything in Home Assistant and the come back here for help on making it into a switch. Constantly asking things here that you cannot execute from the command line is worthless effort to us and others.

1 last try, you showed us an screenshot from a windows client where you were sending the ASCII, the line below was the hex format, why not try with hex format, like I do with my NC commands?


echo -e "\xED\x43\x31\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xAF\xAF\x53\x10\x01" | nc 192.168.0.10 1001

Nothing Happens From Terminal.


I can’t understand why doesn’t work.
All are correct.
I have at the add also with $1 variables at nc.sh with values and guess what!! Doesn’t work.
The values which i add at the below template i have tested first at the other software and works fine!

#!/bin/bash
echo -e "\x23\x7c\x4d\x30\x30\x31\x7c\x46\x30\x30\x31\x7c\x53\x56\x30\x31\x7c\x31\x"$1"\x7c\x55\x7c\x0d\x0a" | nc 192.168.168.202 5001
  • platform: template
    switches:
    test1:
    friendly_name: “test1”
    turn_on:
    - service: shell_command.nc
    data_template:
    volume: “31”
    turn_off:
    - service: shell_command.nc
    data_template:
    volume: “39”

Dear,

I post here my problem to find help!
I’m sure that someone here has/had the same problem with me and can help me.

Do we know from which port netcat sends tcp commands to remote device at 5001?
the packet sender sends from the below ports the commands successfully.

Well IMHO if you ran this command if you ssh into HASS:

nc -z 192.168.168.202 5001

And got nothing back, I would assume that means that port 5001 is closed or not available or you cannot get to it from where you ran the command. That is my whole point really.

You could change that to something like:

nc -z 192.168.168.202 80-6000

Which would scan every port from 80 to 6000. To see if there are any listening ports.
If the ports are blocked, maybe this helps:

The strange thing is that the windows client is working , while NC isn’t

Windows client is running from a different machine or virtual environment and is not HASS in ??? (not clear what you have, a Linux container or?). These are two completely different environments that could firewall off communications outbound in different ways, can they not? It is obvious that the matrix unit is not blocking anything from speaking to it, the question is can you send out requests to it.

Well,

I run 2 installations with HA.
The first is at raspberry PI 4 with Hassos and the second is from windows PC with VMware and have download the os for windows for VMware.

Windows Client is at windows 11 PC and at this PC I have VMware workstation with HA.
From Raspberry
image

From VMware

image

Maybe a shorter port range? Not clear but right from nc manpages:

Port Scanning

It can be useful to know which ports are open and running services on a target machine. The –z flag can be used to tell nc to report open ports, rather than to initiate a connection.

In this example:

$ nc -z host.example.com 20-30
Connection to host.example.com 22 port [tcp/ssh] succeeded!
Connection to host.example.com 25 port [tcp/smtp] succeeded!

The port range was specified to limit the search to ports 20 - 30.

Raspberry
Doesn’t work. Very weird!
image
VMware
image

Try do an “nmap” for scanning open ports, Google for correct syntax

Do you mean the below to run it from HA or from widows pc client to scan for open ports?

From HA and ssh addon

From Raspberry
image

From VMware
image

Every nmap give me other result.
I run nmap plenty of times and now also vmware finds the tcp ports without to change nothing. Noted that windows firewall is disabled.See the time difference which commands executed.
image
image

What version of netcat are you using on both platforms?

Raspberry
image
VMware
image

Maybe try installing non-Busybox cersion? … mine is:

OpenBSD netcat (Debian patchlevel 1.206-1ubuntu1)
usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
	  [-m minttl] [-O length] [-P proxy_username] [-p source_port]
	  [-q seconds] [-s source] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout]
	  [-X proxy_protocol] [-x proxy_address[:port]] 	  [destination] [port]
	Command Summary:
		-4		Use IPv4
		-6		Use IPv6
		-b		Allow broadcast
		-C		Send CRLF as line-ending
		-D		Enable the debug socket option
		-d		Detach from stdin
		-F		Pass socket fd
		-h		This help text
		-I length	TCP receive buffer length
		-i interval	Delay interval for lines sent, ports scanned
		-k		Keep inbound sockets open for multiple connects
		-l		Listen mode, for inbound connects
		-M ttl		Outgoing TTL / Hop Limit
		-m minttl	Minimum incoming TTL / Hop Limit
		-N		Shutdown the network socket after EOF on stdin
		-n		Suppress name/port resolutions
		-O length	TCP send buffer length
		-P proxyuser	Username for proxy authentication
		-p port		Specify local port for remote connects
		-q secs		quit after EOF on stdin and delay of secs
		-r		Randomize remote ports
		-S		Enable the TCP MD5 signature option
		-s source	Local source address
		-T keyword	TOS value
		-t		Answer TELNET negotiation
		-U		Use UNIX domain socket
		-u		UDP mode
		-V rtable	Specify alternate routing table
		-v		Verbose
		-W recvlimit	Terminate after receiving a number of packets
		-w timeout	Timeout for connects and final net reads
		-X proto	Proxy protocol: "4", "5" (SOCKS) or "connect"
		-x addr[:port]	Specify proxy address and port
		-Z		DCCP mode
		-z		Zero-I/O mode [used for scanning]
	Port numbers can be individual or ranges: lo-hi [inclusive]