mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +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_THRESHOLD): vol.Coerce(float),
|
||||||
vol.Required(ATTR_LOW_TEMPERATURE_STATE): dict,
|
vol.Required(ATTR_LOW_TEMPERATURE_STATE): dict,
|
||||||
vol.Required(ATTR_SMART_TYPE): vol.In(
|
vol.Required(ATTR_SMART_TYPE): vol.In(
|
||||||
["temperature", "feelsLike", "humidity"]
|
["temperature", "feelslike", "humidity"]
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
"async_enable_climate_react",
|
"async_enable_climate_react",
|
||||||
|
@ -36,6 +36,13 @@ from .entity import SensiboDeviceBaseEntity, SensiboMotionBaseEntity
|
|||||||
PARALLEL_UPDATES = 0
|
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)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
class SensiboMotionSensorEntityDescription(SensorEntityDescription):
|
class SensiboMotionSensorEntityDescription(SensorEntityDescription):
|
||||||
"""Describes Sensibo Motion sensor entity."""
|
"""Describes Sensibo Motion sensor entity."""
|
||||||
@ -153,7 +160,7 @@ DEVICE_SENSOR_TYPES: tuple[SensiboDeviceSensorEntityDescription, ...] = (
|
|||||||
SensiboDeviceSensorEntityDescription(
|
SensiboDeviceSensorEntityDescription(
|
||||||
key="climate_react_type",
|
key="climate_react_type",
|
||||||
translation_key="smart_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,
|
extra_fn=None,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
|
@ -954,7 +954,7 @@ async def test_climate_climate_react(
|
|||||||
"light": "on",
|
"light": "on",
|
||||||
},
|
},
|
||||||
"lowTemperatureThreshold": 5.5,
|
"lowTemperatureThreshold": 5.5,
|
||||||
"type": "temperature",
|
"type": "feelsLike",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,7 +985,7 @@ async def test_climate_climate_react(
|
|||||||
"horizontalSwing": "stopped",
|
"horizontalSwing": "stopped",
|
||||||
"light": "on",
|
"light": "on",
|
||||||
},
|
},
|
||||||
ATTR_SMART_TYPE: "temperature",
|
ATTR_SMART_TYPE: "feelslike",
|
||||||
},
|
},
|
||||||
blocking=True,
|
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_on = True
|
||||||
mock_client.async_get_devices_data.return_value.parsed[
|
mock_client.async_get_devices_data.return_value.parsed[
|
||||||
"ABC999111"
|
"ABC999111"
|
||||||
].smart_type = "temperature"
|
].smart_type = "feelsLike"
|
||||||
mock_client.async_get_devices_data.return_value.parsed[
|
mock_client.async_get_devices_data.return_value.parsed[
|
||||||
"ABC999111"
|
"ABC999111"
|
||||||
].smart_low_temp_threshold = 5.5
|
].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
|
hass.states.get("sensor.hallway_climate_react_high_temperature_threshold").state
|
||||||
== "30.5"
|
== "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")
|
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user