Home assistant and RS422 commands

I want to use Home Assistant as an extension to an existing system that operates with RS422. I have already gone through some posts in this community, but I couldn’t find anything that I thought would be a good starting point.

If possible, I would like to use Ethernet. We will place a converter between the copper wires and the network.

What should Home Assistant do?

As an example, when a helper, such as a input_boolean is switched on, a hexadecimal command should be sent:

Turn on input_boolean: send command “\x08\x22\x00\x00\x00\x02\xD4”

Turn off input_boolean: send command “\x08\x22\x00\x00\x00\x01\xD5”

If the command is sent by another device, the helper in Home Assistant should also be toggled, so:

When “\x08\x22\x00\x00\x00\x01\xD4” is received: input_boolean on

When “\x08\x22\x00\x00\x00\x01\xD5” is received: input_boolean off

How should I approach this situation?