|
ESPHome 2025.12.0-dev
|
Global registry for Controllers to receive entity state updates. More...
#include <controller_registry.h>
Static Protected Attributes | |
| static StaticVector< Controller *, CONTROLLER_REGISTRY_MAX > | controllers |
Global registry for Controllers to receive entity state updates.
This singleton registry allows Controllers (APIServer, WebServer) to receive entity state change notifications without storing per-entity callbacks.
Instead of each entity maintaining controller callbacks (32 bytes overhead per entity), entities call ControllerRegistry::notify_*_update() which iterates the small list of registered controllers (typically 2: API and WebServer).
Controllers read state directly from entities using existing accessors (obj->state, etc.) rather than receiving it as callback parameters that were being ignored anyway.
Memory savings: 32 bytes per entity (2 controllers × 16 bytes std::function overhead) Typical config (25 entities): ~780 bytes saved Large config (80 entities): ~2,540 bytes saved
Definition at line 150 of file controller_registry.h.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Register a controller to receive entity state updates.
Controllers should call this in their setup() method. Typically only APIServer and WebServer register.
Definition at line 11 of file controller_registry.cpp.
|
staticprotected |
Definition at line 240 of file controller_registry.h.