Make daily traffic scale to dozens of screens: incremental sync, ping keepalive, one action per message (0.2.39)

App 0.2.39 / firmware 0.2.33, items 1, 2, 4, 5 and 6 of the 30-screen scaling check.

- Only the tiles (and top bar) of changed entities are rebuilt; the screen list is
  cached until the registry or a screen diagnostic changes; the SSE stream follows.
- Sensor history comes from one recorder/statistics_during_period call per window in
  a background task, with the REST history as fallback per sensor without statistics.
- Firmware 0.2.33 answers a keepalive ping with its layout revision; a mismatch or a
  restart asks for the layout again, everything is repeated hourly as a safety net.
- The screen_message API action takes one whole message; the text inbox chunks stay
  as fallback for older firmware. A repeated unchanged layout keeps the inbox state.
- Quiet diagnostics: Opgestart (uptime as timestamp) replaces Uptime, heap every
  5 min, setting numbers publish only on change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-14 21:06:45 +02:00
parent 3f6889f750
commit f60eed3ff6
18 changed files with 990 additions and 147 deletions
+25 -9
View File
@@ -58,7 +58,7 @@
############################################################
substitutions:
SCREEN_FIRMWARE_VERSION: "0.2.32"
SCREEN_FIRMWARE_VERSION: "0.2.33"
# A tap survives a finger that drifts up to this far (320 px over 58 mm: 1 cm); further is a swipe.
TOUCH_MOVE_LIMIT_PX: "56"
# Shortest contact that counts as a tap; a resistive panel bounces, a capacitive one does not.
@@ -1073,6 +1073,13 @@ api:
- script.execute:
id: alert_dismiss
reason: "remote"
# ESP Screen Manager 0.2.39+ hands a whole tile message over in one call instead of
# base64 chunks in the text inbox; the inbox keeps showing the result.
- action: screen_message
variables:
message: string
then:
- lambda: 'id(dashboard_inbox).publish_state(runtime_tiles::receive(message));'
encryption:
key: !secret api_encryption_key
@@ -1549,7 +1556,8 @@ font:
# Geheugen zichtbaar maken: dit bord heeft geen PSRAM, dus de vrije heap
# bepaalt hoeveel UI erbij kan. Verschijnt ook als entity in Home Assistant.
debug:
update_interval: 30s
# Heap figures every five minutes: enough to spot a leak, few recorder rows.
update_interval: 300s
sensor:
- platform: debug
@@ -1568,10 +1576,13 @@ sensor:
name: "Wifi Signal"
update_interval: 600s
# When the screen booted, as a timestamp: one value per boot instead of a new recorder
# row every 15 s. A new entity on purpose: Home Assistant keeps the old Uptime's unit
# "s" in its registry and would refuse a timestamp under that name.
- platform: uptime
name: "Uptime"
id: uptime_s
update_interval: 15s
type: timestamp
name: "Opgestart"
id: boot_time
- platform: homeassistant
id: tile1_brightness
@@ -5326,6 +5337,11 @@ script:
if (settings.show_clock) lv_obj_clear_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
else lv_obj_add_flag(id(lbl_time), LV_OBJ_FLAG_HIDDEN);
}
// The four setting entities only publish a changed value (HA keeps identical states anyway).
if (id(setting_brightness).state != settings.brightness) id(setting_brightness).publish_state(settings.brightness);
if (id(setting_standby_brightness).state != settings.standby_brightness) id(setting_standby_brightness).publish_state(settings.standby_brightness);
if (id(setting_night_brightness).state != settings.night_brightness) id(setting_night_brightness).publish_state(settings.night_brightness);
if (id(setting_standby_seconds).state != settings.standby_seconds) id(setting_standby_seconds).publish_state(settings.standby_seconds);
if (!id(ui_refresh).is_running()) id(ui_refresh).execute();
- id: close_cards
@@ -6927,7 +6943,7 @@ number:
max_value: 100
step: 1
unit_of_measurement: "%"
update_interval: 2s
update_interval: never
lambda: return screen_settings::current.brightness;
set_action:
- lambda: |-
@@ -6946,7 +6962,7 @@ number:
max_value: 100
step: 1
unit_of_measurement: "%"
update_interval: 2s
update_interval: never
lambda: return screen_settings::current.standby_brightness;
set_action:
- lambda: |-
@@ -6965,7 +6981,7 @@ number:
max_value: 100
step: 1
unit_of_measurement: "%"
update_interval: 2s
update_interval: never
lambda: return screen_settings::current.night_brightness;
set_action:
- lambda: |-
@@ -6984,7 +7000,7 @@ number:
max_value: 86400
step: 60
unit_of_measurement: "s"
update_interval: 2s
update_interval: never
lambda: return screen_settings::current.standby_seconds;
set_action:
- lambda: |-