1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 15:12:06 +00:00

Merge remote-tracking branch 'upstream/dev' into integration

This commit is contained in:
J. Nick Koston
2025-10-28 14:19:15 -05:00
14 changed files with 365 additions and 55 deletions

View File

@@ -3,3 +3,52 @@ esp32_ble_tracker:
ble_client:
- mac_address: 01:02:03:04:05:06
id: test_blec
on_connect:
- ble_client.ble_write:
id: test_blec
service_uuid: "abcd1234-abcd-1234-abcd-abcd12345678"
characteristic_uuid: "abcd1235-abcd-1234-abcd-abcd12345678"
value: !lambda |-
return std::vector<uint8_t>{0x01, 0x02, 0x03};
- ble_client.ble_write:
id: test_blec
service_uuid: "abcd1234-abcd-1234-abcd-abcd12345678"
characteristic_uuid: "abcd1235-abcd-1234-abcd-abcd12345678"
value: [0x04, 0x05, 0x06]
on_passkey_request:
- ble_client.passkey_reply:
id: test_blec
passkey: !lambda |-
return 123456;
- ble_client.passkey_reply:
id: test_blec
passkey: 654321
on_numeric_comparison_request:
- ble_client.numeric_comparison_reply:
id: test_blec
accept: !lambda |-
return true;
- ble_client.numeric_comparison_reply:
id: test_blec
accept: false
sensor:
- platform: ble_client
ble_client_id: test_blec
type: characteristic
id: test_sensor_lambda
name: "BLE Sensor with Lambda"
service_uuid: "abcd1234-abcd-1234-abcd-abcd12345678"
characteristic_uuid: "abcd1236-abcd-1234-abcd-abcd12345678"
lambda: |-
if (x.size() >= 2) {
return (float)(x[0] | (x[1] << 8)) / 100.0;
}
return NAN;
- platform: ble_client
ble_client_id: test_blec
type: characteristic
id: test_sensor_no_lambda
name: "BLE Sensor without Lambda"
service_uuid: "abcd1234-abcd-1234-abcd-abcd12345678"
characteristic_uuid: "abcd1237-abcd-1234-abcd-abcd12345678"

View File

@@ -48,6 +48,11 @@ on_drayton:
- logger.log:
format: "on_drayton: %u %u %u"
args: ["x.address", "x.channel", "x.command"]
on_dyson:
then:
- logger.log:
format: "on_dyson: %u %u"
args: ["x.code", "x.index"]
on_gobox:
then:
- logger.log:

View File

@@ -6,6 +6,13 @@ button:
remote_transmitter.transmit_beo4:
source: 0x01
command: 0x0C
- platform: template
name: Dyson fan up
id: dyson_fan_up
on_press:
remote_transmitter.transmit_dyson:
code: 0x1215
index: 0x0
- platform: template
name: JVC Off
id: living_room_lights_on

View File

@@ -19,3 +19,41 @@ uart:
packet_transport:
- platform: uart
switch:
# Test uart switch with single state (array)
- platform: uart
name: "UART Switch Single Array"
uart_id: uart_uart
data: [0x01, 0x02, 0x03]
# Test uart switch with single state (string)
- platform: uart
name: "UART Switch Single String"
uart_id: uart_uart
data: "ON"
# Test uart switch with turn_on/turn_off (arrays)
- platform: uart
name: "UART Switch Dual Array"
uart_id: uart_uart
data:
turn_on: [0xA0, 0xA1, 0xA2]
turn_off: [0xB0, 0xB1, 0xB2]
# Test uart switch with turn_on/turn_off (strings)
- platform: uart
name: "UART Switch Dual String"
uart_id: uart_uart
data:
turn_on: "TURN_ON"
turn_off: "TURN_OFF"
button:
# Test uart button with array data
- platform: uart
name: "UART Button Array"
uart_id: uart_uart
data: [0xFF, 0xEE, 0xDD]
# Test uart button with string data
- platform: uart
name: "UART Button String"
uart_id: uart_uart
data: "BUTTON_PRESS"

View File

@@ -13,3 +13,21 @@ uart:
rx_buffer_size: 512
parity: EVEN
stop_bits: 2
switch:
- platform: uart
name: "UART Switch Array"
uart_id: uart_uart
data: [0x01, 0x02, 0x03]
- platform: uart
name: "UART Switch Dual"
uart_id: uart_uart
data:
turn_on: [0xA0, 0xA1]
turn_off: [0xB0, 0xB1]
button:
- platform: uart
name: "UART Button"
uart_id: uart_uart
data: [0xFF, 0xEE]

View File

@@ -849,39 +849,47 @@ def test_detect_memory_impact_config_no_components_with_tests(tmp_path: Path) ->
assert result["should_run"] == "false"
def test_detect_memory_impact_config_skips_base_bus_components(tmp_path: Path) -> None:
"""Test that base bus components (i2c, spi, uart) are skipped."""
def test_detect_memory_impact_config_includes_base_bus_components(
tmp_path: Path,
) -> None:
"""Test that base bus components (i2c, spi, uart) are included when directly changed.
Base bus components should be analyzed for memory impact when they are directly
changed, even though they are often used as dependencies. This ensures that
optimizations to base components (like using move semantics or initializer_list)
are properly measured.
"""
# Create test directory structure
tests_dir = tmp_path / "tests" / "components"
# i2c component (should be skipped as it's a base bus component)
i2c_dir = tests_dir / "i2c"
i2c_dir.mkdir(parents=True)
(i2c_dir / "test.esp32-idf.yaml").write_text("test: i2c")
# uart component (base bus component that should be included)
uart_dir = tests_dir / "uart"
uart_dir.mkdir(parents=True)
(uart_dir / "test.esp32-idf.yaml").write_text("test: uart")
# wifi component (should not be skipped)
# wifi component (regular component)
wifi_dir = tests_dir / "wifi"
wifi_dir.mkdir(parents=True)
(wifi_dir / "test.esp32-idf.yaml").write_text("test: wifi")
# Mock changed_files to return both i2c and wifi
# Mock changed_files to return both uart and wifi
with (
patch.object(determine_jobs, "root_path", str(tmp_path)),
patch.object(helpers, "root_path", str(tmp_path)),
patch.object(determine_jobs, "changed_files") as mock_changed_files,
):
mock_changed_files.return_value = [
"esphome/components/i2c/i2c.cpp",
"esphome/components/uart/automation.h", # Header file with inline code
"esphome/components/wifi/wifi.cpp",
]
determine_jobs._component_has_tests.cache_clear()
result = determine_jobs.detect_memory_impact_config()
# Should only include wifi, not i2c
# Should include both uart and wifi
assert result["should_run"] == "true"
assert result["components"] == ["wifi"]
assert "i2c" not in result["components"]
assert set(result["components"]) == {"uart", "wifi"}
assert result["platform"] == "esp32-idf" # Common platform
def test_detect_memory_impact_config_with_variant_tests(tmp_path: Path) -> None: