mirror of
https://github.com/esphome/esphome.git
synced 2024-11-30 18:54:14 +01:00
50 lines
1.8 KiB
YAML
50 lines
1.8 KiB
YAML
esp32_ble_server:
|
|
id: ble_server
|
|
manufacturer_data: [0x72, 0x4, 0x00, 0x23]
|
|
manufacturer: ESPHome
|
|
model: Test
|
|
on_connect:
|
|
- lambda: |-
|
|
ESP_LOGD("BLE", "Connection from %d", id);
|
|
on_disconnect:
|
|
- lambda: |-
|
|
ESP_LOGD("BLE", "Disconnection from %d", id);
|
|
services:
|
|
- uuid: 2a24b789-7aab-4535-af3e-ee76a35cc12d
|
|
advertise: false
|
|
characteristics:
|
|
- id: test_notify_characteristic
|
|
description: "Notify characteristic"
|
|
uuid: cad48e28-7fbe-41cf-bae9-d77a6c233423
|
|
read: true
|
|
notify: true
|
|
value: [9, 9, 9]
|
|
descriptors:
|
|
- uuid: cad48e28-7fbe-41cf-bae9-d77a6c111111
|
|
value: 123.1
|
|
byte_length: 100
|
|
- uuid: 2a24b789-7a1b-4535-af3e-ee76a35cc42d
|
|
advertise: false
|
|
characteristics:
|
|
- id: test_change_characteristic
|
|
uuid: 2a24b789-7a1b-4535-af3e-ee76a35cc11c
|
|
read: true
|
|
value: "Initial"
|
|
description: "Change characteristic"
|
|
descriptors:
|
|
- uuid: 0x2312
|
|
value: 0x12
|
|
on_write:
|
|
- lambda: |-
|
|
ESP_LOGD("BLE", "Descriptor received: %s from %d", std::string(x.begin(), x.end()).c_str(), id);
|
|
- uuid: 2a24b789-7a1b-4535-af3e-ee76a35cc99a
|
|
write: true
|
|
on_write:
|
|
then:
|
|
- lambda: |-
|
|
ESP_LOGD("BLE", "Characteristic received: %s from %d", std::string(x.begin(), x.end()).c_str(), id);
|
|
- ble_server.characteristic.set_value:
|
|
id: test_change_characteristic
|
|
value: !lambda 'return ByteBuffer::wrap({0x00, 0x01, 0x02});'
|
|
- ble_server.characteristic.notify:
|
|
id: test_notify_characteristic
|