Efficient utilization of renewable generation inside microgrids remains challenging. In most existing studies, the goal is to optimize the energy cost of microgrids by working in synergy with the main grid. This work aimed at maximizing the self-consumption of on-site photovoltaic (PV) generation using an electrical storage, as well as demand response solutions, in a building that was also capable of interacting with the main grid. Ten-minute resolution data were used to capture the temporal behavior of the weather. Extensive mathematical models were employed to estimate the demand for hot-water consumption, space cooling, and heating loads. The proposed framework is cast as mixed-integer linear programming model while minimizing the interaction with the grid. To evaluate the effectiveness of the proposed framework, it was applied to a typical Finnish household. Matching indices were used to evaluate the degree of overlap between generation and demand under different PV penetrations and storage capacities. Despite negative correlation of PV generation with Finnish seasonal consumption, a significant portion of demand can be satisfied solely with on-site PV generation during the spring and summer seasons.