This paper presents a new mixed integer linear programing (MILP) model for the management of energy consumption and comfort in smart buildings. Initially, a detailed mixed integer non-linear programming (MINLP) model is formulated. The approach considers the management of heating, ventilation and air conditioning (HVAC) units, lighting appliances, photovoltaic generation (PV) and energy storage system (ESS). Then, a set of linear and equivalent representations are used to approximate the problem by an MILP model. The aims of the proposed model is to minimize the electricity bill by managing the loads, as well as the schedule of the ESS, meanwhile comfortable indoor conditions are ensured by a set of mathematical constraints. A commercial MILP solver was used to guarantee optimality. The strategy was tested in an university building with multiple zones. Comparisons between the proposed MILP model and simulations in EnergyPlus were used to validate the results.