Skip to content

Commit

Permalink
Add tests for esp32_bt_classic & fix required Arduino framework version.
Browse files Browse the repository at this point in the history
  • Loading branch information
RoboMagus committed Apr 24, 2023
1 parent da6c1bd commit ee1c4e4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion esphome/components/esp32_bt_classic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
NO_BLUETOOTH_VARIANTS = [esp32_const.VARIANT_ESP32S2]

MIN_IDF_VERSION = cv.Version(4, 4, 4)
MIN_ARDUINO_VERSION = cv.Version(2, 0, 6)
MIN_ARDUINO_VERSION = cv.Version(2, 0, 5)

esp32_bt_classic_ns = cg.esphome_ns.namespace("esp32_bt_classic")
ESP32BtClassic = esp32_bt_classic_ns.class_("ESP32BtClassic", cg.Component)
Expand Down
47 changes: 47 additions & 0 deletions tests/test2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ mdns:
disabled: true

api:
services:
- service: scan_bt_devices
variables:
addresses: string[]
num_scans: int
then:
- bt_classic.bt_classic_scan:
mac_address: !lambda "return addresses;"
num_scans: !lambda "return num_scans;"

i2c:
sda: 21
Expand Down Expand Up @@ -77,6 +86,16 @@ output:
gate_pin: GPIO5
zero_cross_pin: GPIO12

button:
- platform: template
name: "BT Scan"
on_press:
- bt_classic.bt_classic_scan:
mac_address:
- a1:b2:c3:d4:e5:f6
- 1a:2b:3c:4d:5e:6f
num_scans: 5

sensor:
- platform: homeassistant
entity_id: sensor.hello_world
Expand Down Expand Up @@ -431,6 +450,14 @@ binary_sensor:
ibeacon_major: 100
ibeacon_minor: 1
name: BLE Test iBeacon Presence
- platform: bt_classic_presence
name: BT Classic Presence T1
mac_address: a1:b2:c3:d4:e5:f6
num_scans: 3
update_interval: 30s
- platform: bt_classic_presence
name: BT Classic Presence T2
mac_address: 1a:2b:3c:4d:5e:6f
- platform: esp32_touch
name: ESP32 Touch Pad GPIO27
pin: GPIO27
Expand Down Expand Up @@ -531,6 +558,26 @@ mopeka_ble:
bluetooth_proxy:
active: true

esp32_bt_classic:
on_scan_start:
- logger.log: "BT Classic Scan started."
on_scan_result:
- then:
- lambda: |-
ESP_LOGD("BT_SCAN_RESULT", "Unfiltered BT Classic scan result:");
ESP_LOGD("BT_SCAN_RESULT", " address: %s", address.c_str());
ESP_LOGD("BT_SCAN_RESULT", " name: %s", name);
ESP_LOGD("BT_SCAN_RESULT", " status: %s (%d)", status.c_str(), status.bt_status());
- mac_address:
- 11:22:33:44:55:66
- aa:bb:cc:dd:ee:ff
then:
- lambda: |-
ESP_LOGD("BT_SCAN_RESULT", "Filtered BT Classic scan result:");
ESP_LOGD("BT_SCAN_RESULT", " address: %s", address.c_str());
ESP_LOGD("BT_SCAN_RESULT", " name: %s", name);
ESP_LOGD("BT_SCAN_RESULT", " status: %s (%d)", status.c_str(), status.bt_status());
xiaomi_rtcgq02lm:
- id: motion_rtcgq02lm
mac_address: 01:02:03:04:05:06
Expand Down

0 comments on commit ee1c4e4

Please sign in to comment.