mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
Platform-split ble_client codegen and gate the raw-gattc node family
This commit is contained in:
@@ -19,9 +19,21 @@ from esphome.const import (
|
||||
CONF_NOTIFY,
|
||||
CONF_SERVICE_UUID,
|
||||
CONF_TYPE,
|
||||
KEY_CORE,
|
||||
KEY_TARGET_PLATFORM,
|
||||
PLATFORM_ESP32,
|
||||
)
|
||||
from esphome.core import CORE
|
||||
from esphome.types import ConfigType
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def esp32_platform() -> None:
|
||||
# The node platforms gate on only_on_esp32 now (the neutral engine has no
|
||||
# raw-gattc nodes); these schema tests exercise the esp32 arm.
|
||||
CORE.data.setdefault(KEY_CORE, {})[KEY_TARGET_PLATFORM] = PLATFORM_ESP32
|
||||
|
||||
|
||||
DESCRIPTOR_CONFIG: ConfigType = {
|
||||
CONF_NAME: "test",
|
||||
CONF_SERVICE_UUID: "6E400001-B5A3-F393-E0A9-E50E24DCCA9E",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
ble_client:
|
||||
- mac_address: 01:02:03:04:05:06
|
||||
id: test_blec
|
||||
on_connect:
|
||||
then:
|
||||
- ble_client.ble_write:
|
||||
id: test_blec
|
||||
service_uuid: '1802'
|
||||
characteristic_uuid: '2a06'
|
||||
value: [0x04, 0x05, 0x06]
|
||||
on_disconnect:
|
||||
then:
|
||||
- ble_client.disconnect: test_blec
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
name: Connect button
|
||||
on_press:
|
||||
- ble_client.connect: test_blec
|
||||
- ble_client.ble_write:
|
||||
id: test_blec
|
||||
service_uuid: '1802'
|
||||
characteristic_uuid: '2a06'
|
||||
value: !lambda return {0x01, 0x02};
|
||||
@@ -0,0 +1,6 @@
|
||||
# The neutral engine: the BTstack backend and rp2040_ble come in through
|
||||
# bluetooth_connection's auto-load; the tracker hub supplies the sightings.
|
||||
packages:
|
||||
common: !include common-gatt.yaml
|
||||
|
||||
rp2_ble_tracker:
|
||||
Reference in New Issue
Block a user