mirror of
https://github.com/esphome/esphome.git
synced 2026-09-23 04:58:38 +00:00
[core] Implement Global Controller Registry to reduce RAM usage (#11772)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "switch.h"
|
||||
#include "esphome/core/defines.h"
|
||||
#include "esphome/core/controller_registry.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
@@ -62,6 +64,9 @@ void Switch::publish_state(bool state) {
|
||||
|
||||
ESP_LOGD(TAG, "'%s': Sending state %s", this->name_.c_str(), ONOFF(this->state));
|
||||
this->state_callback_.call(this->state);
|
||||
#if defined(USE_SWITCH) && defined(USE_CONTROLLER_REGISTRY)
|
||||
ControllerRegistry::notify_switch_update(this);
|
||||
#endif
|
||||
}
|
||||
bool Switch::assumed_state() { return false; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user