diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 85465e085c9e1d..5d73961ad1b233 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -520,12 +520,6 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) status = setOnOffValue(endpoint, onOffValueForStartUp, true); } -#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS - // Registers Scene handlers for the On/Off cluster on the server - app::Clusters::ScenesManagement::ScenesServer::Instance().RegisterSceneHandler(endpoint, - OnOffServer::Instance().GetSceneHandler()); -#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS - #ifdef MATTER_DM_PLUGIN_MODE_SELECT // If OnMode is not a null value, then change the current mode to it. if (onOffValueForStartUp && emberAfContainsServer(endpoint, ModeSelect::Id) && @@ -542,6 +536,12 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) } #endif // IGNORE_ON_OFF_CLUSTER_START_UP_ON_OFF +#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS + // Registers Scene handlers for the On/Off cluster on the server + app::Clusters::ScenesManagement::ScenesServer::Instance().RegisterSceneHandler(endpoint, + OnOffServer::Instance().GetSceneHandler()); +#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS + emberAfPluginOnOffClusterServerPostInitCallback(endpoint); }