Heating, ventilation, and air-conditioning (HVAC) systems are considered essential technologies for modern human life for many different purposes, such as providing human comfort or increasing agricultural production. However, the energy consumption of HVAC systems is very high, and usually leads to peak power demand issues that require adequate mitigation measures to ensure grid stability and not to exceed the maximum power demand allowed. In this work, a model predictive control (MPC) scheme is proposed for the joint management of hybrid generation dispatch and dispatchable demand response of HVAC systems in microgrids. The energy generation, the storage devices, and the controllable loads are managed simultaneously to improve the performance of the microgrids without losing thermal comfort. Demand response strategies are applied explicitly (constraining controllable loads) and implicitly (optimizing system operation by means of its thermal inertia). This simple MPC scheme is based on linear parameter-varying (LPV) modeling for HVAC system and battery bank, and rough predictions for external temperature, renewable generation and non-dispatchable demand. As MPC tolerates large plant-model mismatches, simple forecasting models are suitable for the required rough predictions. The LPV model scheduling signals are forecast to predict the time variable parameters and thus improve feedback and feedforward control. Viable MPC formulations for embedded processors are derived for off-grid and grid-connected operation. The developed scheme is applied to two case studies of interest in Argentina, an automated poultry farm (isolated from the grid), and a health facility (connected to the grid) with an expensive bill due to penalties. The simulation results demonstrate the effectiveness and the economic benefit of the management strategies proposed. Indeed, the isolated case provided 55% fuel saving and better use of the resources compared to the conventional rule-based controller. Furthermore, the connected case provided 26% monthly bill saving and 750% investment saving. • A simple MPC scheme to improve feedback and feedforward control of power flows in microgrids. • It based on the joint management of generation dispatch and HVAC demand response. • Viable MPC formulations for embedded processors are derived using simple forecasting models. • Framework for seamless integration and optimization of HVAC, storage and renewable systems. • Two applications of this complete MPC scheme for off-grid and grid-connected operation are studied.