Merge branch 'entity_dupe_code' into integration

This commit is contained in:
J. Nick Koston 2025-07-15 20:02:45 -10:00
commit 8fcbcebf84
No known key found for this signature in database
4 changed files with 4 additions and 32 deletions

View File

@ -277,34 +277,6 @@ class APIConnection : public APIServerConnection {
// Helper function to handle authentication completion
void complete_authentication_();
// Helper function to fill common entity info fields
static void fill_entity_info_base(esphome::EntityBase *entity, InfoResponseProtoMessage &response) {
// Set common fields that are shared by all entity types
response.key = entity->get_object_id_hash();
response.object_id = entity->get_object_id();
if (entity->has_own_name())
response.name = entity->get_name();
// Set common EntityBase properties
#ifdef USE_ENTITY_ICON
response.icon = entity->get_icon();
#endif
response.disabled_by_default = entity->is_disabled_by_default();
response.entity_category = static_cast<enums::EntityCategory>(entity->get_entity_category());
#ifdef USE_DEVICES
response.device_id = entity->get_device_id();
#endif
}
// Helper function to fill common entity state fields
static void fill_entity_state_base(esphome::EntityBase *entity, StateResponseProtoMessage &response) {
response.key = entity->get_object_id_hash();
#ifdef USE_DEVICES
response.device_id = entity->get_device_id();
#endif
}
// Non-template helper to encode any ProtoMessage
static uint16_t encode_message_to_buffer(ProtoMessage &msg, uint8_t message_type, APIConnection *conn,
uint32_t remaining_size, bool is_single);

View File

@ -176,7 +176,7 @@ void SSD1306::setup() {
// Disable scrolling mode (0x2E)
this->command(SSD1306_COMMAND_DEACTIVATE_SCROLL);
// Contrast and brighrness
// Contrast and brightness
// SSD1306 does not have brightness setting
set_contrast(this->contrast_);
if (this->is_ssd1305_())

View File

@ -41,7 +41,7 @@ async def test_host_mode_api_password(
# Wait for at least one state with timeout
try:
await asyncio.wait_for(state_future, timeout=5.0)
except asyncio.TimeoutError:
except TimeoutError:
pytest.fail("No states received within timeout")
# Should have received at least one state (the test sensor)

View File

@ -65,13 +65,13 @@ async def test_runtime_stats(
# Wait for first "Total stats" log (should happen at 1s)
try:
await asyncio.wait_for(first_stats_future, timeout=5.0)
except asyncio.TimeoutError:
except TimeoutError:
pytest.fail("First 'Total stats' log not seen within 5 seconds")
# Wait for second "Total stats" log (should happen at 2s)
try:
await asyncio.wait_for(second_stats_future, timeout=5.0)
except asyncio.TimeoutError:
except TimeoutError:
pytest.fail(f"Second 'Total stats' log not seen. Total seen: {stats_count}")
# Verify we got at least 2 stats logs