[water_heater] Set OPERATION_MODE feature flag when modes are configured (#14748)

This commit is contained in:
J. Nick Koston
2026-03-12 14:48:41 -10:00
committed by GitHub
parent e15b19b223
commit 89719cf4b2
2 changed files with 6 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ water_heater::WaterHeaterTraits TemplateWaterHeater::traits() {
if (!this->supported_modes_.empty()) {
traits.set_supported_modes(this->supported_modes_);
traits.add_feature_flags(water_heater::WATER_HEATER_SUPPORTS_OPERATION_MODE);
}
traits.set_supports_current_temperature(true);

View File

@@ -102,7 +102,11 @@ async def test_water_heater_template(
f"Expected target temp 60.0, got {initial_state.target_temperature}"
)
# Verify supported features: away mode and on/off (fixture has away + is_on lambdas)
# Verify supported features: operation mode, away mode, and on/off
assert (
test_water_heater.supported_features
& WaterHeaterFeature.SUPPORTS_OPERATION_MODE
) != 0, "Expected SUPPORTS_OPERATION_MODE in supported_features"
assert (
test_water_heater.supported_features & WaterHeaterFeature.SUPPORTS_AWAY_MODE
) != 0, "Expected SUPPORTS_AWAY_MODE in supported_features"