This paper presents the design of a Model Predictive Control (MPC) scheme to optimally manage the thermal and electrical subsystems of a small-size building ("smart house"), with the objective of minimizing the expense for buying energy from the grid, while keeping the room temperature within given time-varying bounds. The system, for which an experimental prototype has been built, includes PV panels, solar collectors, a battery pack, an electrical heater in a thermal storage tank, and two pumps on the solar collector and radiator hydraulic circuits. The presence of binary control inputs together with continuous ones naturally leads to using a hybrid dynamical model, and the MPC controller solves a mixed-integer linear program at each sampling instant, relying on weather forecast data for ambient temperature and solar irradiance. The procedure for controller design is reported with focus on the specific application, and the proposed method is successfully tested on the experimental site.