mirror of
https://github.com/esphome/esphome.git
synced 2025-11-02 16:11:53 +00:00
Compare commits
2 Commits
fan_no_dou
...
fix-packag
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fdcbe0687 | ||
|
|
56c5d272ed |
@@ -77,6 +77,9 @@ void BLESensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t ga
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->node_state = espbt::ClientState::ESTABLISHED;
|
this->node_state = espbt::ClientState::ESTABLISHED;
|
||||||
|
// For non-notify characteristics, trigger an immediate read after service discovery
|
||||||
|
// to avoid peripherals disconnecting due to inactivity
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ void BLETextSensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->node_state = espbt::ClientState::ESTABLISHED;
|
this->node_state = espbt::ClientState::ESTABLISHED;
|
||||||
|
// For non-notify characteristics, trigger an immediate read after service discovery
|
||||||
|
// to avoid peripherals disconnecting due to inactivity
|
||||||
|
this->update();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -318,7 +318,8 @@ def preload_core_config(config, result) -> str:
|
|||||||
target_platforms = []
|
target_platforms = []
|
||||||
|
|
||||||
for domain in config:
|
for domain in config:
|
||||||
if domain.startswith("."):
|
# Skip package keys which may contain periods (e.g., "ratgdo.esphome")
|
||||||
|
if "." in domain:
|
||||||
continue
|
continue
|
||||||
if _is_target_platform(domain):
|
if _is_target_platform(domain):
|
||||||
target_platforms += [domain]
|
target_platforms += [domain]
|
||||||
|
|||||||
@@ -476,6 +476,55 @@ def test_preload_core_config_multiple_platforms(setup_core: Path) -> None:
|
|||||||
preload_core_config(config, result)
|
preload_core_config(config, result)
|
||||||
|
|
||||||
|
|
||||||
|
def test_preload_core_config_skips_package_keys_with_periods(setup_core: Path) -> None:
|
||||||
|
"""Test preload_core_config skips package keys containing periods.
|
||||||
|
|
||||||
|
Package keys can contain periods (e.g., "ratgdo.esphome") and should be
|
||||||
|
skipped when searching for target platforms to avoid triggering the
|
||||||
|
assertion in get_component() that component names cannot contain periods.
|
||||||
|
|
||||||
|
Regression test for: https://github.com/esphome/esphome/issues/11182
|
||||||
|
"""
|
||||||
|
config = {
|
||||||
|
CONF_ESPHOME: {
|
||||||
|
CONF_NAME: "test_device",
|
||||||
|
},
|
||||||
|
"esp32": {},
|
||||||
|
# Package key with period should be ignored
|
||||||
|
"ratgdo.esphome": "github://ratgdo/esphome-ratgdo/v32disco_secplusv1.yaml",
|
||||||
|
}
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
# Should not raise AssertionError from get_component()
|
||||||
|
platform = preload_core_config(config, result)
|
||||||
|
|
||||||
|
assert platform == "esp32"
|
||||||
|
assert CORE.name == "test_device"
|
||||||
|
|
||||||
|
|
||||||
|
def test_preload_core_config_skips_keys_starting_with_period(setup_core: Path) -> None:
|
||||||
|
"""Test preload_core_config skips keys starting with period.
|
||||||
|
|
||||||
|
Keys starting with "." are special ESPHome internal keys and should be
|
||||||
|
skipped when searching for target platforms.
|
||||||
|
"""
|
||||||
|
config = {
|
||||||
|
CONF_ESPHOME: {
|
||||||
|
CONF_NAME: "test_device",
|
||||||
|
},
|
||||||
|
"esp8266": {},
|
||||||
|
# Internal key starting with period should be ignored
|
||||||
|
".platformio_options": {"board_build.flash_mode": "dout"},
|
||||||
|
}
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
# Should not raise any errors
|
||||||
|
platform = preload_core_config(config, result)
|
||||||
|
|
||||||
|
assert platform == "esp8266"
|
||||||
|
assert CORE.name == "test_device"
|
||||||
|
|
||||||
|
|
||||||
def test_include_file_header(tmp_path: Path, mock_copy_file_if_changed: Mock) -> None:
|
def test_include_file_header(tmp_path: Path, mock_copy_file_if_changed: Mock) -> None:
|
||||||
"""Test include_file adds include statement for header files."""
|
"""Test include_file adds include statement for header files."""
|
||||||
src_file = tmp_path / "source.h"
|
src_file = tmp_path / "source.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user