mirror of
https://github.com/esphome/esphome.git
synced 2026-02-18 15:35:59 -07:00
cover
This commit is contained in:
@@ -38,6 +38,7 @@ async def test_api_custom_services(
|
||||
custom_service_future = loop.create_future()
|
||||
custom_args_future = loop.create_future()
|
||||
custom_arrays_future = loop.create_future()
|
||||
ha_state_future = loop.create_future()
|
||||
|
||||
# Patterns to match in logs
|
||||
yaml_service_pattern = re.compile(r"YAML service called")
|
||||
@@ -50,6 +51,9 @@ async def test_api_custom_services(
|
||||
custom_arrays_pattern = re.compile(
|
||||
r"Array service called with 2 bools, 3 ints, 2 floats, 2 strings"
|
||||
)
|
||||
ha_state_pattern = re.compile(
|
||||
r"This subscription uses std::string API for backward compatibility"
|
||||
)
|
||||
|
||||
def check_output(line: str) -> None:
|
||||
"""Check log output for expected messages."""
|
||||
@@ -65,6 +69,8 @@ async def test_api_custom_services(
|
||||
custom_args_future.set_result(True)
|
||||
elif not custom_arrays_future.done() and custom_arrays_pattern.search(line):
|
||||
custom_arrays_future.set_result(True)
|
||||
elif not ha_state_future.done() and ha_state_pattern.search(line):
|
||||
ha_state_future.set_result(True)
|
||||
|
||||
# Run with log monitoring
|
||||
async with (
|
||||
@@ -198,3 +204,8 @@ async def test_api_custom_services(
|
||||
},
|
||||
)
|
||||
await asyncio.wait_for(custom_arrays_future, timeout=5.0)
|
||||
|
||||
# Test Home Assistant state subscription (std::string API backward compatibility)
|
||||
# This verifies that custom_api_device.h can still use std::string overloads
|
||||
client.send_home_assistant_state("sensor.custom_test", "", "42.5")
|
||||
await asyncio.wait_for(ha_state_future, timeout=5.0)
|
||||
|
||||
Reference in New Issue
Block a user