@@ -165,7 +165,7 @@ MatterThermostat::~MatterThermostat() {
165
165
end ();
166
166
}
167
167
168
- bool MatterThermostat::begin (ControlSequenceOfOperation_t _controlSequence, bool _hasAutoMode ) {
168
+ bool MatterThermostat::begin (ControlSequenceOfOperation_t _controlSequence, ThermostatAutoMode_t _autoMode ) {
169
169
ArduinoMatter::_init ();
170
170
171
171
if (getEndPointId () != 0 ) {
@@ -174,7 +174,7 @@ bool MatterThermostat::begin(ControlSequenceOfOperation_t _controlSequence, bool
174
174
}
175
175
176
176
// check if auto mode is allowed with the control sequence of operation - only allowed for Cooling & Heating
177
- if (_hasAutoMode && _controlSequence != THERMOSTAT_SEQ_OP_COOLING_HEATING && _controlSequence != THERMOSTAT_SEQ_OP_COOLING_HEATING_REHEAT) {
177
+ if (_autoMode == THERMOSTAT_AUTO_MODE_ENABLED && _controlSequence != THERMOSTAT_SEQ_OP_COOLING_HEATING && _controlSequence != THERMOSTAT_SEQ_OP_COOLING_HEATING_REHEAT) {
178
178
log_e (" Thermostat in Auto Mode requires a Cooling & Heating Control Sequence of Operation." );
179
179
return false ;
180
180
}
@@ -197,14 +197,14 @@ bool MatterThermostat::begin(ControlSequenceOfOperation_t _controlSequence, bool
197
197
log_e (" Failed to create Thermostat endpoint" );
198
198
return false ;
199
199
}
200
- if (_hasAutoMode ) {
200
+ if (_autoMode == THERMOSTAT_AUTO_MODE_ENABLED ) {
201
201
cluster_t *cluster = cluster::get (endpoint, Thermostat::Id);
202
202
thermostat_config.thermostat .auto_mode .min_setpoint_dead_band = kDefaultDeadBand ; // fixed by default to 2.5C
203
203
cluster::thermostat::feature::auto_mode::add (cluster, &thermostat_config.thermostat .auto_mode );
204
204
}
205
205
206
206
controlSequence = _controlSequence;
207
- hasAutoMode = _hasAutoMode ;
207
+ autoMode = _autoMode ;
208
208
coolingSetpointTemperature = _coolingSetpointTemperature;
209
209
heatingSetpointTemperature = _heatingSetpointTemperature;
210
210
localTemperature = _localTemperature;
@@ -226,7 +226,7 @@ bool MatterThermostat::setMode(ThermostatMode_t _mode) {
226
226
return false ;
227
227
}
228
228
229
- if (!hasAutoMode && _mode == THERMOSTAT_MODE_AUTO) {
229
+ if (autoMode == THERMOSTAT_AUTO_MODE_DISABLED && _mode == THERMOSTAT_MODE_AUTO) {
230
230
log_e (" Thermostat can't set Auto Mode." );
231
231
return false ;
232
232
}
0 commit comments