Let the on/off switch on a wide tile switch, instead of sending the opposite of what it shows (0.2.86)

A tap on the On/off switch of a wide or full-page tile moved the knob to on
and back, and the light stayed off. Since firmware 0.2.59 control_event drew
the new position first (Tile::optimistic writes it into state) and then asked
key_action for the action, which read that new position: an off light got
light.turn_off, an on light light.turn_on. A tap on the tile itself was never
affected.

tile_controls::press_key chooses the action first and then shows the new
position; control_event uses it. Unit tests cover a light, a fan, a sensor
and a cover key.

Checked with tools/check.sh (471 Python tests, 19/19 C++) and compiled for
both boards: CYD 1,677,504 B (91.4 %, +16 B), Guition 2,054,640 B (25.3 %).
On Max's Guition Wallbox (OTA from this branch) every tap on the switch sent
the right action and Home Assistant's logbook followed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-19 08:15:50 +02:00
parent 311fa2a7fd
commit 2d343a450f
8 changed files with 103 additions and 5 deletions
+7
View File
@@ -1,3 +1,10 @@
## 0.2.86 (firmware 0.2.72)
The on/off switch on a wide tile switches again.
- **The switch on a wide or full-page tile does what it shows.** Since firmware 0.2.59 (app 0.2.70), a tap on the *On/off switch* of a wide card sent the opposite of what it showed. The knob moved to on, but the screen asked Home Assistant to turn the light *off*. The light already was off, so nothing happened, and a moment later the knob slid back. On a light that was on, the same happened the other way round. The switch drew its new position before it chose the action, and then chose from that new position; it now chooses first. A tap on the tile itself was never affected. This fixes lights, switches, input booleans and fans. The switch is what a wide tile of these shows unless you choose another control, so most wide tiles of them had it.
- Needs firmware 0.2.72: press **Update** on the screen. Includes everything from 0.2.85. CYD firmware: 1,677,504 bytes, 91.4 % of the update slot (16 bytes more than 0.2.85).
## 0.2.85 (firmware 0.2.71)
Off looks off on every tile, in Home Assistant's colours.
+1 -1
View File
@@ -37,7 +37,7 @@ WEEKDAYS = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su']
REPO = 'https://github.com/MaxGramser/homeassistant_espscreen'
REFS = {'cyd': 'main', 'guition': 'main'}
# Firmware shipped with this app release; screens below it get an update offer.
FIRMWARE_VERSION = '0.2.71'
FIRMWARE_VERSION = '0.2.72'
# The Auto standby switch a screen offers Home Assistant automations.
AUTO_STANDBY_MIN_FIRMWARE = '0.2.41'
# The settings page the screen opens itself, and the screen.settings tile that opens it.
+1 -1
View File
@@ -1,5 +1,5 @@
name: ESP Screen Manager
version: "0.2.85"
version: "0.2.86"
slug: esp_screen_manager
description: Choose tiles for your CYD and Guition touchscreen, without reflashing.
url: https://github.com/MaxGramser/homeassistant_espscreen