SmartThings edge driver for heatit thermostats does not require cooling setpoint (#123188)

* remove cooling setpoint requirement for thermostats. Air conditioning remains unchanged

* remove cooling setpoint requirement for thermostats. Air conditioning remains unchanged

* versions should not be set on core integrations.

* Added tests for minimal smartthings thermostat with no cooling.

* Added tests for minimal smartthings thermostat with no cooling.

* Formatted tests with ruff format
This commit is contained in:
Jeremy Cook 2024-08-29 07:49:05 +02:00 committed by GitHub
parent 4b59ef4733
commit 7f4fca63ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 42 additions and 1 deletions

View file

@ -143,7 +143,6 @@ def get_capabilities(capabilities: Sequence[str]) -> Sequence[str] | None:
# Or must have all of these thermostat capabilities
thermostat_capabilities = [
Capability.temperature_measurement,
Capability.thermostat_cooling_setpoint,
Capability.thermostat_heating_setpoint,
Capability.thermostat_mode,
]

View file

@ -88,6 +88,26 @@ def basic_thermostat_fixture(device_factory):
return device
@pytest.fixture(name="minimal_thermostat")
def minimal_thermostat_fixture(device_factory):
"""Fixture returns a minimal thermostat without cooling."""
device = device_factory(
"Minimal Thermostat",
capabilities=[
Capability.temperature_measurement,
Capability.thermostat_heating_setpoint,
Capability.thermostat_mode,
],
status={
Attribute.heating_setpoint: 68,
Attribute.thermostat_mode: "off",
Attribute.supported_thermostat_modes: ["off", "heat"],
},
)
device.status.attributes[Attribute.temperature] = Status(70, "F", None)
return device
@pytest.fixture(name="thermostat")
def thermostat_fixture(device_factory):
"""Fixture returns a fully-featured thermostat."""
@ -310,6 +330,28 @@ async def test_basic_thermostat_entity_state(
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius
async def test_minimal_thermostat_entity_state(
hass: HomeAssistant, minimal_thermostat
) -> None:
"""Tests the state attributes properly match the thermostat type."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[minimal_thermostat])
state = hass.states.get("climate.minimal_thermostat")
assert state.state == HVACMode.OFF
assert (
state.attributes[ATTR_SUPPORTED_FEATURES]
== ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
| ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.TURN_OFF
| ClimateEntityFeature.TURN_ON
)
assert ATTR_HVAC_ACTION not in state.attributes
assert sorted(state.attributes[ATTR_HVAC_MODES]) == [
HVACMode.HEAT,
HVACMode.OFF,
]
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius
async def test_thermostat_entity_state(hass: HomeAssistant, thermostat) -> None:
"""Tests the state attributes properly match the thermostat type."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])