#ifdef FIRMWARE_VARIANT_THERMOSTAT

// thermostat - set values
float thermostat_setTemp = DEFAULT_SETTEMP;
float thermostat_setTempLow = DEFAULT_SETTEMP_LOW;   // set temperature in night/low mode
float thermostat_setTempLow2 = DEFAULT_SETTEMP_LOW2; // set temperature in night/low mode
float thermostat_currSetTemp = DEFAULT_SETTEMP;
float thermostat_currActualSetTemp = DEFAULT_SETTEMP;
uint8_t thermostat_heatingMode = DEFAULT_HEATINGMODE; // 0 = off, 1 = heat
uint16_t thermostat_heatingPause = 0;
uint8_t thermostat_preset = DEFAULT_PRESET;           // 0 = normal/day, 1 = night/reduction 1, 2 =
                                           // reduction 2 (long term leave)

// saved set values (same as above, held in memory additionally to prevent
// saving unchanged values)
float thermostat_setTempSaved;
float thermostat_setTempLowSaved;
float thermostat_setTempLow2Saved;
uint8_t thermostat_heatingModeSaved;
uint8_t thermostat_presetSaved;

float thermostat_setTempLowMin = SETTEMP_LOW_MIN;
float thermostat_setTempLowMax = SETTEMP_LOW_MAX;

bool thermostat_turnHeatingOn = false;         // true if heating is active (relais switched on)
//bool heatingLockTimeActive = false; // true if heating is not active due to active lock time
uint16_t thermostat_heatingLockTime = 0;
unsigned long thermostat_heatingLastOnMillis;  // last time heating was switched on
unsigned long thermostat_heatingLastOffMillis; // last time heating was switched off
char thermostat_currentModeName[15];
char thermostat_currentPresetName[15];
unsigned long thermostat_heatingOnTime;
unsigned long thermostat_heatingOffTime;
unsigned long thermostat_lastUpdate_setTemp = 0;     // set to millis() every time setTemp value is changed
unsigned long thermostat_lastUpdate_setTempLow = 0;  // set to millis() every time setTemp value is changed
unsigned long thermostat_lastUpdate_setTempLow2 = 0; // set to millis() every time setTemp value is changed
unsigned long thermostat_lastUpdate_heatingMode = 0; // set to millis() every time heatingMode value is changed
unsigned long thermostat_lastUpdate_preset = 0;      // set to millis() every time preset value is changed
bool thermostat_setTempAlreadySaved = true;     // only save if not yet done
bool thermostat_setTempLowAlreadySaved = true;  // only save if not yet done
bool thermostat_setTempLow2AlreadySaved = true; // only save if not yet done
bool thermostat_heatingModeAlreadySaved = true; // only save if not yet done
bool thermostat_presetAlreadySaved = true;      // only save if not yet done
bool thermostat_pendingPresetToggle = false;
uint8_t thermostat_pendingPreset;
char thermostat_pendingPresetName[15];
uint16_t thermostat_saveValuesTimeout = 5000;
unsigned long thermostat_lastValueChange;       // is set to millis() whenever setTemp value
                                                // and/or heatingMode value is changed. used for
                                                // autoSave function with hardcoded 5s timeout


uint8_t display_whichTempToDisplay;          // 1=temp inside (from DHT sensor), 2= temp outside
                                     // (via MQTT) - if out temp/hum available this value
                                     // and the displayed value pair toggles with every
                                     // displayInterval

#endif
