ESPHome interfaced to custom MCU via serial port

Hi guys, I am a totally beginner asking for advice.
As I can see, let’s say for simple temperature sensor such DS18B20, I can simply say I am using DS18B20 connected to ESP32 GPIOxy.
That’s all.
Let’s say instead I need a more complex board where ESP32 is connected to MCU serial port.
In this case I would ask to the MCU:

  • 1 byte as “status register”
  • 1 byte as integer as “temperature value”
  • 2 bytes as fixed point as “viltage value”
  • 3 char string
    and so on.

If I correctly remember, something similar to Tuya MCU serial protocol.
Can this be done?
Thanks.

If you mean UART with serial, you need to experiment with this: