Usb keyboard with esp8266/esp32?

Hello, I’m trying to connect an USB Keyboard (Wechip W1) to an ESP8266/ESP32 module and create switches based on key presses…

Is it possible?

I don’t see a way other than a custom component,

I think you’ll need the new ESP32 S2 to be able to do that ! The previous ESP don’t have native USB, it’s done by an external chip that is in peripheral mode (for USB) and not in host mode !
On ESP-32 S2 you have an USB-C port native that can be put in OTG mode which should allow to use it with a keyboard (out of software coding that has to be done too !

Is it possible with esphome (on an ESP32-S2 module)?

can you make it clearer please? what do you mean by custom component?

The word custom appears 15 times on this page https://esphome.io/

Also I think what @vincen said is correct.

There are other input methods that do work however.

Nope right now and I don’t expect it in near future :confused: You’ll have to code it by your own with Arduino IDE or something similar :wink: You have some infos about it and some links that might be interesting in the bug tracker of Espressif: ESP32-S2 support for USB HID · Issue #4108 · espressif/arduino-esp32 · GitHub

If you want to go with Arduino IDE and ESP32-S2 this video of Andreas Spiess may help. He is not using Host mode though in this video, but it still contains many helpful details.
You could then use MQTT to couple the ESP with HA.

Yes, it is possible. See here:

But it is still work in progress.

1 Like