Fix value_or default and style consistency

- thermostat: Use CLIMATE_FAN_ON to match other callsites in the file
- sprinkler: Use *opt instead of .value() for consistency with line 47

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
J. Nick Koston
2026-02-28 07:58:46 -10:00
parent 0b8a1b40a7
commit 2224132e03
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -89,21 +89,21 @@ void SprinklerValveOperator::loop() {
uint32_t now = App.get_loop_component_start_time();
switch (this->state_) {
case STARTING:
if ((now - this->start_millis_.value()) > this->start_delay_) { // NOLINT(bugprone-unchecked-optional-access)
if ((now - *this->start_millis_) > this->start_delay_) { // NOLINT(bugprone-unchecked-optional-access)
this->run_(); // start_delay_ has been exceeded, so ensure both valves are on and update the state
}
break;
case ACTIVE:
if ((now - this->start_millis_.value()) > // NOLINT(bugprone-unchecked-optional-access)
if ((now - *this->start_millis_) > // NOLINT(bugprone-unchecked-optional-access)
(this->start_delay_ + this->run_duration_)) {
this->stop(); // start_delay_ + run_duration_ has been exceeded, start shutting down
}
break;
case STOPPING:
if ((now - this->stop_millis_.value()) > this->stop_delay_) { // NOLINT(bugprone-unchecked-optional-access)
this->kill_(); // stop_delay_has been exceeded, ensure all valves are off
if ((now - *this->stop_millis_) > this->stop_delay_) { // NOLINT(bugprone-unchecked-optional-access)
this->kill_(); // stop_delay_has been exceeded, ensure all valves are off
}
break;
@@ -84,7 +84,7 @@ void ThermostatClimate::refresh() {
this->switch_to_mode_(this->mode, false);
this->switch_to_action_(this->compute_action_(), false);
this->switch_to_supplemental_action_(this->compute_supplemental_action_());
this->switch_to_fan_mode_(this->fan_mode.value_or(climate::CLIMATE_FAN_AUTO), false);
this->switch_to_fan_mode_(this->fan_mode.value_or(climate::CLIMATE_FAN_ON), false);
this->switch_to_swing_mode_(this->swing_mode, false);
this->switch_to_humidity_control_action_(this->compute_humidity_control_action_());
this->check_humidity_change_trigger_();