parent
e48857987b
commit
2cf3f2b243
|
@ -10,7 +10,6 @@ from aioswitcher.api import (
|
|||
DeviceState,
|
||||
SwitcherApi,
|
||||
SwitcherBaseResponse,
|
||||
SwitcherType2Api,
|
||||
ThermostatSwing,
|
||||
)
|
||||
from aioswitcher.api.remotes import SwitcherBreezeRemote
|
||||
|
@ -128,7 +127,7 @@ class SwitcherThermostatButtonEntity(SwitcherEntity, ButtonEntity):
|
|||
error = None
|
||||
|
||||
try:
|
||||
async with SwitcherType2Api(
|
||||
async with SwitcherApi(
|
||||
self.coordinator.data.device_type,
|
||||
self.coordinator.data.ip_address,
|
||||
self.coordinator.data.device_id,
|
||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any, cast
|
||||
|
||||
from aioswitcher.api import SwitcherBaseResponse, SwitcherType2Api
|
||||
from aioswitcher.api import SwitcherApi, SwitcherBaseResponse
|
||||
from aioswitcher.api.remotes import SwitcherBreezeRemote
|
||||
from aioswitcher.device import (
|
||||
DeviceCategory,
|
||||
|
@ -160,7 +160,7 @@ class SwitcherClimateEntity(SwitcherEntity, ClimateEntity):
|
|||
error = None
|
||||
|
||||
try:
|
||||
async with SwitcherType2Api(
|
||||
async with SwitcherApi(
|
||||
self.coordinator.data.device_type,
|
||||
self.coordinator.data.ip_address,
|
||||
self.coordinator.data.device_id,
|
||||
|
|
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||
import logging
|
||||
from typing import Any, cast
|
||||
|
||||
from aioswitcher.api import SwitcherBaseResponse, SwitcherType2Api
|
||||
from aioswitcher.api import SwitcherApi, SwitcherBaseResponse
|
||||
from aioswitcher.device import DeviceCategory, ShutterDirection, SwitcherShutter
|
||||
|
||||
from homeassistant.components.cover import (
|
||||
|
@ -99,7 +99,7 @@ class SwitcherBaseCoverEntity(SwitcherEntity, CoverEntity):
|
|||
error = None
|
||||
|
||||
try:
|
||||
async with SwitcherType2Api(
|
||||
async with SwitcherApi(
|
||||
self.coordinator.data.device_type,
|
||||
self.coordinator.data.ip_address,
|
||||
self.coordinator.data.device_id,
|
||||
|
|
|
@ -5,7 +5,7 @@ from __future__ import annotations
|
|||
import logging
|
||||
from typing import Any, cast
|
||||
|
||||
from aioswitcher.api import SwitcherBaseResponse, SwitcherType2Api
|
||||
from aioswitcher.api import SwitcherApi, SwitcherBaseResponse
|
||||
from aioswitcher.device import DeviceCategory, DeviceState, SwitcherLight
|
||||
|
||||
from homeassistant.components.light import ColorMode, LightEntity
|
||||
|
@ -86,7 +86,7 @@ class SwitcherBaseLightEntity(SwitcherEntity, LightEntity):
|
|||
error = None
|
||||
|
||||
try:
|
||||
async with SwitcherType2Api(
|
||||
async with SwitcherApi(
|
||||
self.coordinator.data.device_type,
|
||||
self.coordinator.data.ip_address,
|
||||
self.coordinator.data.device_id,
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
"iot_class": "local_push",
|
||||
"loggers": ["aioswitcher"],
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["aioswitcher==4.4.0"],
|
||||
"requirements": ["aioswitcher==5.0.0"],
|
||||
"single_config_entry": true
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ from datetime import timedelta
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aioswitcher.api import Command, SwitcherBaseResponse, SwitcherType1Api
|
||||
from aioswitcher.api import Command, SwitcherApi, SwitcherBaseResponse
|
||||
from aioswitcher.device import DeviceCategory, DeviceState
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -105,7 +105,7 @@ class SwitcherBaseSwitchEntity(SwitcherEntity, SwitchEntity):
|
|||
error = None
|
||||
|
||||
try:
|
||||
async with SwitcherType1Api(
|
||||
async with SwitcherApi(
|
||||
self.coordinator.data.device_type,
|
||||
self.coordinator.data.ip_address,
|
||||
self.coordinator.data.device_id,
|
||||
|
|
|
@ -387,7 +387,7 @@ aiosteamist==1.0.0
|
|||
aiostreammagic==2.8.5
|
||||
|
||||
# homeassistant.components.switcher_kis
|
||||
aioswitcher==4.4.0
|
||||
aioswitcher==5.0.0
|
||||
|
||||
# homeassistant.components.syncthing
|
||||
aiosyncthing==0.5.1
|
||||
|
|
|
@ -369,7 +369,7 @@ aiosteamist==1.0.0
|
|||
aiostreammagic==2.8.5
|
||||
|
||||
# homeassistant.components.switcher_kis
|
||||
aioswitcher==4.4.0
|
||||
aioswitcher==5.0.0
|
||||
|
||||
# homeassistant.components.syncthing
|
||||
aiosyncthing==0.5.1
|
||||
|
|
|
@ -60,19 +60,19 @@ def mock_api():
|
|||
|
||||
patchers = [
|
||||
patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.connect",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.connect",
|
||||
new=api_mock,
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.disconnect",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.disconnect",
|
||||
new=api_mock,
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.connect",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.connect",
|
||||
new=api_mock,
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.disconnect",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.disconnect",
|
||||
new=api_mock,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -42,7 +42,7 @@ async def test_assume_button(
|
|||
assert hass.states.get(SWING_OFF_EID) is None
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
BUTTON_DOMAIN,
|
||||
|
@ -79,7 +79,7 @@ async def test_swing_button(
|
|||
assert hass.states.get(SWING_OFF_EID) is not None
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
BUTTON_DOMAIN,
|
||||
|
@ -103,7 +103,7 @@ async def test_control_device_fail(
|
|||
|
||||
# Test exception during set hvac mode
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
side_effect=RuntimeError("fake error"),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@ -130,7 +130,7 @@ async def test_control_device_fail(
|
|||
|
||||
# Test error response during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
return_value=SwitcherBaseResponse(None),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
|
|
@ -49,7 +49,7 @@ async def test_climate_hvac_mode(
|
|||
|
||||
# Test set hvac mode heat
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
@ -71,7 +71,7 @@ async def test_climate_hvac_mode(
|
|||
|
||||
# Test set hvac mode off
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
@ -108,7 +108,7 @@ async def test_climate_temperature(
|
|||
|
||||
# Test set target temperature
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
@ -128,7 +128,7 @@ async def test_climate_temperature(
|
|||
|
||||
# Test set target temperature - incorrect params
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
with pytest.raises(ServiceValidationError):
|
||||
await hass.services.async_call(
|
||||
|
@ -160,7 +160,7 @@ async def test_climate_fan_level(
|
|||
|
||||
# Test set fan level to high
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
@ -195,7 +195,7 @@ async def test_climate_swing(
|
|||
|
||||
# Test set swing mode on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
@ -218,7 +218,7 @@ async def test_climate_swing(
|
|||
|
||||
# Test set swing mode off
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
CLIMATE_DOMAIN,
|
||||
|
@ -249,7 +249,7 @@ async def test_control_device_fail(hass: HomeAssistant, mock_bridge, mock_api) -
|
|||
|
||||
# Test exception during set hvac mode
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
side_effect=RuntimeError("fake error"),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@ -276,7 +276,7 @@ async def test_control_device_fail(hass: HomeAssistant, mock_bridge, mock_api) -
|
|||
|
||||
# Test error response during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherType2Api.control_breeze_device",
|
||||
"homeassistant.components.switcher_kis.climate.SwitcherApi.control_breeze_device",
|
||||
return_value=SwitcherBaseResponse(None),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
|
|
@ -115,7 +115,7 @@ async def test_cover(
|
|||
|
||||
# Test set position
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_position"
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_position"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
COVER_DOMAIN,
|
||||
|
@ -136,7 +136,7 @@ async def test_cover(
|
|||
|
||||
# Test open
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_position"
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_position"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
COVER_DOMAIN,
|
||||
|
@ -156,7 +156,7 @@ async def test_cover(
|
|||
|
||||
# Test close
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_position"
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_position"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
COVER_DOMAIN,
|
||||
|
@ -176,7 +176,7 @@ async def test_cover(
|
|||
|
||||
# Test stop
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.stop_shutter"
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.stop_shutter"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
COVER_DOMAIN,
|
||||
|
@ -232,7 +232,7 @@ async def test_cover_control_fail(
|
|||
|
||||
# Test exception during set position
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_position",
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_position",
|
||||
side_effect=RuntimeError("fake error"),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@ -257,7 +257,7 @@ async def test_cover_control_fail(
|
|||
|
||||
# Test error response during set position
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_position",
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_position",
|
||||
return_value=SwitcherBaseResponse(None),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
|
|
@ -86,7 +86,7 @@ async def test_light(
|
|||
|
||||
# Test turning on light
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.light.SwitcherType2Api.set_light",
|
||||
"homeassistant.components.switcher_kis.light.SwitcherApi.set_light",
|
||||
) as mock_set_light:
|
||||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
|
@ -99,7 +99,7 @@ async def test_light(
|
|||
|
||||
# Test turning off light
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.light.SwitcherType2Api.set_light"
|
||||
"homeassistant.components.switcher_kis.light.SwitcherApi.set_light"
|
||||
) as mock_set_light:
|
||||
await hass.services.async_call(
|
||||
LIGHT_DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
|
@ -153,7 +153,7 @@ async def test_light_control_fail(
|
|||
|
||||
# Test exception during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_light",
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_light",
|
||||
side_effect=RuntimeError("fake error"),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
@ -178,7 +178,7 @@ async def test_light_control_fail(
|
|||
|
||||
# Test error response during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherType2Api.set_light",
|
||||
"homeassistant.components.switcher_kis.cover.SwitcherApi.set_light",
|
||||
return_value=SwitcherBaseResponse(None),
|
||||
) as mock_control_device:
|
||||
with pytest.raises(HomeAssistantError):
|
||||
|
|
|
@ -48,7 +48,7 @@ async def test_turn_on_with_timer_service(
|
|||
assert state.state == STATE_OFF
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device"
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
@ -78,7 +78,7 @@ async def test_set_auto_off_service(hass: HomeAssistant, mock_bridge, mock_api)
|
|||
entity_id = f"{SWITCH_DOMAIN}.{slugify(device.name)}"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.set_auto_shutdown"
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.set_auto_shutdown"
|
||||
) as mock_set_auto_shutdown:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
@ -105,7 +105,7 @@ async def test_set_auto_off_service_fail(
|
|||
entity_id = f"{SWITCH_DOMAIN}.{slugify(device.name)}"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.set_auto_shutdown",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.set_auto_shutdown",
|
||||
return_value=None,
|
||||
) as mock_set_auto_shutdown:
|
||||
await hass.services.async_call(
|
||||
|
|
|
@ -47,7 +47,7 @@ async def test_switch(
|
|||
|
||||
# Test turning on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
|
@ -60,7 +60,7 @@ async def test_switch(
|
|||
|
||||
# Test turning off
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device"
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
|
@ -97,7 +97,7 @@ async def test_switch_control_fail(
|
|||
|
||||
# Test exception during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device",
|
||||
side_effect=RuntimeError("fake error"),
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
|
@ -121,7 +121,7 @@ async def test_switch_control_fail(
|
|||
|
||||
# Test error response during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device",
|
||||
return_value=SwitcherBaseResponse(None),
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
|
|
Loading…
Reference in New Issue