diff --git a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp index 9fe08e89078cf1..200738a65a21a2 100644 --- a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp +++ b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp @@ -44,6 +44,11 @@ CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Init() return CHIP_NO_ERROR; } +void ElectricalEnergyMeasurementAttrAccess::Shutdown() +{ + unregisterAttributeAccessOverride(this); +} + CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) { diff --git a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h index 93a107caf695dc..fab4253356e203 100644 --- a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h +++ b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h @@ -44,7 +44,11 @@ class ElectricalEnergyMeasurementAttrAccess : public AttributeAccessInterface mFeature(aFeature) {} + ~ElectricalEnergyMeasurementAttrAccess() { Shutdown(); } + CHIP_ERROR Init(); + void Shutdown(); + CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override; private: