This paper describes the modeling and control of heat and electricity flows in a smart house equipped with a solar heating system, PV panels, and lead-acid batteries for energy storage. The goal is to minimize electricity costs, making best use of renewable sources of heat and electricity. The system model is obtained via system identification from experimental data as a discrete-time hybrid system to capture the main thermal and electrical dynamics, the on-off activation of pumps, heating coil, the connection to the grid, and various operating constraints, including logic constraints and limits on system variables. Based on the obtained model, we derive a hybrid model predictive control (MPC) strategy. The controller is able to track the desired temperature and minimize costs for consuming electricity from the grid, while respecting all the prescribed constraints. Simulation results testify the effectiveness and feasibility of the approach.