Want to send TCP packet to wifi fan

hey i would need help trying to get a wifi fan in home assistant, am very new in programming and home assistant so way too little prerequisites,
have managed to get ip address
ex 192.168.0.01
and that it listens to port 4000.
also got hold of a schedule with control commands

looking for help with how to write the code itself to send a command
attaches command schedule with example codes

would be eternally grateful if someone helped mid with an example, which I can run in a script or on a switch,

I think i understand the number sequence just doesn’t know how to write the command
as in the example

Example of unit activation/deactivation and low speed selection
0x6D 0x6F 0x62 0x69 0x6C 0x65 0x03 any 0x04 0x01 0x0D 0x0A

this is what i got so far in a shell_commands.yaml

low_speed: echo -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc <iptofan> <4000> 

anything im missing or need to do first

Log Details (ERROR)

Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/init.py:97
Integration: shell_command (documentation, issues)
First occurred: 8:44:07 PM (1 occurrences)
Last logged: 8:44:07 PM

Error running command: echo -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc <192.168.86.40> <4000>, return code: 2

NoneType: None

Does your command end with:

nc 192.168.86.40 4000

or are the two arguments wrapped in < > as shown in the error message?

yeep =/ the bad thing with being a copy past guy =D trying again

Yeah, you’ll want to “unwrap” those two arguments.

now i get

Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/init.py:97
Integration: shell_command (documentation, issues)
First occurred: 9:05:59 PM (1 occurrences)
Last logged: 9:05:59 PM

Error running command: echo -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc 192.168.86.40 4000, return code: 1

NoneType: None

   low_speed: echo -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc 192.168.86.40 4000

Try this version. I wrapped the entire command in single-quotes and, just for good measure, added the -n option to echo (to suppress the inclusion of a \n at the end of the hex string).

shell_command:
  low_speed: 'echo -n -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc 192.168.86.40 4000' 

Log Details (ERROR)

Logger: homeassistant.components.shell_command
Source: /usr/src/homeassistant/homeassistant/components/shell_command/init.py:97
Integration: shell_command (documentation, issues)
First occurred: 9:16:54 PM (1 occurrences)
Last logged: 9:16:54 PM

Error running command: echo -n -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc 192.168.86.40 4000, return code: 1

NoneType: None

  low_speed: 'echo -n -e "\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A" | nc 192.168.86.40 4000' 

If you login to the machine hosting Home Assistant and, at the command prompt, execute that command (without the outer single-quotes, of course), does it work?

will check

In this situation, it’s best to debug the shell commands first, (from a command shell) without involving Home Assistant. When you know the commands work perfectly, then add them to Home Assistant. If they fail to work at that point, then you know it has something to do with Home Assistant.

seems to work no error atleast, can the problem be in virtual box ?
running home assistant on intel nuc with unbuntu and virtual box
when i try the command i just paste in
echo -n -e “\0x6D\0x6F\0x62\0x69\0x6C\0x65\0x03\0x04\0x01\0x0D\0x0A” | nc 192.168.86.40 4000
in the terminal ?
sorry but very new to this =)

thank you so far for the help i will recive a new fan tomorrow it was transport damage on this one (maybe part off the problem why it dont respond from terminal)

Yes, paste that string, press the enter key, and it will be executed. If it runs without error then we can only assume it did its job and sent the hex string to the desired IP address and port.

If you want to confirm that the transmission is actually working, you can run nc on another computer (let’s call it the “listener”) and make it listen on port 4000. The command would be:

nc -l 4000

It will just sit there quietly until it receives something on port 4000 and will then display it.

Now modify your existing command so that it sends the hex string to the IP address of the “listener” computer. Execute the modified command and you should see some gibberish (the hex string) appear on the listener’s screen. This confirms you can successfully transmit the hex string from one computer to another (or to your fan). After the test is finished, press Ctrl-C on the listener computer to stop the nc command.

If the fan doesn’t respond to the transmitted hex string the way you expected, either it’s not actually connected to the network, or its not listening on port 4000, or the hex string is incorrect so the fan ignores it.

Did someone manually send a command for Blauberg Vento Expert?