Set TURN_ON and TURN_OFF feature on MQTT climate entities (#109146)

This commit is contained in:
Jan Bouwhuis 2024-01-30 19:35:46 +01:00 committed by GitHub
parent 7d2c6a1bb6
commit 6023980c2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -703,7 +703,7 @@ class MqttClimate(MqttTemperatureControlEntity, ClimateEntity):
config.get(key), entity=self
).async_render
support = ClimateEntityFeature(0)
support = ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF
if (self._topic[CONF_TEMP_STATE_TOPIC] is not None) or (
self._topic[CONF_TEMP_COMMAND_TOPIC] is not None
):

View file

@ -121,6 +121,17 @@ async def test_setup_params(
assert state.attributes.get("max_temp") == DEFAULT_MAX_TEMP
assert state.attributes.get("min_humidity") == DEFAULT_MIN_HUMIDITY
assert state.attributes.get("max_humidity") == DEFAULT_MAX_HUMIDITY
assert (
state.attributes.get("supported_features")
== ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
| ClimateEntityFeature.TARGET_HUMIDITY
| ClimateEntityFeature.FAN_MODE
| ClimateEntityFeature.PRESET_MODE
| ClimateEntityFeature.SWING_MODE
| ClimateEntityFeature.TURN_OFF
| ClimateEntityFeature.TURN_ON
)
@pytest.mark.parametrize(