Skip to content

dmamontov/esphome-blekeyboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESPHome BLE Keyboard

CodeQL Telegram

Custom esphome component to implement a virtual BLE keyboard.

More info

Supported OS

OS Description
Windows Fully supported
Linux Fully supported
Android Fully supported
MacOS It does not work stably
IOS It does not work stably

Base configuration

Requirements

  • Board: esp32, esp32s2, esp32s3, esp32c3 and esp32h2;
  • Framework: arduino.

Adding a component

external_components:
  - source: github://dmamontov/esphome-blekeyboard

Configuration

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).

Actions

ble_keyboard.print

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.

ble_keyboard.press

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.

ble_keyboard.release

Release keys.

ble_keyboard.release: my_ble_keyboard

ble_keyboard.combination

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.

ble_keyboard.start

Start advertising.

ble_keyboard.start: my_ble_keyboard

ble_keyboard.stop

Stop advertising and disable customers.

ble_keyboard.stop: my_ble_keyboard

Credits