Files
Max Gramser 3e959b3df9 Put ESP Screens in English and keep layouts when entity IDs change (0.2.40)
Everything a user sees or reads is now English: both boards' labels,
status replies and logs, the ESP Screens editor and Alerts cheatsheet,
and the README and guides (docs/TILES.md, CALIBRATING.md, ACCEPTANCE.md
and TROUBLESHOOTING.md replace the Dutch file names). Labels follow
Home Assistant's own English names (Heat/Cool modes, Heating/Cooling
actions, Away, Returning to dock, weather conditions), dates use English
abbreviations and the top bar writes numbers the English way. Docs use
HA 2026.9's menu names (Settings -> Apps, App store, Settings -> Tools).
Unused legacy files (home-like.yaml, buttons.yaml, a.out) are removed.

Firmware 0.2.34 names its entities in English. Home Assistant registers
a renamed ESPHome entity under a new entity ID, so the inbox
text.<screen>_tegelinstellingen becomes text.<screen>_tile_settings and
the layout stored under the old ID would be lost. The manager now
recognises the screen by its device, during a run or after a restart,
and moves its layout and update history along; the Update button and
the nightly round follow the screen through the rename. Screens that
still run 0.2.33 or older keep working: both languages are matched.

Main is the only release branch from now on.

Tested on a Home Assistant Yellow (HA 2026.9.1) with both bench boards:
see docs/TEST_RESULTS_0240.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 02:08:43 +02:00

53 lines
2.4 KiB
Python

"""Verify invalid runtime commands are rejected by an actual screen; no HA actions."""
import argparse
import asyncio
import base64
import json
from pathlib import Path
import secrets
import yaml
from aioesphomeapi import APIClient, TextInfo, TextState
async def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--host', required=True)
parser.add_argument('--name', required=True)
parser.add_argument('--secrets', type=Path, default=Path(__file__).resolve().parents[1] / 'secrets.yaml')
args = parser.parse_args()
key = yaml.safe_load(args.secrets.read_text())['api_encryption_key']
client = APIClient(args.host, 6053, noise_psk=key, expected_name=args.name, client_info='Runtime protocol test')
await client.connect(login=True)
try:
entities, _ = await client.list_entities_services()
# Firmware built before the English translation still names this entity in Dutch.
inbox = next(e for e in entities if isinstance(e, TextInfo) and e.name in ('Tile settings', 'Tegelinstellingen'))
assert inbox.max_length == 255
queue = asyncio.Queue()
client.subscribe_states(lambda s: queue.put_nowait(s.state) if isinstance(s, TextState) and s.key == inbox.key else None)
messages = [
{'v': 99, 'op': 'layout', 'title': 'Rejected', 'entities': []},
{'v': 1, 'op': 'layout', 'title': 'Rejected', 'entities': ['lock.not_allowed']},
{'v': 1, 'op': 'state', 'i': 99, 'entity': 'light.not_a_slot', 'a': {}},
]
for message in messages:
encoded = base64.b64encode(json.dumps(message).encode()).decode()
assert len(encoded) <= 200
client.text_command(inbox.key, secrets.token_hex(6) + '|0|1|' + encoded)
while True:
ack = await asyncio.wait_for(queue.get(), 5)
if ack.startswith(('Error:', 'Fout:')):
print('PASS: rejected invalid command — ' + ack)
break
client.text_command(inbox.key, secrets.token_hex(6) + '|2|1|e30=')
while True:
ack = await asyncio.wait_for(queue.get(), 5)
if ack in ('Error: incomplete message', 'Fout: onvolledig bericht'):
print('PASS: missing chunks rejected')
break
finally:
await client.disconnect()
if __name__ == '__main__':
asyncio.run(main())