Improve fans in homekit_controller (#74440)

This commit is contained in:
J. Nick Koston 2022-07-05 09:25:30 -05:00 committed by GitHub
parent 809f101f55
commit f6cb2833ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 205 additions and 198 deletions

View file

@ -2,6 +2,7 @@
from homeassistant.components.climate.const import (
SUPPORT_FAN_MODE,
SUPPORT_TARGET_HUMIDITY,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
@ -43,9 +44,11 @@ async def test_ecobee501_setup(hass):
SUPPORT_TARGET_TEMPERATURE
| SUPPORT_TARGET_TEMPERATURE_RANGE
| SUPPORT_TARGET_HUMIDITY
| SUPPORT_FAN_MODE
),
capabilities={
"hvac_modes": ["off", "heat", "cool", "heat_cool"],
"fan_modes": ["on", "auto"],
"min_temp": 7.2,
"max_temp": 33.3,
"min_humidity": 20,

View file

@ -1,6 +1,6 @@
"""Make sure that a H.A.A. fan can be setup."""
from homeassistant.components.fan import SUPPORT_SET_SPEED
from homeassistant.components.fan import ATTR_PERCENTAGE, SUPPORT_SET_SPEED
from homeassistant.helpers.entity import EntityCategory
from tests.components.homekit_controller.common import (
@ -18,7 +18,9 @@ async def test_haa_fan_setup(hass):
accessories = await setup_accessories_from_file(hass, "haa_fan.json")
await setup_test_accessories(hass, accessories)
# FIXME: assert round(state.attributes["percentage_step"], 2) == 33.33
haa_fan_state = hass.states.get("fan.haa_c718b3")
attributes = haa_fan_state.attributes
assert attributes[ATTR_PERCENTAGE] == 66
await assert_devices_and_entities_created(
hass,
@ -55,7 +57,7 @@ async def test_haa_fan_setup(hass):
entity_id="fan.haa_c718b3",
friendly_name="HAA-C718B3",
unique_id="homekit-C718B3-1-8",
state="off",
state="on",
supported_features=SUPPORT_SET_SPEED,
capabilities={
"preset_modes": None,