In recent times, the energy consumed by buildings facilities became considerable. Efficient local energy management is vital to deal with building power demand penalties. This operation becomes complex when a hybrid energy system is included in the power system. This study proposes new energy management between photovoltaic (PV) system, Battery Energy Storage System (BESS) and the power network in a building by controlling the PV/BESS inverter. The strategy is based on explicit model predictive control (MPC) to find an optimal power flow in the building for one-day ahead. The control algorithm is based on a simple power flow equation and weather forecast. Then, a cost function is formulated and optimised using genetic algorithms-based solver. The objective is reducing the imported energy from the grid preventing the saturation and emptiness of BESS. Including other targets to the control policy as energy price dynamic and BESS degradation, MPC can optimise dramatically the efficacy of the global building power system. The strategy is implemented and tested successfully using MATLAB/SimPowerSystems software, compared to classical hysteresis management, MPC has given 10% in energy cost economy and 25% improvement in BESS lifetime.