1. A thermostat for monitoring and controlling temperature of a building zone, the thermostat comprising: a base configured to attach to a mounting surface upon which the thermostat is mounted; an equipment controller physically coupled to the base and configured to drive the temperature of the building zone to an optimal temperature setpoint by operating HVAC equipment to provide heating or cooling to the building zone, wherein operating the HVAC equipment causes the HVAC equipment to add heat to the building zone or remove heat from the building zone, thereby affecting the temperature of the building zone; and a model predictive controller physically coupled to the base and configured to determine the optimal temperature setpoint by: generating a cost function that accounts for a cost operating the HVAC equipment during each of a plurality of time steps in an optimization period; using a predictive model to predict the temperature of the building zone during each of the plurality of time steps, wherein the predictive model comprises a thermal mass storage model that defines the temperature of the building zone as a function of at least one of: heat transfer between air within the building zone and solid mass within the building zone; heat transfer between the building zone and the HVAC equipment; and an unmeasured heat load disturbance; and optimizing the cost function subject to a constraint on the predicted temperature of the building zone to determine optimal temperature setpoints for each of the plurality of time steps.