diff --git a/esphome/components/climate/climate.h b/esphome/components/climate/climate.h index 050fc5e475..091483a033 100644 --- a/esphome/components/climate/climate.h +++ b/esphome/components/climate/climate.h @@ -326,39 +326,17 @@ class Climate : public EntityBase { optional visual_max_humidity_override_{}; private: - /** The active custom fan mode of the climate device. + /** The active custom fan mode (private - enforces use of safe setters). * - * PRIVATE ACCESS (compile-time enforced safety): - * - External components: Use get_custom_fan_mode() for read-only access - * - Derived classes: Use set_custom_fan_mode_() / clear_custom_fan_mode_() to modify - * - Direct assignment is prevented at compile time - * - * POINTER LIFETIME SAFETY: - * This pointer MUST always point to an entry in the traits.supported_custom_fan_modes_ vector, - * or be nullptr. The protected setter set_custom_fan_mode_() enforces this by calling - * traits.find_custom_fan_mode_() to validate and obtain the correct pointer. - * - * The private access level provides compile-time enforcement: - * this->set_custom_fan_mode_("Turbo"); // ✓ Safe - validates against traits - * this->custom_fan_mode_ = "Turbo"; // ✗ Compile error - private member + * Points to an entry in traits.supported_custom_fan_modes_ or nullptr. + * Use get_custom_fan_mode() to read, set_custom_fan_mode_() to modify. */ const char *custom_fan_mode_{nullptr}; - /** The active custom preset mode of the climate device. + /** The active custom preset (private - enforces use of safe setters). * - * PRIVATE ACCESS (compile-time enforced safety): - * - External components: Use get_custom_preset() for read-only access - * - Derived classes: Use set_custom_preset_() / clear_custom_preset_() to modify - * - Direct assignment is prevented at compile time - * - * POINTER LIFETIME SAFETY: - * This pointer MUST always point to an entry in the traits.supported_custom_presets_ vector, - * or be nullptr. The protected setter set_custom_preset_() enforces this by calling - * traits.find_custom_preset_() to validate and obtain the correct pointer. - * - * The private access level provides compile-time enforcement: - * this->set_custom_preset_("Eco"); // ✓ Safe - validates against traits - * this->custom_preset_ = "Eco"; // ✗ Compile error - private member + * Points to an entry in traits.supported_custom_presets_ or nullptr. + * Use get_custom_preset() to read, set_custom_preset_() to modify. */ const char *custom_preset_{nullptr}; };