Skip to content

Commit

Permalink
issue #807 - send temperature only if in the feature (#811)
Browse files Browse the repository at this point in the history
Co-authored-by: Jean-Marc Collin <jean-marc.collin-extern@renault.com>
  • Loading branch information
jmcollin78 and Jean-Marc Collin authored Jan 12, 2025
1 parent f8050e2 commit 43d8e5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
30 changes: 14 additions & 16 deletions custom_components/versatile_thermostat/underlyings.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,22 +632,20 @@ async def set_temperature(self, temperature, max_temp, min_temp):

# Issue 508 we have to take care of service set_temperature or set_range
target_temp = self.cap_sent_value(temperature)
if (
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
in self._underlying_climate.supported_features
):
data = {
ATTR_ENTITY_ID: self._entity_id,
"target_temp_high": target_temp,
"target_temp_low": target_temp,
# issue 518 - we should send also the target temperature, even in TARGET RANGE
"temperature": target_temp,
}
else:
data = {
ATTR_ENTITY_ID: self._entity_id,
"temperature": target_temp,
}
data = {
ATTR_ENTITY_ID: self._entity_id,
}
# Issue 807 add TARGET_TEMPERATURE only if in the features
if ClimateEntityFeature.TARGET_TEMPERATURE_RANGE in self._underlying_climate.supported_features:
data.update(
{
"target_temp_high": target_temp,
"target_temp_low": target_temp,
}
)

if ClimateEntityFeature.TARGET_TEMPERATURE in self._underlying_climate.supported_features:
data["temperature"] = target_temp

await self._hass.services.async_call(
CLIMATE_DOMAIN,
Expand Down
2 changes: 0 additions & 2 deletions tests/test_overclimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ async def test_bug_508(
# "temperature": 17.5,
"target_temp_high": 10,
"target_temp_low": 10,
"temperature": 10,
},
),
]
Expand All @@ -604,7 +603,6 @@ async def test_bug_508(
"entity_id": "climate.mock_climate",
"target_temp_high": 31,
"target_temp_low": 31,
"temperature": 31,
},
),
]
Expand Down

0 comments on commit 43d8e5e

Please sign in to comment.