mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Add alias to DOMAIN import in tests [h-m] (#125577)
* Add alias to DOMAIN import in tests [h-m] * Revert changes to mqtt
This commit is contained in:
parent
aab939cf6c
commit
6ea59ffa94
@ -13,7 +13,7 @@ from homeassistant.components.home_connect.const import (
|
||||
COOKING_LIGHTING,
|
||||
COOKING_LIGHTING_BRIGHTNESS,
|
||||
)
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
SERVICE_TURN_OFF,
|
||||
@ -176,7 +176,7 @@ async def test_light_functionality(
|
||||
appliance.status.update(status)
|
||||
service_data["entity_id"] = entity_id
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
LIGHT_DOMAIN,
|
||||
service,
|
||||
service_data,
|
||||
blocking=True,
|
||||
@ -294,5 +294,5 @@ async def test_switch_exception_handling(
|
||||
|
||||
problematic_appliance.status.update(status)
|
||||
service_data["entity_id"] = entity_id
|
||||
await hass.services.async_call(DOMAIN, service, service_data, blocking=True)
|
||||
await hass.services.async_call(LIGHT_DOMAIN, service, service_data, blocking=True)
|
||||
assert getattr(problematic_appliance, mock_attr).call_count == len(attr_side_effect)
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.components.home_connect.const import (
|
||||
BSH_POWER_STATE,
|
||||
REFRIGERATION_SUPERMODEFREEZER,
|
||||
)
|
||||
from homeassistant.components.switch import DOMAIN
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
@ -139,7 +139,7 @@ async def test_switch_functionality(
|
||||
|
||||
appliance.status.update(status)
|
||||
await hass.services.async_call(
|
||||
DOMAIN, service, {"entity_id": entity_id}, blocking=True
|
||||
SWITCH_DOMAIN, service, {"entity_id": entity_id}, blocking=True
|
||||
)
|
||||
assert hass.states.is_state(entity_id, state)
|
||||
|
||||
@ -213,7 +213,7 @@ async def test_switch_exception_handling(
|
||||
|
||||
problematic_appliance.status.update(status)
|
||||
await hass.services.async_call(
|
||||
DOMAIN, service, {"entity_id": entity_id}, blocking=True
|
||||
SWITCH_DOMAIN, service, {"entity_id": entity_id}, blocking=True
|
||||
)
|
||||
assert getattr(problematic_appliance, mock_attr).call_count == 2
|
||||
|
||||
@ -268,7 +268,7 @@ async def test_ent_desc_switch_functionality(
|
||||
|
||||
appliance.status.update(status)
|
||||
await hass.services.async_call(
|
||||
DOMAIN, service, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
SWITCH_DOMAIN, service, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
assert hass.states.is_state(entity_id, state)
|
||||
|
||||
@ -327,6 +327,6 @@ async def test_ent_desc_switch_exception_handling(
|
||||
|
||||
problematic_appliance.status.update(status)
|
||||
await hass.services.async_call(
|
||||
DOMAIN, service, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
SWITCH_DOMAIN, service, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
assert getattr(problematic_appliance, mock_attr).call_count == 2
|
||||
|
@ -5,7 +5,7 @@ from homeassistant.components.cover import (
|
||||
ATTR_CURRENT_TILT_POSITION,
|
||||
ATTR_POSITION,
|
||||
ATTR_TILT_POSITION,
|
||||
DOMAIN,
|
||||
DOMAIN as COVER_DOMAIN,
|
||||
CoverEntityFeature,
|
||||
)
|
||||
from homeassistant.components.homekit.const import (
|
||||
@ -92,8 +92,8 @@ async def test_garage_door_open_close(
|
||||
assert acc.available is True
|
||||
|
||||
# Set from HomeKit
|
||||
call_close_cover = async_mock_service(hass, DOMAIN, "close_cover")
|
||||
call_open_cover = async_mock_service(hass, DOMAIN, "open_cover")
|
||||
call_close_cover = async_mock_service(hass, COVER_DOMAIN, "close_cover")
|
||||
call_open_cover = async_mock_service(hass, COVER_DOMAIN, "open_cover")
|
||||
|
||||
acc.char_target_state.client_update_value(1)
|
||||
await hass.async_block_till_done()
|
||||
@ -272,7 +272,9 @@ async def test_windowcovering_set_cover_position(
|
||||
assert acc.char_position_state.value == 2
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_cover_position = async_mock_service(hass, DOMAIN, "set_cover_position")
|
||||
call_set_cover_position = async_mock_service(
|
||||
hass, COVER_DOMAIN, "set_cover_position"
|
||||
)
|
||||
|
||||
acc.char_target_position.client_update_value(25)
|
||||
await hass.async_block_till_done()
|
||||
@ -389,7 +391,7 @@ async def test_windowcovering_cover_set_tilt(
|
||||
|
||||
# set from HomeKit
|
||||
call_set_tilt_position = async_mock_service(
|
||||
hass, DOMAIN, SERVICE_SET_COVER_TILT_POSITION
|
||||
hass, COVER_DOMAIN, SERVICE_SET_COVER_TILT_POSITION
|
||||
)
|
||||
|
||||
# HomeKit sets tilts between -90 and 90 (degrees), whereas
|
||||
@ -488,8 +490,8 @@ async def test_windowcovering_open_close(
|
||||
assert acc.char_position_state.value == 2
|
||||
|
||||
# Set from HomeKit
|
||||
call_close_cover = async_mock_service(hass, DOMAIN, "close_cover")
|
||||
call_open_cover = async_mock_service(hass, DOMAIN, "open_cover")
|
||||
call_close_cover = async_mock_service(hass, COVER_DOMAIN, "close_cover")
|
||||
call_open_cover = async_mock_service(hass, COVER_DOMAIN, "open_cover")
|
||||
|
||||
acc.char_target_position.client_update_value(25)
|
||||
await hass.async_block_till_done()
|
||||
@ -536,9 +538,9 @@ async def test_windowcovering_open_close_stop(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Set from HomeKit
|
||||
call_close_cover = async_mock_service(hass, DOMAIN, "close_cover")
|
||||
call_open_cover = async_mock_service(hass, DOMAIN, "open_cover")
|
||||
call_stop_cover = async_mock_service(hass, DOMAIN, "stop_cover")
|
||||
call_close_cover = async_mock_service(hass, COVER_DOMAIN, "close_cover")
|
||||
call_open_cover = async_mock_service(hass, COVER_DOMAIN, "open_cover")
|
||||
call_stop_cover = async_mock_service(hass, COVER_DOMAIN, "stop_cover")
|
||||
|
||||
acc.char_target_position.client_update_value(25)
|
||||
await hass.async_block_till_done()
|
||||
@ -590,7 +592,7 @@ async def test_windowcovering_open_close_with_position_and_stop(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Set from HomeKit
|
||||
call_stop_cover = async_mock_service(hass, DOMAIN, "stop_cover")
|
||||
call_stop_cover = async_mock_service(hass, COVER_DOMAIN, "stop_cover")
|
||||
|
||||
acc.char_hold_position.client_update_value(0)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.components.fan import (
|
||||
ATTR_PRESET_MODES,
|
||||
DIRECTION_FORWARD,
|
||||
DIRECTION_REVERSE,
|
||||
DOMAIN,
|
||||
DOMAIN as FAN_DOMAIN,
|
||||
FanEntityFeature,
|
||||
)
|
||||
from homeassistant.components.homekit.const import ATTR_VALUE, PROP_MIN_STEP
|
||||
@ -63,8 +63,8 @@ async def test_fan_basic(hass: HomeAssistant, hk_driver, events: list[Event]) ->
|
||||
assert acc.char_active.value == 0
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_turn_on = async_mock_service(hass, FAN_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, FAN_DOMAIN, "turn_off")
|
||||
|
||||
char_active_iid = acc.char_active.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -144,7 +144,7 @@ async def test_fan_direction(
|
||||
assert acc.char_direction.value == 1
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_direction = async_mock_service(hass, DOMAIN, "set_direction")
|
||||
call_set_direction = async_mock_service(hass, FAN_DOMAIN, "set_direction")
|
||||
|
||||
char_direction_iid = acc.char_direction.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -218,7 +218,7 @@ async def test_fan_oscillate(
|
||||
assert acc.char_swing.value == 1
|
||||
|
||||
# Set from HomeKit
|
||||
call_oscillate = async_mock_service(hass, DOMAIN, "oscillate")
|
||||
call_oscillate = async_mock_service(hass, FAN_DOMAIN, "oscillate")
|
||||
|
||||
char_swing_iid = acc.char_swing.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -301,7 +301,7 @@ async def test_fan_speed(hass: HomeAssistant, hk_driver, events: list[Event]) ->
|
||||
assert acc.char_speed.value == 100
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_percentage = async_mock_service(hass, DOMAIN, "set_percentage")
|
||||
call_set_percentage = async_mock_service(hass, FAN_DOMAIN, "set_percentage")
|
||||
|
||||
char_speed_iid = acc.char_speed.to_HAP()[HAP_REPR_IID]
|
||||
char_active_iid = acc.char_active.to_HAP()[HAP_REPR_IID]
|
||||
@ -343,7 +343,7 @@ async def test_fan_speed(hass: HomeAssistant, hk_driver, events: list[Event]) ->
|
||||
assert acc.char_speed.value == 50
|
||||
assert acc.char_active.value == 0
|
||||
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, FAN_DOMAIN, "turn_on")
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
@ -409,11 +409,11 @@ async def test_fan_set_all_one_shot(
|
||||
assert hass.states.get(entity_id).state == STATE_OFF
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_percentage = async_mock_service(hass, DOMAIN, "set_percentage")
|
||||
call_oscillate = async_mock_service(hass, DOMAIN, "oscillate")
|
||||
call_set_direction = async_mock_service(hass, DOMAIN, "set_direction")
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_set_percentage = async_mock_service(hass, FAN_DOMAIN, "set_percentage")
|
||||
call_oscillate = async_mock_service(hass, FAN_DOMAIN, "oscillate")
|
||||
call_set_direction = async_mock_service(hass, FAN_DOMAIN, "set_direction")
|
||||
call_turn_on = async_mock_service(hass, FAN_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, FAN_DOMAIN, "turn_off")
|
||||
|
||||
char_active_iid = acc.char_active.to_HAP()[HAP_REPR_IID]
|
||||
char_direction_iid = acc.char_direction.to_HAP()[HAP_REPR_IID]
|
||||
@ -641,8 +641,8 @@ async def test_fan_multiple_preset_modes(
|
||||
assert acc.preset_mode_chars["auto"].value == 0
|
||||
assert acc.preset_mode_chars["smart"].value == 1
|
||||
# Set from HomeKit
|
||||
call_set_preset_mode = async_mock_service(hass, DOMAIN, "set_preset_mode")
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_set_preset_mode = async_mock_service(hass, FAN_DOMAIN, "set_preset_mode")
|
||||
call_turn_on = async_mock_service(hass, FAN_DOMAIN, "turn_on")
|
||||
|
||||
char_auto_iid = acc.preset_mode_chars["auto"].to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -711,8 +711,8 @@ async def test_fan_single_preset_mode(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_preset_mode = async_mock_service(hass, DOMAIN, "set_preset_mode")
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_set_preset_mode = async_mock_service(hass, FAN_DOMAIN, "set_preset_mode")
|
||||
call_turn_on = async_mock_service(hass, FAN_DOMAIN, "turn_on")
|
||||
|
||||
char_target_fan_state_iid = acc.char_target_fan_state.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
|
@ -26,7 +26,7 @@ from homeassistant.components.humidifier import (
|
||||
ATTR_MIN_HUMIDITY,
|
||||
DEFAULT_MAX_HUMIDITY,
|
||||
DEFAULT_MIN_HUMIDITY,
|
||||
DOMAIN,
|
||||
DOMAIN as HUMIDIFIER_DOMAIN,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
HumidifierDeviceClass,
|
||||
)
|
||||
@ -106,7 +106,9 @@ async def test_humidifier(hass: HomeAssistant, hk_driver, events: list[Event]) -
|
||||
assert acc.char_active.value == 0
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_humidity = async_mock_service(hass, DOMAIN, SERVICE_SET_HUMIDITY)
|
||||
call_set_humidity = async_mock_service(
|
||||
hass, HUMIDIFIER_DOMAIN, SERVICE_SET_HUMIDITY
|
||||
)
|
||||
|
||||
char_target_humidity_iid = acc.char_target_humidity.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -194,7 +196,9 @@ async def test_dehumidifier(
|
||||
assert acc.char_active.value == 0
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_humidity = async_mock_service(hass, DOMAIN, SERVICE_SET_HUMIDITY)
|
||||
call_set_humidity = async_mock_service(
|
||||
hass, HUMIDIFIER_DOMAIN, SERVICE_SET_HUMIDITY
|
||||
)
|
||||
|
||||
char_target_humidity_iid = acc.char_target_humidity.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -257,7 +261,7 @@ async def test_hygrostat_power_state(
|
||||
assert acc.char_active.value == 0
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, SERVICE_TURN_ON)
|
||||
call_turn_on = async_mock_service(hass, HUMIDIFIER_DOMAIN, SERVICE_TURN_ON)
|
||||
|
||||
char_active_iid = acc.char_active.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -281,7 +285,7 @@ async def test_hygrostat_power_state(
|
||||
assert len(events) == 1
|
||||
assert events[-1].data[ATTR_VALUE] == "Active to 1"
|
||||
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, SERVICE_TURN_OFF)
|
||||
call_turn_off = async_mock_service(hass, HUMIDIFIER_DOMAIN, SERVICE_TURN_OFF)
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
@ -323,7 +327,9 @@ async def test_hygrostat_get_humidity_range(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Set from HomeKit
|
||||
call_set_humidity = async_mock_service(hass, DOMAIN, SERVICE_SET_HUMIDITY)
|
||||
call_set_humidity = async_mock_service(
|
||||
hass, HUMIDIFIER_DOMAIN, SERVICE_SET_HUMIDITY
|
||||
)
|
||||
|
||||
char_target_humidity_iid = acc.char_target_humidity.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
|
@ -27,7 +27,7 @@ from homeassistant.components.light import (
|
||||
ATTR_RGBWW_COLOR,
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
ATTR_WHITE,
|
||||
DOMAIN,
|
||||
DOMAIN as LIGHT_DOMAIN,
|
||||
ColorMode,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
@ -83,8 +83,8 @@ async def test_light_basic(hass: HomeAssistant, hk_driver, events: list[Event])
|
||||
assert acc.char_on.value == 0
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, LIGHT_DOMAIN, "turn_off")
|
||||
|
||||
char_on_iid = acc.char_on.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -160,8 +160,8 @@ async def test_light_brightness(
|
||||
assert acc.char_brightness.value == 40
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, LIGHT_DOMAIN, "turn_off")
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
@ -296,7 +296,7 @@ async def test_light_color_temperature(
|
||||
assert acc.char_color_temp.value == 190
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_color_temp_iid = acc.char_color_temp.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
@ -372,7 +372,7 @@ async def test_light_color_temperature_and_rgb_color(
|
||||
char_color_temp_iid = acc.char_color_temp.to_HAP()[HAP_REPR_IID]
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
@ -549,7 +549,7 @@ async def test_light_rgb_color(
|
||||
assert acc.char_saturation.value == 90
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_hue_iid = acc.char_hue.to_HAP()[HAP_REPR_IID]
|
||||
char_saturation_iid = acc.char_saturation.to_HAP()[HAP_REPR_IID]
|
||||
@ -671,7 +671,7 @@ async def test_light_rgb_with_color_temp(
|
||||
assert acc.char_brightness.value == 100
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_hue_iid = acc.char_hue.to_HAP()[HAP_REPR_IID]
|
||||
char_saturation_iid = acc.char_saturation.to_HAP()[HAP_REPR_IID]
|
||||
@ -791,7 +791,7 @@ async def test_light_rgbwx_with_color_temp_and_brightness(
|
||||
assert acc.char_brightness.value == 100
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_color_temp_iid = acc.char_color_temp.to_HAP()[HAP_REPR_IID]
|
||||
char_brightness_iid = acc.char_brightness.to_HAP()[HAP_REPR_IID]
|
||||
@ -858,7 +858,7 @@ async def test_light_rgb_or_w_lights(
|
||||
assert acc.char_color_temp.value == 153
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_hue_iid = acc.char_hue.to_HAP()[HAP_REPR_IID]
|
||||
char_saturation_iid = acc.char_saturation.to_HAP()[HAP_REPR_IID]
|
||||
@ -985,7 +985,7 @@ async def test_light_rgb_with_white_switch_to_temp(
|
||||
assert acc.char_brightness.value == 100
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_hue_iid = acc.char_hue.to_HAP()[HAP_REPR_IID]
|
||||
char_saturation_iid = acc.char_saturation.to_HAP()[HAP_REPR_IID]
|
||||
@ -1100,7 +1100,7 @@ async def test_light_rgbww_with_color_temp_conversion(
|
||||
assert acc.char_brightness.value == 100
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_hue_iid = acc.char_hue.to_HAP()[HAP_REPR_IID]
|
||||
char_saturation_iid = acc.char_saturation.to_HAP()[HAP_REPR_IID]
|
||||
@ -1221,7 +1221,7 @@ async def test_light_rgbw_with_color_temp_conversion(
|
||||
assert acc.char_brightness.value == 100
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
char_hue_iid = acc.char_hue.to_HAP()[HAP_REPR_IID]
|
||||
char_saturation_iid = acc.char_saturation.to_HAP()[HAP_REPR_IID]
|
||||
@ -1325,7 +1325,7 @@ async def test_light_set_brightness_and_color(
|
||||
assert acc.char_saturation.value == 9
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
@ -1432,7 +1432,7 @@ async def test_light_set_brightness_and_color_temp(
|
||||
assert acc.char_color_temp.value == 224
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_on = async_mock_service(hass, LIGHT_DOMAIN, "turn_on")
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ import pytest
|
||||
from homeassistant.components.homekit.const import ATTR_VALUE
|
||||
from homeassistant.components.homekit.type_locks import Lock
|
||||
from homeassistant.components.lock import (
|
||||
DOMAIN,
|
||||
DOMAIN as LOCK_DOMAIN,
|
||||
STATE_JAMMED,
|
||||
STATE_LOCKING,
|
||||
STATE_UNLOCKING,
|
||||
@ -98,8 +98,8 @@ async def test_lock_unlock(hass: HomeAssistant, hk_driver, events: list[Event])
|
||||
assert acc.char_target_state.value == 0
|
||||
|
||||
# Set from HomeKit
|
||||
call_lock = async_mock_service(hass, DOMAIN, "lock")
|
||||
call_unlock = async_mock_service(hass, DOMAIN, "unlock")
|
||||
call_lock = async_mock_service(hass, LOCK_DOMAIN, "lock")
|
||||
call_unlock = async_mock_service(hass, LOCK_DOMAIN, "unlock")
|
||||
|
||||
acc.char_target_state.client_update_value(1)
|
||||
await hass.async_block_till_done()
|
||||
@ -132,7 +132,7 @@ async def test_no_code(
|
||||
acc = Lock(hass, hk_driver, "Lock", entity_id, 2, config)
|
||||
|
||||
# Set from HomeKit
|
||||
call_lock = async_mock_service(hass, DOMAIN, "lock")
|
||||
call_lock = async_mock_service(hass, LOCK_DOMAIN, "lock")
|
||||
|
||||
acc.char_target_state.client_update_value(1)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -25,7 +25,7 @@ from homeassistant.components.media_player import (
|
||||
ATTR_INPUT_SOURCE_LIST,
|
||||
ATTR_MEDIA_VOLUME_LEVEL,
|
||||
ATTR_MEDIA_VOLUME_MUTED,
|
||||
DOMAIN,
|
||||
DOMAIN as MEDIA_PLAYER_DOMAIN,
|
||||
MediaPlayerDeviceClass,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
@ -112,12 +112,12 @@ async def test_media_player_set_state(
|
||||
assert acc.chars[FEATURE_PLAY_STOP].value is False
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_media_play = async_mock_service(hass, DOMAIN, "media_play")
|
||||
call_media_pause = async_mock_service(hass, DOMAIN, "media_pause")
|
||||
call_media_stop = async_mock_service(hass, DOMAIN, "media_stop")
|
||||
call_toggle_mute = async_mock_service(hass, DOMAIN, "volume_mute")
|
||||
call_turn_on = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "turn_off")
|
||||
call_media_play = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "media_play")
|
||||
call_media_pause = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "media_pause")
|
||||
call_media_stop = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "media_stop")
|
||||
call_toggle_mute = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "volume_mute")
|
||||
|
||||
acc.chars[FEATURE_ON_OFF].client_update_value(True)
|
||||
await hass.async_block_till_done()
|
||||
@ -252,16 +252,18 @@ async def test_media_player_television(
|
||||
assert caplog.records[-2].levelname == "DEBUG"
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_media_play = async_mock_service(hass, DOMAIN, "media_play")
|
||||
call_media_pause = async_mock_service(hass, DOMAIN, "media_pause")
|
||||
call_media_play_pause = async_mock_service(hass, DOMAIN, "media_play_pause")
|
||||
call_toggle_mute = async_mock_service(hass, DOMAIN, "volume_mute")
|
||||
call_select_source = async_mock_service(hass, DOMAIN, "select_source")
|
||||
call_volume_up = async_mock_service(hass, DOMAIN, "volume_up")
|
||||
call_volume_down = async_mock_service(hass, DOMAIN, "volume_down")
|
||||
call_volume_set = async_mock_service(hass, DOMAIN, "volume_set")
|
||||
call_turn_on = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "turn_off")
|
||||
call_media_play = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "media_play")
|
||||
call_media_pause = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "media_pause")
|
||||
call_media_play_pause = async_mock_service(
|
||||
hass, MEDIA_PLAYER_DOMAIN, "media_play_pause"
|
||||
)
|
||||
call_toggle_mute = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "volume_mute")
|
||||
call_select_source = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "select_source")
|
||||
call_volume_up = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "volume_up")
|
||||
call_volume_down = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "volume_down")
|
||||
call_volume_set = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "volume_set")
|
||||
|
||||
acc.char_active.client_update_value(1)
|
||||
await hass.async_block_till_done()
|
||||
@ -634,7 +636,7 @@ async def test_media_player_television_unsafe_chars(
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_input_source.value == 1
|
||||
|
||||
call_select_source = async_mock_service(hass, DOMAIN, "select_source")
|
||||
call_select_source = async_mock_service(hass, MEDIA_PLAYER_DOMAIN, "select_source")
|
||||
|
||||
acc.char_input_source.client_update_value(3)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.components.remote import (
|
||||
ATTR_ACTIVITY,
|
||||
ATTR_ACTIVITY_LIST,
|
||||
ATTR_CURRENT_ACTIVITY,
|
||||
DOMAIN,
|
||||
DOMAIN as REMOTE_DOMAIN,
|
||||
RemoteEntityFeature,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
@ -91,8 +91,8 @@ async def test_activity_remote(
|
||||
assert acc.char_input_source.value == 1
|
||||
|
||||
# Set from HomeKit
|
||||
call_turn_on = async_mock_service(hass, DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, DOMAIN, "turn_off")
|
||||
call_turn_on = async_mock_service(hass, REMOTE_DOMAIN, "turn_on")
|
||||
call_turn_off = async_mock_service(hass, REMOTE_DOMAIN, "turn_off")
|
||||
|
||||
acc.char_active.client_update_value(1)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -4,7 +4,7 @@ from pyhap.loader import get_loader
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN,
|
||||
DOMAIN as ALARM_CONTROL_PANEL_DOMAIN,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
from homeassistant.components.homekit.const import ATTR_VALUE
|
||||
@ -77,10 +77,16 @@ async def test_switch_set_state(
|
||||
assert acc.char_current_state.value == 4
|
||||
|
||||
# Set from HomeKit
|
||||
call_arm_home = async_mock_service(hass, DOMAIN, "alarm_arm_home")
|
||||
call_arm_away = async_mock_service(hass, DOMAIN, "alarm_arm_away")
|
||||
call_arm_night = async_mock_service(hass, DOMAIN, "alarm_arm_night")
|
||||
call_disarm = async_mock_service(hass, DOMAIN, "alarm_disarm")
|
||||
call_arm_home = async_mock_service(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, "alarm_arm_home"
|
||||
)
|
||||
call_arm_away = async_mock_service(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, "alarm_arm_away"
|
||||
)
|
||||
call_arm_night = async_mock_service(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, "alarm_arm_night"
|
||||
)
|
||||
call_disarm = async_mock_service(hass, ALARM_CONTROL_PANEL_DOMAIN, "alarm_disarm")
|
||||
|
||||
acc.char_target_state.client_update_value(0)
|
||||
await hass.async_block_till_done()
|
||||
@ -131,7 +137,9 @@ async def test_no_alarm_code(
|
||||
acc = SecuritySystem(hass, hk_driver, "SecuritySystem", entity_id, 2, config)
|
||||
|
||||
# Set from HomeKit
|
||||
call_arm_home = async_mock_service(hass, DOMAIN, "alarm_arm_home")
|
||||
call_arm_home = async_mock_service(
|
||||
hass, ALARM_CONTROL_PANEL_DOMAIN, "alarm_arm_home"
|
||||
)
|
||||
|
||||
acc.char_target_state.client_update_value(0)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -13,7 +13,7 @@ from aiohomekit.model.characteristics import (
|
||||
from aiohomekit.model.services import ServicesTypes
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
DOMAIN,
|
||||
DOMAIN as CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
@ -113,7 +113,7 @@ async def test_climate_change_thermostat_state(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
@ -126,7 +126,7 @@ async def test_climate_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.COOL},
|
||||
blocking=True,
|
||||
@ -139,7 +139,7 @@ async def test_climate_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
@ -152,7 +152,7 @@ async def test_climate_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.OFF},
|
||||
blocking=True,
|
||||
@ -165,7 +165,7 @@ async def test_climate_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{"entity_id": "climate.testdevice", "fan_mode": "on"},
|
||||
blocking=True,
|
||||
@ -178,7 +178,7 @@ async def test_climate_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{"entity_id": "climate.testdevice", "fan_mode": "auto"},
|
||||
blocking=True,
|
||||
@ -198,7 +198,7 @@ async def test_climate_check_min_max_values_per_mode(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
@ -208,7 +208,7 @@ async def test_climate_check_min_max_values_per_mode(
|
||||
assert climate_state.attributes["max_temp"] == 35
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.COOL},
|
||||
blocking=True,
|
||||
@ -218,7 +218,7 @@ async def test_climate_check_min_max_values_per_mode(
|
||||
assert climate_state.attributes["max_temp"] == 35
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
@ -235,7 +235,7 @@ async def test_climate_change_thermostat_temperature(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{"entity_id": "climate.testdevice", "temperature": 21},
|
||||
blocking=True,
|
||||
@ -248,7 +248,7 @@ async def test_climate_change_thermostat_temperature(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{"entity_id": "climate.testdevice", "temperature": 25},
|
||||
blocking=True,
|
||||
@ -268,14 +268,14 @@ async def test_climate_change_thermostat_temperature_range(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
"entity_id": "climate.testdevice",
|
||||
@ -303,14 +303,14 @@ async def test_climate_change_thermostat_temperature_range_iphone(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
"entity_id": "climate.testdevice",
|
||||
@ -338,14 +338,14 @@ async def test_climate_cannot_set_thermostat_temp_range_in_wrong_mode(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
"entity_id": "climate.testdevice",
|
||||
@ -399,7 +399,7 @@ async def test_climate_check_min_max_values_per_mode_sspa_device(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
@ -409,7 +409,7 @@ async def test_climate_check_min_max_values_per_mode_sspa_device(
|
||||
assert climate_state.attributes["max_temp"] == 35
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.COOL},
|
||||
blocking=True,
|
||||
@ -419,7 +419,7 @@ async def test_climate_check_min_max_values_per_mode_sspa_device(
|
||||
assert climate_state.attributes["max_temp"] == 35
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
@ -438,14 +438,14 @@ async def test_climate_set_thermostat_temp_on_sspa_device(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{"entity_id": "climate.testdevice", "temperature": 21},
|
||||
blocking=True,
|
||||
@ -458,7 +458,7 @@ async def test_climate_set_thermostat_temp_on_sspa_device(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
@ -471,7 +471,7 @@ async def test_climate_set_thermostat_temp_on_sspa_device(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
"entity_id": "climate.testdevice",
|
||||
@ -496,7 +496,7 @@ async def test_climate_set_mode_via_temp(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
"entity_id": "climate.testdevice",
|
||||
@ -514,7 +514,7 @@ async def test_climate_set_mode_via_temp(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
"entity_id": "climate.testdevice",
|
||||
@ -539,7 +539,7 @@ async def test_climate_change_thermostat_humidity(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_thermostat_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
{"entity_id": "climate.testdevice", "humidity": 50},
|
||||
blocking=True,
|
||||
@ -552,7 +552,7 @@ async def test_climate_change_thermostat_humidity(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
{"entity_id": "climate.testdevice", "humidity": 45},
|
||||
blocking=True,
|
||||
@ -768,7 +768,7 @@ async def test_heater_cooler_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
@ -781,7 +781,7 @@ async def test_heater_cooler_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.COOL},
|
||||
blocking=True,
|
||||
@ -794,7 +794,7 @@ async def test_heater_cooler_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT_COOL},
|
||||
blocking=True,
|
||||
@ -807,7 +807,7 @@ async def test_heater_cooler_change_thermostat_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.OFF},
|
||||
blocking=True,
|
||||
@ -832,7 +832,7 @@ async def test_can_turn_on_after_off(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.OFF},
|
||||
blocking=True,
|
||||
@ -845,7 +845,7 @@ async def test_can_turn_on_after_off(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
@ -868,13 +868,13 @@ async def test_heater_cooler_change_thermostat_temperature(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.HEAT},
|
||||
blocking=True,
|
||||
)
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{"entity_id": "climate.testdevice", "temperature": 20},
|
||||
blocking=True,
|
||||
@ -887,13 +887,13 @@ async def test_heater_cooler_change_thermostat_temperature(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.COOL},
|
||||
blocking=True,
|
||||
)
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
{"entity_id": "climate.testdevice", "temperature": 26},
|
||||
blocking=True,
|
||||
@ -915,13 +915,13 @@ async def test_heater_cooler_change_fan_speed(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_HVAC_MODE,
|
||||
{"entity_id": "climate.testdevice", "hvac_mode": HVACMode.COOL},
|
||||
blocking=True,
|
||||
)
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{"entity_id": "climate.testdevice", "fan_mode": "low"},
|
||||
blocking=True,
|
||||
@ -933,7 +933,7 @@ async def test_heater_cooler_change_fan_speed(
|
||||
},
|
||||
)
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{"entity_id": "climate.testdevice", "fan_mode": "medium"},
|
||||
blocking=True,
|
||||
@ -945,7 +945,7 @@ async def test_heater_cooler_change_fan_speed(
|
||||
},
|
||||
)
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
{"entity_id": "climate.testdevice", "fan_mode": "high"},
|
||||
blocking=True,
|
||||
@ -1121,7 +1121,7 @@ async def test_heater_cooler_change_swing_mode(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_SWING_MODE,
|
||||
{"entity_id": "climate.testdevice", "swing_mode": "vertical"},
|
||||
blocking=True,
|
||||
@ -1134,7 +1134,7 @@ async def test_heater_cooler_change_swing_mode(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
CLIMATE_DOMAIN,
|
||||
SERVICE_SET_SWING_MODE,
|
||||
{"entity_id": "climate.testdevice", "swing_mode": "off"},
|
||||
blocking=True,
|
||||
|
@ -6,7 +6,11 @@ from aiohomekit.model import Accessory
|
||||
from aiohomekit.model.characteristics import CharacteristicsTypes
|
||||
from aiohomekit.model.services import Service, ServicesTypes
|
||||
|
||||
from homeassistant.components.humidifier import DOMAIN, MODE_AUTO, MODE_NORMAL
|
||||
from homeassistant.components.humidifier import (
|
||||
DOMAIN as HUMIDIFIER_DOMAIN,
|
||||
MODE_AUTO,
|
||||
MODE_NORMAL,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
@ -74,7 +78,7 @@ async def test_humidifier_active_state(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_humidifier_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, "turn_on", {"entity_id": helper.entity_id}, blocking=True
|
||||
HUMIDIFIER_DOMAIN, "turn_on", {"entity_id": helper.entity_id}, blocking=True
|
||||
)
|
||||
|
||||
helper.async_assert_service_values(
|
||||
@ -83,7 +87,7 @@ async def test_humidifier_active_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, "turn_off", {"entity_id": helper.entity_id}, blocking=True
|
||||
HUMIDIFIER_DOMAIN, "turn_off", {"entity_id": helper.entity_id}, blocking=True
|
||||
)
|
||||
|
||||
helper.async_assert_service_values(
|
||||
@ -101,7 +105,7 @@ async def test_dehumidifier_active_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, "turn_on", {"entity_id": helper.entity_id}, blocking=True
|
||||
HUMIDIFIER_DOMAIN, "turn_on", {"entity_id": helper.entity_id}, blocking=True
|
||||
)
|
||||
|
||||
helper.async_assert_service_values(
|
||||
@ -110,7 +114,7 @@ async def test_dehumidifier_active_state(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, "turn_off", {"entity_id": helper.entity_id}, blocking=True
|
||||
HUMIDIFIER_DOMAIN, "turn_off", {"entity_id": helper.entity_id}, blocking=True
|
||||
)
|
||||
|
||||
helper.async_assert_service_values(
|
||||
@ -208,7 +212,7 @@ async def test_humidifier_set_humidity(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_humidifier_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
HUMIDIFIER_DOMAIN,
|
||||
"set_humidity",
|
||||
{"entity_id": helper.entity_id, "humidity": 20},
|
||||
blocking=True,
|
||||
@ -228,7 +232,7 @@ async def test_dehumidifier_set_humidity(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
HUMIDIFIER_DOMAIN,
|
||||
"set_humidity",
|
||||
{"entity_id": helper.entity_id, "humidity": 20},
|
||||
blocking=True,
|
||||
@ -246,7 +250,7 @@ async def test_humidifier_set_mode(
|
||||
helper = await setup_test_component(hass, get_next_aid(), create_humidifier_service)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
HUMIDIFIER_DOMAIN,
|
||||
"set_mode",
|
||||
{"entity_id": helper.entity_id, "mode": MODE_AUTO},
|
||||
blocking=True,
|
||||
@ -260,7 +264,7 @@ async def test_humidifier_set_mode(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
HUMIDIFIER_DOMAIN,
|
||||
"set_mode",
|
||||
{"entity_id": helper.entity_id, "mode": MODE_NORMAL},
|
||||
blocking=True,
|
||||
@ -283,7 +287,7 @@ async def test_dehumidifier_set_mode(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
HUMIDIFIER_DOMAIN,
|
||||
"set_mode",
|
||||
{"entity_id": helper.entity_id, "mode": MODE_AUTO},
|
||||
blocking=True,
|
||||
@ -297,7 +301,7 @@ async def test_dehumidifier_set_mode(
|
||||
)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
HUMIDIFIER_DOMAIN,
|
||||
"set_mode",
|
||||
{"entity_id": helper.entity_id, "mode": MODE_NORMAL},
|
||||
blocking=True,
|
||||
|
@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
from homeassistant.components.homematicip_cloud import DOMAIN as HMIPC_DOMAIN
|
||||
from homeassistant.components.lock import (
|
||||
DOMAIN,
|
||||
DOMAIN as LOCK_DOMAIN,
|
||||
STATE_LOCKING,
|
||||
STATE_UNLOCKING,
|
||||
LockEntityFeature,
|
||||
@ -23,7 +23,7 @@ from .helper import HomeFactory, async_manipulate_test_data, get_and_check_entit
|
||||
async def test_manually_configured_platform(hass: HomeAssistant) -> None:
|
||||
"""Test that we do not set up an access point."""
|
||||
assert await async_setup_component(
|
||||
hass, DOMAIN, {DOMAIN: {"platform": HMIPC_DOMAIN}}
|
||||
hass, LOCK_DOMAIN, {LOCK_DOMAIN: {"platform": HMIPC_DOMAIN}}
|
||||
)
|
||||
assert not hass.data.get(HMIPC_DOMAIN)
|
||||
|
||||
|
@ -6,7 +6,7 @@ from unittest.mock import AsyncMock, patch
|
||||
from pydrawise.schema import Zone
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.valve import DOMAIN
|
||||
from homeassistant.components.valve import DOMAIN as VALVE_DOMAIN
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
SERVICE_CLOSE_VALVE,
|
||||
@ -42,7 +42,7 @@ async def test_services(
|
||||
) -> None:
|
||||
"""Test valve services."""
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
VALVE_DOMAIN,
|
||||
SERVICE_OPEN_VALVE,
|
||||
service_data={ATTR_ENTITY_ID: "valve.zone_one"},
|
||||
blocking=True,
|
||||
@ -51,7 +51,7 @@ async def test_services(
|
||||
mock_pydrawise.reset_mock()
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
VALVE_DOMAIN,
|
||||
SERVICE_CLOSE_VALVE,
|
||||
service_data={ATTR_ENTITY_ID: "valve.zone_one"},
|
||||
blocking=True,
|
||||
|
@ -1,6 +1,10 @@
|
||||
"""Test KNX date."""
|
||||
|
||||
from homeassistant.components.date import ATTR_DATE, DOMAIN, SERVICE_SET_VALUE
|
||||
from homeassistant.components.date import (
|
||||
ATTR_DATE,
|
||||
DOMAIN as DATE_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
)
|
||||
from homeassistant.components.knx.const import CONF_RESPOND_TO_READ, KNX_ADDRESS
|
||||
from homeassistant.components.knx.schema import DateSchema
|
||||
from homeassistant.const import CONF_NAME
|
||||
@ -24,7 +28,7 @@ async def test_date(hass: HomeAssistant, knx: KNXTestKit) -> None:
|
||||
)
|
||||
# set value
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
DATE_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
{"entity_id": "date.test", ATTR_DATE: "1999-03-31"},
|
||||
blocking=True,
|
||||
|
@ -1,6 +1,10 @@
|
||||
"""Test KNX date."""
|
||||
|
||||
from homeassistant.components.datetime import ATTR_DATETIME, DOMAIN, SERVICE_SET_VALUE
|
||||
from homeassistant.components.datetime import (
|
||||
ATTR_DATETIME,
|
||||
DOMAIN as DATETIME_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
)
|
||||
from homeassistant.components.knx.const import CONF_RESPOND_TO_READ, KNX_ADDRESS
|
||||
from homeassistant.components.knx.schema import DateTimeSchema
|
||||
from homeassistant.const import CONF_NAME
|
||||
@ -27,7 +31,7 @@ async def test_datetime(hass: HomeAssistant, knx: KNXTestKit) -> None:
|
||||
)
|
||||
# set value
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
DATETIME_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
{"entity_id": "datetime.test", ATTR_DATETIME: "2020-01-02T03:04:05+00:00"},
|
||||
blocking=True,
|
||||
|
@ -2,7 +2,11 @@
|
||||
|
||||
from homeassistant.components.knx.const import CONF_RESPOND_TO_READ, KNX_ADDRESS
|
||||
from homeassistant.components.knx.schema import TimeSchema
|
||||
from homeassistant.components.time import ATTR_TIME, DOMAIN, SERVICE_SET_VALUE
|
||||
from homeassistant.components.time import (
|
||||
ATTR_TIME,
|
||||
DOMAIN as TIME_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
)
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant, State
|
||||
|
||||
@ -24,7 +28,7 @@ async def test_time(hass: HomeAssistant, knx: KNXTestKit) -> None:
|
||||
)
|
||||
# set value
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
TIME_DOMAIN,
|
||||
SERVICE_SET_VALUE,
|
||||
{"entity_id": "time.test", ATTR_TIME: "01:02:03"},
|
||||
blocking=True,
|
||||
|
Loading…
x
Reference in New Issue
Block a user