mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 01:07:10 +00:00
Fix climate react type (#135030)
This commit is contained in:
parent
d000558227
commit
e99aaed7fa
@ -199,7 +199,7 @@ async def async_setup_entry(
|
||||
vol.Required(ATTR_LOW_TEMPERATURE_THRESHOLD): vol.Coerce(float),
|
||||
vol.Required(ATTR_LOW_TEMPERATURE_STATE): dict,
|
||||
vol.Required(ATTR_SMART_TYPE): vol.In(
|
||||
["temperature", "feelsLike", "humidity"]
|
||||
["temperature", "feelslike", "humidity"]
|
||||
),
|
||||
},
|
||||
"async_enable_climate_react",
|
||||
|
@ -36,6 +36,13 @@ from .entity import SensiboDeviceBaseEntity, SensiboMotionBaseEntity
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
|
||||
def _smart_type_name(_type: str | None) -> str | None:
|
||||
"""Return a lowercase name of smart type."""
|
||||
if _type and _type == "feelsLike":
|
||||
return "feelslike"
|
||||
return _type
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class SensiboMotionSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes Sensibo Motion sensor entity."""
|
||||
@ -153,7 +160,7 @@ DEVICE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = (
|
||||
SensiboDeviceSensorEntityDescription(
|
||||
key="climate_react_type",
|
||||
translation_key="smart_type",
|
||||
value_fn=lambda data: data.smart_type,
|
||||
value_fn=lambda data: _smart_type_name(data.smart_type),
|
||||
extra_fn=None,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
|
@ -954,7 +954,7 @@ async def test_climate_climate_react(
|
||||
"light": "on",
|
||||
},
|
||||
"lowTemperatureThreshold": 5.5,
|
||||
"type": "temperature",
|
||||
"type": "feelsLike",
|
||||
},
|
||||
}
|
||||
|
||||
@ -985,7 +985,7 @@ async def test_climate_climate_react(
|
||||
"horizontalSwing": "stopped",
|
||||
"light": "on",
|
||||
},
|
||||
ATTR_SMART_TYPE: "temperature",
|
||||
ATTR_SMART_TYPE: "feelslike",
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
@ -993,7 +993,7 @@ async def test_climate_climate_react(
|
||||
mock_client.async_get_devices_data.return_value.parsed["ABC999111"].smart_on = True
|
||||
mock_client.async_get_devices_data.return_value.parsed[
|
||||
"ABC999111"
|
||||
].smart_type = "temperature"
|
||||
].smart_type = "feelsLike"
|
||||
mock_client.async_get_devices_data.return_value.parsed[
|
||||
"ABC999111"
|
||||
].smart_low_temp_threshold = 5.5
|
||||
@ -1038,7 +1038,7 @@ async def test_climate_climate_react(
|
||||
hass.states.get("sensor.hallway_climate_react_high_temperature_threshold").state
|
||||
== "30.5"
|
||||
)
|
||||
assert hass.states.get("sensor.hallway_climate_react_type").state == "temperature"
|
||||
assert hass.states.get("sensor.hallway_climate_react_type").state == "feelslike"
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
|
Loading…
x
Reference in New Issue
Block a user