Take what a tile can do, its tap actions, words and icons from Home Assistant (0.2.67)

GitHub issue #7 asked for cover.toggle on tap. ESP Screens now asks Home
Assistant which actions each entity has instead of keeping lists: the editor
offers On / off (covers included), sliders, controls and displays only where
Home Assistant has the action, and refuses only new unsupported settings.
Perform action runs any action Home Assistant offers for the tile's entity,
under its own names and fields; the screen sends it with a call id and says
Refused when Home Assistant refuses. Sensors round by display precision, and
tiles, the top bar, timelines, vacuum chips and the inspector use Home
Assistant's words where they showed raw states. Tiles show Home Assistant's
icons, picked as its frontend does (the fonts grow to 309 glyphs).

Existing screens keep every setting and tap as before: stored layouts load
leniently, legacy taps route the same (1020 combinations), and messages are
byte-identical without Home Assistant's words and icons. Firmware 0.2.58.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-17 15:23:03 +02:00
parent d60a0f122b
commit 6809d3b941
32 changed files with 3210 additions and 105 deletions
+9 -3
View File
@@ -103,9 +103,15 @@ class Firmware(unittest.TestCase):
def test_a_tap_on_a_cover_opens_the_cover_card(self):
event = RUNTIME[RUNTIME.index('inline void event(lv_event_t *event) {'):]
event = event[:event.index('\n}\n')]
show = re.search(r'if\(d=="sensor" \|\|.*?show_detail\(w\.index\); return; \}', event)
self.assertTrue(show and 'd=="cover"' in show[0], 'covers go to show_detail with the other runtime cards')
self.assertIn('if (d == "light" || d == "climate" || d == "vacuum" || d == "fan") {', event, 'not to the board\'s value overlay any more')
# Since firmware 0.2.58 tile_controls::tap_route decides and event() carries the route out.
controls = (ROOT / 'components/smart_display/tile_controls.h').read_text()
cards = controls[controls.index('inline bool runtime_card_domain('):]
cards = cards[:cards.index('\n}\n')]
self.assertIn('d == "cover"', cards, 'covers go to show_detail with the other runtime cards')
self.assertIn('if (runtime_card_domain(d)) return {TapRoute::CARD, "", true};', controls)
self.assertIn('return d == "light" || d == "climate" || d == "fan" ? Tap{TapRoute::OVERLAY', controls, 'not to the board\'s value overlay any more')
self.assertIn('case tile_controls::TapRoute::CARD:', event)
self.assertIn('show_detail(w.index);', event)
self.assertIn('}else if(d=="cover"){', RUNTIME)
self.assertIn('render_cover_detail(t,large,width,height,pad);', RUNTIME)
for name, text in PROFILES.items():