BLE Client 文本传感器
ble_client 组件是一个文本传感器平台,可以
查询 BLE 设备的服务特征特定值。
有关 BLE 服务和特征的更多信息,请参见 Ble Client。
esp32_ble_tracker:
ble_client: - mac_address: XX:XX:XX:XX:XX:XX id: itag_black
text_sensor: - platform: ble_client ble_client_id: itag_black name: "Sensor Location" service_uuid: '180d' characteristic_uuid: '2a38'-
ble_client_id(必选,ID):关联 BLE 客户端的 ID。
-
service_uuid(必选,UUID):设备上服务的 UUID。
-
characteristic_uuid(必选,UUID):要查询的服务特征的 UUID。
-
descriptor_uuid(可选,UUID):要查询的特征描述符的 UUID。
-
notify(可选,boolean):指示服务器为此 特征发送通知。默认为
false。 -
update_interval(可选,Time):轮询设备的间隔。默认为
60s。 -
来自 Text Sensor 的所有其他选项。
自动化:
- on_notify(可选,Automation):从设备收到 notify 消息时要执行的自动化。参见
on_notify。
BLE 传感器自动化
Section titled “BLE 传感器自动化”on_notify
Section titled “on_notify”当设备/服务器为
特征发送 notify 消息时,将触发此自动化。配置变量 notify 必须为 true,否则此操作将
无效果。
变量 x 类型为 std::string,传递给自动化以便在 lambda 中使用。