mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update homekit entity feature constants (#98337)
This commit is contained in:
parent
a74d83de66
commit
b36681b318
@ -3,8 +3,8 @@ from unittest.mock import Mock, patch
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import homeassistant.components.climate as climate
|
from homeassistant.components.climate import ClimateEntityFeature
|
||||||
import homeassistant.components.cover as cover
|
from homeassistant.components.cover import CoverEntityFeature
|
||||||
from homeassistant.components.homekit.accessories import TYPES, get_accessory
|
from homeassistant.components.homekit.accessories import TYPES, get_accessory
|
||||||
from homeassistant.components.homekit.const import (
|
from homeassistant.components.homekit.const import (
|
||||||
ATTR_INTEGRATION,
|
ATTR_INTEGRATION,
|
||||||
@ -17,9 +17,9 @@ from homeassistant.components.homekit.const import (
|
|||||||
TYPE_SWITCH,
|
TYPE_SWITCH,
|
||||||
TYPE_VALVE,
|
TYPE_VALVE,
|
||||||
)
|
)
|
||||||
import homeassistant.components.media_player.const as media_player_c
|
from homeassistant.components.media_player import MediaPlayerEntityFeature
|
||||||
from homeassistant.components.sensor import SensorDeviceClass
|
from homeassistant.components.sensor import SensorDeviceClass
|
||||||
import homeassistant.components.vacuum as vacuum
|
from homeassistant.components.vacuum import VacuumEntityFeature
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_CODE,
|
ATTR_CODE,
|
||||||
ATTR_DEVICE_CLASS,
|
ATTR_DEVICE_CLASS,
|
||||||
@ -90,7 +90,7 @@ def test_customize_options(config, name) -> None:
|
|||||||
"Thermostat",
|
"Thermostat",
|
||||||
"climate.test",
|
"climate.test",
|
||||||
"auto",
|
"auto",
|
||||||
{ATTR_SUPPORTED_FEATURES: climate.SUPPORT_TARGET_TEMPERATURE_RANGE},
|
{ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE_RANGE},
|
||||||
{},
|
{},
|
||||||
),
|
),
|
||||||
("HumidifierDehumidifier", "humidifier.test", "auto", {}, {}),
|
("HumidifierDehumidifier", "humidifier.test", "auto", {}, {}),
|
||||||
@ -118,7 +118,8 @@ def test_types(type_name, entity_id, state, attrs, config) -> None:
|
|||||||
"open",
|
"open",
|
||||||
{
|
{
|
||||||
ATTR_DEVICE_CLASS: "garage",
|
ATTR_DEVICE_CLASS: "garage",
|
||||||
ATTR_SUPPORTED_FEATURES: cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE,
|
ATTR_SUPPORTED_FEATURES: CoverEntityFeature.OPEN
|
||||||
|
| CoverEntityFeature.CLOSE,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@ -127,26 +128,20 @@ def test_types(type_name, entity_id, state, attrs, config) -> None:
|
|||||||
"open",
|
"open",
|
||||||
{
|
{
|
||||||
ATTR_DEVICE_CLASS: "window",
|
ATTR_DEVICE_CLASS: "window",
|
||||||
ATTR_SUPPORTED_FEATURES: cover.SUPPORT_SET_POSITION,
|
ATTR_SUPPORTED_FEATURES: CoverEntityFeature.SET_POSITION,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"WindowCovering",
|
"WindowCovering",
|
||||||
"cover.set_position",
|
"cover.set_position",
|
||||||
"open",
|
"open",
|
||||||
{ATTR_SUPPORTED_FEATURES: cover.SUPPORT_SET_POSITION},
|
{ATTR_SUPPORTED_FEATURES: CoverEntityFeature.SET_POSITION},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"WindowCovering",
|
"WindowCovering",
|
||||||
"cover.tilt",
|
"cover.tilt",
|
||||||
"open",
|
"open",
|
||||||
{ATTR_SUPPORTED_FEATURES: cover.SUPPORT_SET_TILT_POSITION},
|
{ATTR_SUPPORTED_FEATURES: CoverEntityFeature.SET_TILT_POSITION},
|
||||||
),
|
|
||||||
(
|
|
||||||
"WindowCoveringBasic",
|
|
||||||
"cover.open_window",
|
|
||||||
"open",
|
|
||||||
{ATTR_SUPPORTED_FEATURES: (cover.SUPPORT_OPEN | cover.SUPPORT_CLOSE)},
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"WindowCoveringBasic",
|
"WindowCoveringBasic",
|
||||||
@ -154,9 +149,19 @@ def test_types(type_name, entity_id, state, attrs, config) -> None:
|
|||||||
"open",
|
"open",
|
||||||
{
|
{
|
||||||
ATTR_SUPPORTED_FEATURES: (
|
ATTR_SUPPORTED_FEATURES: (
|
||||||
cover.SUPPORT_OPEN
|
CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE
|
||||||
| cover.SUPPORT_CLOSE
|
)
|
||||||
| cover.SUPPORT_SET_TILT_POSITION
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"WindowCoveringBasic",
|
||||||
|
"cover.open_window",
|
||||||
|
"open",
|
||||||
|
{
|
||||||
|
ATTR_SUPPORTED_FEATURES: (
|
||||||
|
CoverEntityFeature.OPEN
|
||||||
|
| CoverEntityFeature.CLOSE
|
||||||
|
| CoverEntityFeature.SET_TILT_POSITION
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -166,7 +171,7 @@ def test_types(type_name, entity_id, state, attrs, config) -> None:
|
|||||||
"open",
|
"open",
|
||||||
{
|
{
|
||||||
ATTR_DEVICE_CLASS: "door",
|
ATTR_DEVICE_CLASS: "door",
|
||||||
ATTR_SUPPORTED_FEATURES: cover.SUPPORT_SET_POSITION,
|
ATTR_SUPPORTED_FEATURES: CoverEntityFeature.SET_POSITION,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -188,8 +193,8 @@ def test_type_covers(type_name, entity_id, state, attrs) -> None:
|
|||||||
"media_player.test",
|
"media_player.test",
|
||||||
"on",
|
"on",
|
||||||
{
|
{
|
||||||
ATTR_SUPPORTED_FEATURES: media_player_c.MediaPlayerEntityFeature.TURN_ON
|
ATTR_SUPPORTED_FEATURES: MediaPlayerEntityFeature.TURN_ON
|
||||||
| media_player_c.MediaPlayerEntityFeature.TURN_OFF
|
| MediaPlayerEntityFeature.TURN_OFF
|
||||||
},
|
},
|
||||||
{CONF_FEATURE_LIST: {FEATURE_ON_OFF: None}},
|
{CONF_FEATURE_LIST: {FEATURE_ON_OFF: None}},
|
||||||
),
|
),
|
||||||
@ -334,8 +339,8 @@ def test_type_switches(type_name, entity_id, state, attrs, config) -> None:
|
|||||||
"vacuum.dock_vacuum",
|
"vacuum.dock_vacuum",
|
||||||
"docked",
|
"docked",
|
||||||
{
|
{
|
||||||
ATTR_SUPPORTED_FEATURES: vacuum.SUPPORT_START
|
ATTR_SUPPORTED_FEATURES: VacuumEntityFeature.START
|
||||||
| vacuum.SUPPORT_RETURN_HOME
|
| VacuumEntityFeature.RETURN_HOME
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
("Vacuum", "vacuum.basic_vacuum", "off", {}),
|
("Vacuum", "vacuum.basic_vacuum", "off", {}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user