Energy Management in Homes and Residential Microgrids: Short-Term Scheduling and Long-Term Planning provides an in-depth exploration of Home Energy Management Systems (HEMS), with a focus on practical applications for both short- and long-term models. Through this guide, readers will learn how to create efficient systems that facilitate the integration of renewable energy into the grid and simultaneously manage end-users' energy consumption. The short-term operation of Home Energy Management Systems is analyzed through various lenses, including renewable energy integration, energy storage integration, uncertainty in parameters, off-grid operation, outages and events, resilience, electric vehicle integration, and battery swapping strategy.The modelling of these topics is explained with step-by-step instructions, and the parameters and implications are thoroughly discussed. Additionally, the book offers insight into the long-term expansion planning for residential microgrids, providing a detailed examination of dynamic modeling, control, and stability of these small-scale energy systems. Throughout the book, simple and advanced examples are provided, and each example comes with numerical data, detailed formulation, modelling, and simulation.