Keep every screen's Wi-Fi awake from the shared core, so Home Assistant's messages no longer wait for the router's next beacon (0.2.88)

packages/core.yaml sets wifi: power_save_mode: none. ESPHome merges it
under the screen's own wifi: block, which keeps the network, the password
and the hotspot, and the screen's own YAML still wins on the mode. The
YAML ESP Screens writes has had the line since app 0.2.24; screens with
an older or hand-written YAML ran ESPHome's ESP32 default light, and
their messages from Home Assistant waited 76-117 ms on the bench.

esphome config on the bench screens' Device Builder YAMLs: NONE for both
without a line of their own, LIGHT when the YAML says light. The bench
Guition, flashed from its Device Builder YAML: ping 15 ms average instead
of 117 ms. tools/check.sh: 474 Python tests (a new one keeps the core's
wifi: block to this one key), 19/19 C++, editor; firmware unchanged in
size (CYD 1,678,816 B, 91.5 %; Guition 2,055,280 B), since the checkout
profiles already had the line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-19 09:06:53 +02:00
parent ff9d3af9f8
commit fcdea12c44
11 changed files with 112 additions and 13 deletions
+15
View File
@@ -57,6 +57,21 @@ class PackageTests(unittest.TestCase):
block = re.search(r'^' + section + r':\n.*?(?=^[a-zA-Z_]+:|\Z)', text, re.M | re.S)
self.assertFalse(block and re.search(r'^ - platform: homeassistant$', block[0], re.M), f'{path.name}: a {section} subscribes to Home Assistant')
def test_the_wifi_never_dozes_but_stays_the_owners(self):
# Firmware 0.2.74+: the core keeps Wi-Fi awake for every screen, and nothing else of Wi-Fi lives in a package;
# the network, its password and the fallback hotspot stay in the screen's own YAML, which also wins on the mode.
for path in sorted((ROOT / 'packages').rglob('*.yaml')):
text = path.read_text()
block = re.search(r'^wifi:\n(.*?)(?=^[a-zA-Z_]+:|\Z)', text, re.M | re.S)
if path == profiles.CORE:
self.assertIsNotNone(block, 'packages/core.yaml has no wifi: block')
lines = [line for line in block[1].split('\n') if line.strip() and not line.lstrip().startswith('#')]
self.assertEqual(lines, [' power_save_mode: none'])
else:
self.assertIsNone(block, f'{path.name} has a wifi: block')
# The YAML ESP Screens writes says so too (since app 0.2.24), so an older package changes nothing for those.
self.assertIn(' power_save_mode: none\n', (ROOT / 'screen_manager/app/core.py').read_text())
def test_the_manual_profile_is_gone_from_profiles_and_packages(self):
for board, name in BOARDS.items():
for entry in (name, f'packages/{board}.yaml'):