The structural mass of a building provides inherent thermal storage capability. Through sector coupling, the building mass can provide additional flexibility to the electric power system, using, for instance, combined heat and power plants or power-to-heat. In this work, a mathematical model of building inertia thermal energy storage (BITES) for integration into optimized smart grid control is introduced. It is shown how necessary model parameters can be obtained using generalized additive modeling (GAM) based on measurable building data. For this purpose, it is demonstrated that the ceiling surface temperature can serve as a proxy for the current state of energy. This allows for real-world implementation using only temperature sensors as additionally required hardware. Compared with linear modeling, GAM enable improved modeling of the nonlinear characteristics and interactions of external factors influencing the storage operation. Two case studies demonstrate the potential of using building storage as part of a virtual power plant (VPP) for optimized smart grid control. In the first case study, BITES is compared with conventionally used hot water tanks, revealing economic benefits for both the VPP and building operator. The second case study investigates the potential for savings in CO$_2$ emission and grid connection capacity. It shows similar benefits when using BITES compared to using battery storage, without the need for hardware investment. Given the ubiquity of buildings and the recent advances in building control systems, BITES offers great potential as an additional source of flexibility to the low-carbon energy systems of the future.