Custom esphome component to implement a virtual BLE keyboard.
OS | Description |
---|---|
Windows | Fully supported |
Linux | Fully supported |
Android | Fully supported |
MacOS | It does not work stably |
IOS | It does not work stably |
- Board: esp32, esp32s2, esp32s3, esp32c3 and esp32h2;
- Framework: arduino.
external_components:
- source: github://dmamontov/esphome-blekeyboard
ble_keyboard:
id: mamontech_keyboard
name: "MamonTechKeyboard"
manufacturer_id: "MamonTech"
battery_level: 50
reconnect: true
buttons: true
use_default_libs: false
- id (Optional, string): Component ID. Needed for action;
- name (Optional, string): Keyboard name (default: Esp32BleKeyboard);
- manufacturer_id (Optional, string): Keyboard manufacturer (default: Esp32BleKeyboard);
- battery_level (Optional, int): Keyboard battery level (default: 100);
- reconnect (Optional, bool): Automatic reconnect service after disconnecting the device. (default: true);
- buttons (Optional, bool): Whether to add separate buttons for keys (default: true);
- use_default_libs (Optional, bool): Whether to use the arduino standard library. (default: false).
Print arbitrary text.
ble_keyboard.print:
id: my_ble_keyboard
text: "hello"
- id (Required, string): Component ID;
- text (Required, string): The text to be printed. Supports lambda.
Press a key.
ble_keyboard.press:
id: my_ble_keyboard
code: 0x80
For media keys:
ble_keyboard.press:
id: my_ble_keyboard
code:
- 0
- 1
- id (Required, string): Component ID;
- code (Required, int|list[int]): Key code. Supports lambda for int only.
Release keys.
ble_keyboard.release: my_ble_keyboard
Press a key combination.
ble_keyboard.combination:
id: my_ble_keyboard
delay: 8
keys:
- 0x80 # Left CTRL
- "a"
- id (Required, string): Component ID;
- delay (Required, int): Delay between clicks. Supports lambda;
- keys (Required, list[int, string]): Key list. Doesn't support lambda.
Start advertising.
ble_keyboard.start: my_ble_keyboard
Stop advertising and disable customers.
ble_keyboard.stop: my_ble_keyboard
- Thanks to all ESPHome contributors;
- Thanks to @T-vK for the ESP32-BLE-Keyboard library;
- Thanks to @h2zero for the NimBLE-Arduino library.