@@ -165,7 +165,7 @@ MatterThermostat::~MatterThermostat() {
165165 end ();
166166}
167167
168- bool MatterThermostat::begin (ControlSequenceOfOperation_t _controlSequence, bool _hasAutoMode ) {
168+ bool MatterThermostat::begin (ControlSequenceOfOperation_t _controlSequence, ThermostatAutoMode_t _autoMode ) {
169169 ArduinoMatter::_init ();
170170
171171 if (getEndPointId () != 0 ) {
@@ -174,7 +174,7 @@ bool MatterThermostat::begin(ControlSequenceOfOperation_t _controlSequence, bool
174174 }
175175
176176 // 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) {
178178 log_e (" Thermostat in Auto Mode requires a Cooling & Heating Control Sequence of Operation." );
179179 return false ;
180180 }
@@ -197,14 +197,14 @@ bool MatterThermostat::begin(ControlSequenceOfOperation_t _controlSequence, bool
197197 log_e (" Failed to create Thermostat endpoint" );
198198 return false ;
199199 }
200- if (_hasAutoMode ) {
200+ if (_autoMode == THERMOSTAT_AUTO_MODE_ENABLED ) {
201201 cluster_t *cluster = cluster::get (endpoint, Thermostat::Id);
202202 thermostat_config.thermostat .auto_mode .min_setpoint_dead_band = kDefaultDeadBand ; // fixed by default to 2.5C
203203 cluster::thermostat::feature::auto_mode::add (cluster, &thermostat_config.thermostat .auto_mode );
204204 }
205205
206206 controlSequence = _controlSequence;
207- hasAutoMode = _hasAutoMode ;
207+ autoMode = _autoMode ;
208208 coolingSetpointTemperature = _coolingSetpointTemperature;
209209 heatingSetpointTemperature = _heatingSetpointTemperature;
210210 localTemperature = _localTemperature;
@@ -226,7 +226,7 @@ bool MatterThermostat::setMode(ThermostatMode_t _mode) {
226226 return false ;
227227 }
228228
229- if (!hasAutoMode && _mode == THERMOSTAT_MODE_AUTO) {
229+ if (autoMode == THERMOSTAT_AUTO_MODE_DISABLED && _mode == THERMOSTAT_MODE_AUTO) {
230230 log_e (" Thermostat can't set Auto Mode." );
231231 return false ;
232232 }
0 commit comments