Skip to content

Commit 1eea5b8

Browse files
authored
Increase tplink climate precision (#127996)
1 parent 7341337 commit 1eea5b8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

homeassistant/components/tplink/climate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
HVACAction,
1616
HVACMode,
1717
)
18-
from homeassistant.const import PRECISION_WHOLE
18+
from homeassistant.const import PRECISION_TENTHS
1919
from homeassistant.core import HomeAssistant, callback
2020
from homeassistant.exceptions import ServiceValidationError
2121
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@@ -64,7 +64,7 @@ class TPLinkClimateEntity(CoordinatedTPLinkEntity, ClimateEntity):
6464
| ClimateEntityFeature.TURN_ON
6565
)
6666
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
67-
_attr_precision = PRECISION_WHOLE
67+
_attr_precision = PRECISION_TENTHS
6868

6969
# This disables the warning for async_turn_{on,off}, can be removed later.
7070
_enable_turn_on_off_backwards_compatibility = False

tests/components/tplink/snapshots/test_climate.ambr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# name: test_states[climate.thermostat-state]
4343
StateSnapshot({
4444
'attributes': ReadOnlyDict({
45-
'current_temperature': 20,
45+
'current_temperature': 20.2,
4646
'friendly_name': 'thermostat',
4747
'hvac_action': <HVACAction.HEATING: 'heating'>,
4848
'hvac_modes': list([
@@ -52,7 +52,7 @@
5252
'max_temp': 65536,
5353
'min_temp': None,
5454
'supported_features': <ClimateEntityFeature: 385>,
55-
'temperature': 22,
55+
'temperature': 22.2,
5656
}),
5757
'context': <ANY>,
5858
'entity_id': 'climate.thermostat',

tests/components/tplink/test_climate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ async def mocked_hub(hass: HomeAssistant) -> Device:
4545

4646
features = [
4747
_mocked_feature(
48-
"temperature", value=20, category=Feature.Category.Primary, unit="celsius"
48+
"temperature", value=20.2, category=Feature.Category.Primary, unit="celsius"
4949
),
5050
_mocked_feature(
5151
"target_temperature",
52-
value=22,
52+
value=22.2,
5353
type_=Feature.Type.Number,
5454
category=Feature.Category.Primary,
5555
unit="celsius",
@@ -94,8 +94,8 @@ async def test_climate(
9494

9595
state = hass.states.get(ENTITY_ID)
9696
assert state.attributes[ATTR_HVAC_ACTION] is HVACAction.HEATING
97-
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 20
98-
assert state.attributes[ATTR_TEMPERATURE] == 22
97+
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 20.2
98+
assert state.attributes[ATTR_TEMPERATURE] == 22.2
9999

100100

101101
async def test_states(

0 commit comments

Comments
 (0)