Skip to content

Zephyr BLE Server

The zephyr_ble_server component enables a Bluetooth Low Energy GATT server on devices running the Zephyr RTOS. It supports secure pairing flows, including the Numeric Comparison passkey confirmation model defined in the Bluetooth specification.

# Example configuration entry
zephyr_ble_server:
on_numeric_comparison_request:
then:
- logger.log:
format: "Compare this passkey with the one on your BLE device: %06d"
args: [passkey]
- ble_server.numeric_comparison_reply:
accept: true

This automation is triggered when a numeric comparison is requested by the BLE device.

zephyr_ble_server:
on_numeric_comparison_request:
then:
- logger.log:
format: "Compare this passkey with the one on your BLE device: %06d"
args: [passkey]
- ble_server.numeric_comparison_reply:
accept: true

ble_server.numeric_comparison_reply Action

Section titled “ble_server.numeric_comparison_reply Action”

This action triggers an authentication attempt after a numeric comparison.

Example usage:

on_...:
then:
- ble_server.numeric_comparison_reply:
accept: true
  • accept (Required, boolean, templatable): Should be true if the passkeys displayed on both BLE devices are matching.

Secure connection with numeric comparison accepted automatically:

zephyr_ble_server:
on_numeric_comparison_request:
then:
- logger.log:
format: "Compare this passkey with the one on your BLE device: %06d"
args: [passkey]
- ble_server.numeric_comparison_reply:
accept: true

Secure connection with numeric comparison accepted via a lambda:

zephyr_ble_server:
on_numeric_comparison_request:
then:
- logger.log:
format: "Compare this passkey with the one on your BLE device: %06d"
args: [passkey]
- ble_server.numeric_comparison_reply:
accept: !lambda "return true;"