mirror of
https://github.com/home-assistant/core.git
synced 2025-09-04 04:11:37 +02:00
Use constants in Tuya tests (#150739)
This commit is contained in:
@@ -9,13 +9,16 @@ from syrupy.assertion import SnapshotAssertion
|
|||||||
from tuya_sharing import CustomerDevice
|
from tuya_sharing import CustomerDevice
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
|
ATTR_FAN_MODE,
|
||||||
|
ATTR_HUMIDITY,
|
||||||
|
ATTR_TEMPERATURE,
|
||||||
DOMAIN as CLIMATE_DOMAIN,
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_FAN_MODE,
|
SERVICE_SET_FAN_MODE,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
)
|
)
|
||||||
from homeassistant.components.tuya import ManagerCompat
|
from homeassistant.components.tuya import ManagerCompat
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceNotSupported
|
from homeassistant.exceptions import ServiceNotSupported
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@@ -60,11 +63,11 @@ async def test_set_temperature(
|
|||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"temperature": 22.7,
|
ATTR_TEMPERATURE: 22.7,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "temp_set", "value": 22}]
|
mock_device.id, [{"code": "temp_set", "value": 22}]
|
||||||
)
|
)
|
||||||
@@ -86,16 +89,16 @@ async def test_fan_mode_windspeed(
|
|||||||
|
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state is not None, f"{entity_id} does not exist"
|
assert state is not None, f"{entity_id} does not exist"
|
||||||
assert state.attributes["fan_mode"] == 1
|
assert state.attributes[ATTR_FAN_MODE] == 1
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_FAN_MODE,
|
SERVICE_SET_FAN_MODE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"fan_mode": 2,
|
ATTR_FAN_MODE: 2,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "windspeed", "value": "2"}]
|
mock_device.id, [{"code": "windspeed", "value": "2"}]
|
||||||
)
|
)
|
||||||
@@ -122,14 +125,14 @@ async def test_fan_mode_no_valid_code(
|
|||||||
|
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state is not None, f"{entity_id} does not exist"
|
assert state is not None, f"{entity_id} does not exist"
|
||||||
assert state.attributes.get("fan_mode") is None
|
assert state.attributes.get(ATTR_FAN_MODE) is None
|
||||||
with pytest.raises(ServiceNotSupported):
|
with pytest.raises(ServiceNotSupported):
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_FAN_MODE,
|
SERVICE_SET_FAN_MODE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"fan_mode": 2,
|
ATTR_FAN_MODE: 2,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
@@ -156,8 +159,8 @@ async def test_set_humidity_not_supported(
|
|||||||
CLIMATE_DOMAIN,
|
CLIMATE_DOMAIN,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"humidity": 50,
|
ATTR_HUMIDITY: 50,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
@@ -9,6 +9,9 @@ from syrupy.assertion import SnapshotAssertion
|
|||||||
from tuya_sharing import CustomerDevice
|
from tuya_sharing import CustomerDevice
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
|
ATTR_CURRENT_POSITION,
|
||||||
|
ATTR_POSITION,
|
||||||
|
ATTR_TILT_POSITION,
|
||||||
DOMAIN as COVER_DOMAIN,
|
DOMAIN as COVER_DOMAIN,
|
||||||
SERVICE_CLOSE_COVER,
|
SERVICE_CLOSE_COVER,
|
||||||
SERVICE_OPEN_COVER,
|
SERVICE_OPEN_COVER,
|
||||||
@@ -16,7 +19,7 @@ from homeassistant.components.cover import (
|
|||||||
SERVICE_SET_COVER_TILT_POSITION,
|
SERVICE_SET_COVER_TILT_POSITION,
|
||||||
)
|
)
|
||||||
from homeassistant.components.tuya import ManagerCompat
|
from homeassistant.components.tuya import ManagerCompat
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceNotSupported
|
from homeassistant.exceptions import ServiceNotSupported
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@@ -62,10 +65,10 @@ async def test_open_service(
|
|||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
SERVICE_OPEN_COVER,
|
SERVICE_OPEN_COVER,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id,
|
mock_device.id,
|
||||||
[
|
[
|
||||||
@@ -96,10 +99,10 @@ async def test_close_service(
|
|||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
SERVICE_CLOSE_COVER,
|
SERVICE_CLOSE_COVER,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id,
|
mock_device.id,
|
||||||
[
|
[
|
||||||
@@ -129,11 +132,11 @@ async def test_set_position(
|
|||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
SERVICE_SET_COVER_POSITION,
|
SERVICE_SET_COVER_POSITION,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"position": 25,
|
ATTR_POSITION: 25,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id,
|
mock_device.id,
|
||||||
[
|
[
|
||||||
@@ -173,7 +176,7 @@ async def test_percent_state_on_cover(
|
|||||||
|
|
||||||
state = hass.states.get(entity_id)
|
state = hass.states.get(entity_id)
|
||||||
assert state is not None, f"{entity_id} does not exist"
|
assert state is not None, f"{entity_id} does not exist"
|
||||||
assert state.attributes["current_position"] == percent_state
|
assert state.attributes[ATTR_CURRENT_POSITION] == percent_state
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -197,8 +200,8 @@ async def test_set_tilt_position_not_supported(
|
|||||||
COVER_DOMAIN,
|
COVER_DOMAIN,
|
||||||
SERVICE_SET_COVER_TILT_POSITION,
|
SERVICE_SET_COVER_TILT_POSITION,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"tilt_position": 50,
|
ATTR_TILT_POSITION: 50,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
@@ -9,13 +9,14 @@ from syrupy.assertion import SnapshotAssertion
|
|||||||
from tuya_sharing import CustomerDevice
|
from tuya_sharing import CustomerDevice
|
||||||
|
|
||||||
from homeassistant.components.humidifier import (
|
from homeassistant.components.humidifier import (
|
||||||
|
ATTR_HUMIDITY,
|
||||||
DOMAIN as HUMIDIFIER_DOMAIN,
|
DOMAIN as HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.components.tuya import ManagerCompat
|
from homeassistant.components.tuya import ManagerCompat
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@@ -59,9 +60,9 @@ async def test_turn_on(
|
|||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
HUMIDIFIER_DOMAIN,
|
HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
{"entity_id": entity_id},
|
{ATTR_ENTITY_ID: entity_id},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "switch", "value": True}]
|
mock_device.id, [{"code": "switch", "value": True}]
|
||||||
)
|
)
|
||||||
@@ -86,9 +87,9 @@ async def test_turn_off(
|
|||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
HUMIDIFIER_DOMAIN,
|
HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
{"entity_id": entity_id},
|
{ATTR_ENTITY_ID: entity_id},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "switch", "value": False}]
|
mock_device.id, [{"code": "switch", "value": False}]
|
||||||
)
|
)
|
||||||
@@ -114,11 +115,11 @@ async def test_set_humidity(
|
|||||||
HUMIDIFIER_DOMAIN,
|
HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"humidity": 50,
|
ATTR_HUMIDITY: 50,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "dehumidify_set_value", "value": 50}]
|
mock_device.id, [{"code": "dehumidify_set_value", "value": 50}]
|
||||||
)
|
)
|
||||||
@@ -149,7 +150,7 @@ async def test_turn_on_unsupported(
|
|||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
HUMIDIFIER_DOMAIN,
|
HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
{"entity_id": entity_id},
|
{ATTR_ENTITY_ID: entity_id},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
assert err.value.translation_key == "action_dpcode_not_found"
|
assert err.value.translation_key == "action_dpcode_not_found"
|
||||||
@@ -184,7 +185,7 @@ async def test_turn_off_unsupported(
|
|||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
HUMIDIFIER_DOMAIN,
|
HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
{"entity_id": entity_id},
|
{ATTR_ENTITY_ID: entity_id},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
assert err.value.translation_key == "action_dpcode_not_found"
|
assert err.value.translation_key == "action_dpcode_not_found"
|
||||||
@@ -220,8 +221,8 @@ async def test_set_humidity_unsupported(
|
|||||||
HUMIDIFIER_DOMAIN,
|
HUMIDIFIER_DOMAIN,
|
||||||
SERVICE_SET_HUMIDITY,
|
SERVICE_SET_HUMIDITY,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"humidity": 50,
|
ATTR_HUMIDITY: 50,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
@@ -10,12 +10,14 @@ from syrupy.assertion import SnapshotAssertion
|
|||||||
from tuya_sharing import CustomerDevice
|
from tuya_sharing import CustomerDevice
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
|
ATTR_BRIGHTNESS,
|
||||||
|
ATTR_WHITE,
|
||||||
DOMAIN as LIGHT_DOMAIN,
|
DOMAIN as LIGHT_DOMAIN,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
)
|
)
|
||||||
from homeassistant.components.tuya import ManagerCompat
|
from homeassistant.components.tuya import ManagerCompat
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ async def test_platform_setup_and_discovery(
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
"white": True,
|
ATTR_WHITE: True,
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
{"code": "switch_led", "value": True},
|
{"code": "switch_led", "value": True},
|
||||||
@@ -58,7 +60,7 @@ async def test_platform_setup_and_discovery(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
"brightness": 150,
|
ATTR_BRIGHTNESS: 150,
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
{"code": "switch_led", "value": True},
|
{"code": "switch_led", "value": True},
|
||||||
@@ -67,8 +69,8 @@ async def test_platform_setup_and_discovery(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
"white": True,
|
ATTR_WHITE: True,
|
||||||
"brightness": 150,
|
ATTR_BRIGHTNESS: 150,
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
{"code": "switch_led", "value": True},
|
{"code": "switch_led", "value": True},
|
||||||
@@ -78,7 +80,7 @@ async def test_platform_setup_and_discovery(
|
|||||||
),
|
),
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
"white": 150,
|
ATTR_WHITE: 150,
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
{"code": "switch_led", "value": True},
|
{"code": "switch_led", "value": True},
|
||||||
@@ -106,11 +108,11 @@ async def test_turn_on_white(
|
|||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
SERVICE_TURN_ON,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
**turn_on_input,
|
**turn_on_input,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id,
|
mock_device.id,
|
||||||
expected_commands,
|
expected_commands,
|
||||||
@@ -137,10 +139,10 @@ async def test_turn_off(
|
|||||||
LIGHT_DOMAIN,
|
LIGHT_DOMAIN,
|
||||||
SERVICE_TURN_OFF,
|
SERVICE_TURN_OFF,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "switch_led", "value": False}]
|
mock_device.id, [{"code": "switch_led", "value": False}]
|
||||||
)
|
)
|
||||||
|
@@ -8,9 +8,13 @@ import pytest
|
|||||||
from syrupy.assertion import SnapshotAssertion
|
from syrupy.assertion import SnapshotAssertion
|
||||||
from tuya_sharing import CustomerDevice
|
from tuya_sharing import CustomerDevice
|
||||||
|
|
||||||
from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN, SERVICE_SET_VALUE
|
from homeassistant.components.number import (
|
||||||
|
ATTR_VALUE,
|
||||||
|
DOMAIN as NUMBER_DOMAIN,
|
||||||
|
SERVICE_SET_VALUE,
|
||||||
|
)
|
||||||
from homeassistant.components.tuya import ManagerCompat
|
from homeassistant.components.tuya import ManagerCompat
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@@ -55,11 +59,11 @@ async def test_set_value(
|
|||||||
NUMBER_DOMAIN,
|
NUMBER_DOMAIN,
|
||||||
SERVICE_SET_VALUE,
|
SERVICE_SET_VALUE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"value": 18,
|
ATTR_VALUE: 18,
|
||||||
},
|
},
|
||||||
|
blocking=True,
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
|
||||||
mock_manager.send_commands.assert_called_once_with(
|
mock_manager.send_commands.assert_called_once_with(
|
||||||
mock_device.id, [{"code": "delay_set", "value": 18}]
|
mock_device.id, [{"code": "delay_set", "value": 18}]
|
||||||
)
|
)
|
||||||
@@ -91,8 +95,8 @@ async def test_set_value_no_function(
|
|||||||
NUMBER_DOMAIN,
|
NUMBER_DOMAIN,
|
||||||
SERVICE_SET_VALUE,
|
SERVICE_SET_VALUE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"value": 18,
|
ATTR_VALUE: 18,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
@@ -9,11 +9,12 @@ from syrupy.assertion import SnapshotAssertion
|
|||||||
from tuya_sharing import CustomerDevice
|
from tuya_sharing import CustomerDevice
|
||||||
|
|
||||||
from homeassistant.components.select import (
|
from homeassistant.components.select import (
|
||||||
|
ATTR_OPTION,
|
||||||
DOMAIN as SELECT_DOMAIN,
|
DOMAIN as SELECT_DOMAIN,
|
||||||
SERVICE_SELECT_OPTION,
|
SERVICE_SELECT_OPTION,
|
||||||
)
|
)
|
||||||
from homeassistant.components.tuya import ManagerCompat
|
from homeassistant.components.tuya import ManagerCompat
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ServiceValidationError
|
from homeassistant.exceptions import ServiceValidationError
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@@ -58,8 +59,8 @@ async def test_select_option(
|
|||||||
SELECT_DOMAIN,
|
SELECT_DOMAIN,
|
||||||
SERVICE_SELECT_OPTION,
|
SERVICE_SELECT_OPTION,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"option": "forward",
|
ATTR_OPTION: "forward",
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
@@ -89,8 +90,8 @@ async def test_select_invalid_option(
|
|||||||
SELECT_DOMAIN,
|
SELECT_DOMAIN,
|
||||||
SERVICE_SELECT_OPTION,
|
SERVICE_SELECT_OPTION,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
"option": "hello",
|
ATTR_OPTION: "hello",
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
@@ -13,7 +13,7 @@ from homeassistant.components.vacuum import (
|
|||||||
DOMAIN as VACUUM_DOMAIN,
|
DOMAIN as VACUUM_DOMAIN,
|
||||||
SERVICE_RETURN_TO_BASE,
|
SERVICE_RETURN_TO_BASE,
|
||||||
)
|
)
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ async def test_return_home(
|
|||||||
VACUUM_DOMAIN,
|
VACUUM_DOMAIN,
|
||||||
SERVICE_RETURN_TO_BASE,
|
SERVICE_RETURN_TO_BASE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
@@ -14,7 +14,7 @@ from homeassistant.components.valve import (
|
|||||||
SERVICE_CLOSE_VALVE,
|
SERVICE_CLOSE_VALVE,
|
||||||
SERVICE_OPEN_VALVE,
|
SERVICE_OPEN_VALVE,
|
||||||
)
|
)
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ async def test_open_valve(
|
|||||||
VALVE_DOMAIN,
|
VALVE_DOMAIN,
|
||||||
SERVICE_OPEN_VALVE,
|
SERVICE_OPEN_VALVE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
@@ -87,7 +87,7 @@ async def test_close_valve(
|
|||||||
VALVE_DOMAIN,
|
VALVE_DOMAIN,
|
||||||
SERVICE_CLOSE_VALVE,
|
SERVICE_CLOSE_VALVE,
|
||||||
{
|
{
|
||||||
"entity_id": entity_id,
|
ATTR_ENTITY_ID: entity_id,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user