Keypad v2

It started at first with a very complicated contraption because I could not find any bluetooth keyboard matrix.

Later, a friend of mine ended up building me a custom 4x4 keyboard using a nice!nano v2 boards with zmk firmware.

ZMK firmware

bluetooth version

dongle version (the one I use). It requires an additional board but we do not need to mess with the bluetooth connection on the home assistant host.

To update the firmware I have to double tap the reset button then drag and drop the firmware file on the mounted device (like a usb stick).

Using the firmware settings_reset is very handy to reset the device settings.

Connecting the keyboard and identifying the device

(Only if not using a dongle) Connect the bluetooth keyboard on the host of home assistant

We need to connect the keyboard to home assistant using bluetoothctl.

bluetoothctl
agent on
power on
scan on  # wait for your device's address to show up here and note down the MAC address
scan off
trust <MAC_ADDRESS>
pair <MAC_ADDRRESS>
connect <MAC_ADDRESS>

Identifying the device name using

$ cat /proc/bus/input/devices | grep ZMK
N: Name="ZMK Project Pacane Macro Bo Keyboard"

Home assistant configuration

configuration.yaml

keyboard_remote:
  #device_descriptor: /dev/input/event3
  device_name: 'ZMK Project Pacane Macro Bo Keyboard'
  type:
    - "key_down"
    #- "key_up"

Automation configurations

- trigger: event
    event_type: keyboard_remote_command_received
    event_data:
      device_name: ZMK Project Pacane Macro Bo Keyboard
      key_code: 59
      type: key_down

Keycodes for F1 to F16

Key

Code

F1

59

F2

60

F3

61

F4

62

F5

63

F6

64

F7

65

F8

66

F9

67

F10

68

F11

87

F12

88

F13

183

F14

184

F15

185

F16

186