跳转到内容

Nordic UART 服务(NUS)

BLE NUS 组件提供基于 Nordic UART Service 的蓝牙低功耗 UART 接口。它可用于流式传输日志或启用与 ESPHome 的自定义双向通信。

# Example configuration entry
ble_nus:
type: logs
  • type (可选, string):操作模式。取值为 logs 或 uart。 logs 流式传输 ESPHome 日志。uart 提供双向通信。默认为 logs。
  • rx_buffer_size (可选, int):接收缓冲区的大小,以字节为单位。范围:160-8192。默认为 512。 仅对模式 uart 有效。
  • tx_buffer_size (可选, int):发送缓冲区的大小,以字节为单位。范围:160-8192。默认为 512。
  • debug (可选, mapping):用于调试 UART 集线器通信的选项,请参阅调试。

通过 BLE 连接并查看设备日志:

Terminal window
esphome logs d.yaml --device BLE

或连接到特定的 BLE 地址:

Terminal window
esphome logs d.yaml --device 00:11:22:33:44:55

uart 可以与 python BLE Serial 一起使用