Grey out what Home Assistant calls off and colour the rest like Home Assistant, so an airco that is off no longer looks on (0.2.85)

The airco tile stayed orange while the airco was off. The firmware kept its own
short list of what turns grey and gave an off climate Home Assistant's orange,
but Home Assistant has no colour for a climate that is off: its cards fall back
to the inactive grey. Other tiles had the same fault: an off fan, a closed
blind, a docked robot, a player in standby, an idle script, a paused timer and
a camera that isn't streaming all kept their colour.

Tile::active() is now a port of the frontend's stateActive() for the domains a
tile can show, and every tile that is not active is grey. An airco that is off
reads Off, with the room's temperature when the device reports one, as Home
Assistant's tile does. tile_controls::accent() follows stateColorCss(): alarm
binary sensors red, a battery green, orange or red by its charge, a running
script or timer and a streaming camera amber, the weather per condition, the
sun amber and indigo, someone in a zone blue. Scenes, selects, numbers and
sensors keep their own colour per kind. A full-page tile lights up only for
tiles that can be off (Tile::lights_up), and a closed blind's slider keeps its
colour. The top bar's alarm classes are Home Assistant's eleven.

Checked with tools/check.sh (471 Python tests, 19/19 C++ with 58 state cases
and every colour rule) and compiled for both boards: CYD 1,677,488 B (91.4 %,
+576 B), Guition 2,054,640 B (25.3 %).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Max Gramser
2026-09-18 23:31:10 +02:00
parent d76461d774
commit 9391d1b0ac
16 changed files with 369 additions and 69 deletions
+15 -12
View File
@@ -201,19 +201,22 @@ inline uint32_t outline(uint32_t own) {
// What a state looks like in Home Assistant's frontend (its --state-*-color and --*-color variables), the same in both
// looks: an amber light is amber at night too. They are data, drawn through state(), foreground(), tint() and icon().
namespace ha {
constexpr uint32_t AMBER = 0xFFC107; // a light, switch or binary sensor that is on; lux
constexpr uint32_t ORANGE = 0xFF9800; // the sun above the horizon, a paused timer or robot, drying
constexpr uint32_t AMBER = 0xFFC107; // on: a light, switch, running script or timer, streaming camera; the sun; lux
constexpr uint32_t ORANGE = 0xFF9800; // a paused robot, drying, a battery half full, the sun path by day
constexpr uint32_t DEEP_ORANGE = 0xFF6F22; // temperature, heating
constexpr uint32_t RED = 0xF44336; // a robot in trouble
constexpr uint32_t PURPLE = 0x926BC7; // covers, scenes and scripts, energy
constexpr uint32_t DEEP_PURPLE = 0x6E41AB; // a clear night, the sun below the horizon
constexpr uint32_t INDIGO = 0x3F51B5; // selects
constexpr uint32_t BLUE = 0x2196F3; // cooling, a robot on its way back, the settings card, everything else
constexpr uint32_t LIGHT_BLUE = 0x03A9F4; // media players, the weather
constexpr uint32_t CYAN = 0x00BCD4; // fans
constexpr uint32_t TEAL = 0x009688; // numbers, percentages, a running timer, a robot at work
constexpr uint32_t GREEN = 0x4CAF50; // someone at home, auto mode
constexpr uint32_t GREY = 0x9E9E9E; // anything off or away
constexpr uint32_t RED = 0xF44336; // an alarm going off, a robot in trouble, an empty battery
constexpr uint32_t PURPLE = 0x926BC7; // covers, scenes, energy
constexpr uint32_t DEEP_PURPLE = 0x6E41AB; // a clear night
constexpr uint32_t INDIGO = 0x3F51B5; // selects, the sun below the horizon, pouring rain
constexpr uint32_t BLUE = 0x2196F3; // cooling, rain, a robot on its way back, someone in a zone, everything else
constexpr uint32_t LIGHT_BLUE = 0x03A9F4; // media players, sleet
constexpr uint32_t CYAN = 0x00BCD4; // fans, hail
constexpr uint32_t TEAL = 0x009688; // numbers, percentages, a robot at work
constexpr uint32_t GREEN = 0x4CAF50; // someone at home, auto mode, wind, a full battery
constexpr uint32_t GREY = 0x9E9E9E; // anything off or away, fog
// The rest of the weather, as Home Assistant colours a condition (--state-weather-*-color): clouds, a partly
// cloudy sky, lightning, lightning with rain, and snow, which Home Assistant writes as a value of its own.
constexpr uint32_t LIGHT_GREY = 0xBDBDBD, BLUE_GREY = 0x607D8B, YELLOW = 0xFFEB3B, LIME = 0xCDDC39, ICE = 0xC0E0FF;
constexpr uint32_t SKY = 0x00A6ED; // a robot that is docked or idle
constexpr uint32_t SWITCH_ON = 0xFFB900; // the switch on a history card while on
constexpr uint32_t PURPLE_PRESSED = 0x7552A8; // a chosen cover key under a finger