diff --git a/light/color_instant_handler.h b/light/color_instant_handler.h index dc2eca9..b2e90d1 100644 --- a/light/color_instant_handler.h +++ b/light/color_instant_handler.h @@ -41,8 +41,10 @@ class ColorInstantHandler : public GPIOOutputs { white_light_->copy_to(this); else if (rgb_light_->set_light_color_values(v)) rgb_light_->copy_to(this); - else - throw std::logic_error("None of the GPIOOutputs classes handles the requested light state"); + else { + ESP_LOGE(TAG, "Light color error: (None of the GPIOOutputs classes handles the requested light state; defaulting to 'off'"); + off_light_->copy_to(this); + } return true; } diff --git a/light/color_white_light.h b/light/color_white_light.h index 6360b9d..ffdbb61 100644 --- a/light/color_white_light.h +++ b/light/color_white_light.h @@ -119,7 +119,10 @@ class ColorWhiteLight : public GPIOOutputs { for (RGBWLevelsByTemperature& item : table) if (temperature >= item.from_temperature) return item; - throw std::invalid_argument("received too low temperature"); + // Temperature too low. Shouldn't happen, because of validation + // at higher levels. But when it happens, simply return the data + // for lowest available temperature. + return table[0]; } };