1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 08:15:49 +00:00

[core] Implement Global Controller Registry to reduce RAM usage (#11772)

This commit is contained in:
J. Nick Koston
2025-11-09 17:34:08 -06:00
committed by GitHub
parent 1dabe83d04
commit 7abb6d4998
33 changed files with 583 additions and 198 deletions

View File

@@ -1,4 +1,6 @@
#include "binary_sensor.h"
#include "esphome/core/defines.h"
#include "esphome/core/controller_registry.h"
#include "esphome/core/log.h"
namespace esphome {
@@ -37,6 +39,9 @@ void BinarySensor::send_state_internal(bool new_state) {
// Note that set_state_ de-dups and will only trigger callbacks if the state has actually changed
if (this->set_state_(new_state)) {
ESP_LOGD(TAG, "'%s': New state is %s", this->get_name().c_str(), ONOFF(new_state));
#if defined(USE_BINARY_SENSOR) && defined(USE_CONTROLLER_REGISTRY)
ControllerRegistry::notify_binary_sensor_update(this);
#endif
}
}