Make ESP32-S3 appear as IP device over USB to HA host?

I have HAOS running in a VM on an x86 host machine. The host has an available USB port.

I want to interface an ESP32-S3 to HA via USB. I don’t really care whether the ESP32 runs ESPHome or a native application. I don’t need high bandwidth (although that should be possible). I don’t want to use Wi-Fi or add ethernet to the ESP32. The interface needs to be bidirectional.

The HA serial sensor platform looks promising, but it’s only one direction and just doesn’t seem very robust. I know this has been asked before, but things are always changing. Is there a way to establish an IP connection over USB? This would add a ton of unnecessary overhead, but the end result should just work.

I see there are several Espressif projects which turn an ESP32 into a serial (or SPI) dongle for Wi-Fi and Bluetooth. The input and output are wrong, but the transport is what I want.

From a technical aspect, it’s not clear whether a USB to Ethernet dongle uses a generic driver model or if the client driver simply acts as a passthrough so that the host driver can directly access the network controller’s registers.

Since I have complete control over both sides, I could also run a proxy in another VM.

Has anyone got this working?

Point 31 on USB — ESP-FAQ documentation mentions an USB CDC ECM mode.

Here is the info on the CDC ECM mode on another webpage.

I have no idea how it is used or if HA or something else supports it, but ESP32-S2/S3 seems to do.

I found a little more information here. Their licensing is not cheap. For my use case, this would still be a crippled peer-to-peer network. There’s no way to do DHCP, DNS, etc. It’s either ‘hey you on the other end of the wire’ or maybe static IPs.

I believe this is still the latest Espressif answer:

Currently, only the communications device class (CDC) type of the device with the ACM (Abstract Control Model) subclass is supported.

That means serial only. How about this reddit answer to a similar question:

This not a simple project. Probably you want to do something else instead, eg

find another project
use a raspberry pi 4 instead
get a poe esp32 board

That’s exactly the type of response I expected!

I just installed the HA ONVIF integration and it’s pretty useless. It creates a bunch of entities, but only the video stream works. Motion and external alarm input do not update. No way to control the alarm output. So, it looks like I’m going to have to create a proxy server for all my loose ends. I can still talk to the ESP32-S3 over (native) USB, but it can be my own custom protocol over serial. We say ‘serial’, but there’s no actual serial bit stream like with a traditional external USB-to-serial IC. It’s all virtual/internal. It’s more like a ‘pipe’. HA will then talk to my proxy via MQTT or native ESPHome. The proxy server will have real network access.

I’d rather spend my time writing code where I understand what I’m doing. The ‘advanced’ USB stuff would likely be a pain to debug. But, never say never…

That is all it can be with a serial connection.

Maybe take a look here: