New technologies, operational standards, and concepts have emerged in the smart grid era. One of these concepts is related to home energy management systems (HEMS). The main objective of HEMS is to efficiently monitor and manage generation, storage, and consumption in smart homes. Energy storage systems play a key role in HEMS, bringing flexibility to the smart home and improving the efficiency and reliability of renewable generation systems. Therefore, studies covering the optimized operation of batteries in HEMS are highly required. From this perspective, it is crucial to analyze how battery operating patterns influence their aging. Thus, the innovation of this work is to present an enhanced representation of battery degradation by considering the key factors that influence cycle aging in HEMS optimization. Unlike previous approaches, the impact of different operational patterns on battery degradation is analyzed. To this end, this paper proposes a mixed integer linear programming model to solve the HEMS optimization considering cycle battery degradation. This model aims to minimize electricity costs while ensuring demand is met and compliance with operating and load shifting constraints. The proposed model was implemented in Python and solved via the CBC solver, and four case studies illustrate its efficiency. Finally, the results show that the HEMS could eliminate energy purchases during peak hours with battery support, leading to a total energy cost reduction of up to 26.56%