mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Increase tplink climate precision (#127996)
This commit is contained in:
parent
7341337b5f
commit
1eea5b8a58
@ -15,7 +15,7 @@ from homeassistant.components.climate import (
|
|||||||
HVACAction,
|
HVACAction,
|
||||||
HVACMode,
|
HVACMode,
|
||||||
)
|
)
|
||||||
from homeassistant.const import PRECISION_WHOLE
|
from homeassistant.const import PRECISION_TENTHS
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
@ -64,7 +64,7 @@ class TPLinkClimateEntity(CoordinatedTPLinkEntity, ClimateEntity):
|
|||||||
| ClimateEntityFeature.TURN_ON
|
| ClimateEntityFeature.TURN_ON
|
||||||
)
|
)
|
||||||
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
|
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
|
||||||
_attr_precision = PRECISION_WHOLE
|
_attr_precision = PRECISION_TENTHS
|
||||||
|
|
||||||
# This disables the warning for async_turn_{on,off}, can be removed later.
|
# This disables the warning for async_turn_{on,off}, can be removed later.
|
||||||
_enable_turn_on_off_backwards_compatibility = False
|
_enable_turn_on_off_backwards_compatibility = False
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
# name: test_states[climate.thermostat-state]
|
# name: test_states[climate.thermostat-state]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'current_temperature': 20,
|
'current_temperature': 20.2,
|
||||||
'friendly_name': 'thermostat',
|
'friendly_name': 'thermostat',
|
||||||
'hvac_action': <HVACAction.HEATING: 'heating'>,
|
'hvac_action': <HVACAction.HEATING: 'heating'>,
|
||||||
'hvac_modes': list([
|
'hvac_modes': list([
|
||||||
@ -52,7 +52,7 @@
|
|||||||
'max_temp': 65536,
|
'max_temp': 65536,
|
||||||
'min_temp': None,
|
'min_temp': None,
|
||||||
'supported_features': <ClimateEntityFeature: 385>,
|
'supported_features': <ClimateEntityFeature: 385>,
|
||||||
'temperature': 22,
|
'temperature': 22.2,
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'climate.thermostat',
|
'entity_id': 'climate.thermostat',
|
||||||
|
@ -45,11 +45,11 @@ async def mocked_hub(hass: HomeAssistant) -> Device:
|
|||||||
|
|
||||||
features = [
|
features = [
|
||||||
_mocked_feature(
|
_mocked_feature(
|
||||||
"temperature", value=20, category=Feature.Category.Primary, unit="celsius"
|
"temperature", value=20.2, category=Feature.Category.Primary, unit="celsius"
|
||||||
),
|
),
|
||||||
_mocked_feature(
|
_mocked_feature(
|
||||||
"target_temperature",
|
"target_temperature",
|
||||||
value=22,
|
value=22.2,
|
||||||
type_=Feature.Type.Number,
|
type_=Feature.Type.Number,
|
||||||
category=Feature.Category.Primary,
|
category=Feature.Category.Primary,
|
||||||
unit="celsius",
|
unit="celsius",
|
||||||
@ -94,8 +94,8 @@ async def test_climate(
|
|||||||
|
|
||||||
state = hass.states.get(ENTITY_ID)
|
state = hass.states.get(ENTITY_ID)
|
||||||
assert state.attributes[ATTR_HVAC_ACTION] is HVACAction.HEATING
|
assert state.attributes[ATTR_HVAC_ACTION] is HVACAction.HEATING
|
||||||
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 20
|
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 20.2
|
||||||
assert state.attributes[ATTR_TEMPERATURE] == 22
|
assert state.attributes[ATTR_TEMPERATURE] == 22.2
|
||||||
|
|
||||||
|
|
||||||
async def test_states(
|
async def test_states(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user