This paper optimizes the thermodynamic behavior of buildings through demand response (DR) by operating their mechanical heating/cooling systems at 50% or 100% output capacity on a 15-minute basis. The optimization's objective is either minimizing cost or net electricity consumption, considering hourly prices and renewable energy resource availability in the local microgrid. The proposed DR framework combines thermodynamic models with an automated, genetic-algorithm based optimization, resulting in demonstrable benefits in terms of cost and energy efficiency for the end-users. The optimal DR schedule with multiple heating/cooling output capacity is compared against an unoptimized, business-as-usual scenario and against a DR schedule which allows only a binary operation. Results show that flexibility can be harnessed from the buildings' thermal mass, and that a finer temporal granularity not only improves the cost-and energy performance of the system, but also the utilization of renewable energy sources in the microgrid.