issue #807 - send temperature only if in the feature (#811)

Co-authored-by: Jean-Marc Collin <jean-marc.collin-extern@renault.com>
This commit is contained in:
Jean-Marc Collin
2025-01-12 09:51:36 +01:00
committed by GitHub
parent f8050e2ed7
commit 43d8e5eb3c
2 changed files with 14 additions and 18 deletions

View File

@@ -632,22 +632,20 @@ class UnderlyingClimate(UnderlyingEntity):
# Issue 508 we have to take care of service set_temperature or set_range # Issue 508 we have to take care of service set_temperature or set_range
target_temp = self.cap_sent_value(temperature) target_temp = self.cap_sent_value(temperature)
if ( data = {
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE ATTR_ENTITY_ID: self._entity_id,
in self._underlying_climate.supported_features }
): # Issue 807 add TARGET_TEMPERATURE only if in the features
data = { if ClimateEntityFeature.TARGET_TEMPERATURE_RANGE in self._underlying_climate.supported_features:
ATTR_ENTITY_ID: self._entity_id, data.update(
"target_temp_high": target_temp, {
"target_temp_low": target_temp, "target_temp_high": target_temp,
# issue 518 - we should send also the target temperature, even in TARGET RANGE "target_temp_low": target_temp,
"temperature": target_temp, }
} )
else:
data = { if ClimateEntityFeature.TARGET_TEMPERATURE in self._underlying_climate.supported_features:
ATTR_ENTITY_ID: self._entity_id, data["temperature"] = target_temp
"temperature": target_temp,
}
await self._hass.services.async_call( await self._hass.services.async_call(
CLIMATE_DOMAIN, CLIMATE_DOMAIN,

View File

@@ -580,7 +580,6 @@ async def test_bug_508(
# "temperature": 17.5, # "temperature": 17.5,
"target_temp_high": 10, "target_temp_high": 10,
"target_temp_low": 10, "target_temp_low": 10,
"temperature": 10,
}, },
), ),
] ]
@@ -604,7 +603,6 @@ async def test_bug_508(
"entity_id": "climate.mock_climate", "entity_id": "climate.mock_climate",
"target_temp_high": 31, "target_temp_high": 31,
"target_temp_low": 31, "target_temp_low": 31,
"temperature": 31,
}, },
), ),
] ]