parent
ec8901b9af
commit
062ee75de9
|
@ -3,7 +3,7 @@
|
|||
"name": "Switcher",
|
||||
"documentation": "https://www.home-assistant.io/integrations/switcher_kis/",
|
||||
"codeowners": ["@tomerfi", "@thecode"],
|
||||
"requirements": ["aioswitcher==3.0.0"],
|
||||
"requirements": ["aioswitcher==3.0.2"],
|
||||
"quality_scale": "platinum",
|
||||
"iot_class": "local_push",
|
||||
"config_flow": true,
|
||||
|
|
|
@ -6,7 +6,7 @@ from datetime import timedelta
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aioswitcher.api import Command, SwitcherApi, SwitcherBaseResponse
|
||||
from aioswitcher.api import Command, SwitcherBaseResponse, SwitcherType1Api
|
||||
from aioswitcher.device import DeviceCategory, DeviceState
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -110,7 +110,7 @@ class SwitcherBaseSwitchEntity(
|
|||
error = None
|
||||
|
||||
try:
|
||||
async with SwitcherApi(
|
||||
async with SwitcherType1Api(
|
||||
self.coordinator.data.ip_address, self.coordinator.data.device_id
|
||||
) as swapi:
|
||||
response = await getattr(swapi, api)(*args)
|
||||
|
|
|
@ -267,7 +267,7 @@ aioslimproto==2.1.1
|
|||
aiosteamist==0.3.2
|
||||
|
||||
# homeassistant.components.switcher_kis
|
||||
aioswitcher==3.0.0
|
||||
aioswitcher==3.0.2
|
||||
|
||||
# homeassistant.components.syncthing
|
||||
aiosyncthing==0.5.1
|
||||
|
|
|
@ -242,7 +242,7 @@ aioslimproto==2.1.1
|
|||
aiosteamist==0.3.2
|
||||
|
||||
# homeassistant.components.switcher_kis
|
||||
aioswitcher==3.0.0
|
||||
aioswitcher==3.0.2
|
||||
|
||||
# homeassistant.components.syncthing
|
||||
aiosyncthing==0.5.1
|
||||
|
|
|
@ -43,11 +43,11 @@ def mock_api():
|
|||
|
||||
patchers = [
|
||||
patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.connect",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.connect",
|
||||
new=api_mock,
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.disconnect",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.disconnect",
|
||||
new=api_mock,
|
||||
),
|
||||
]
|
||||
|
|
|
@ -44,7 +44,7 @@ async def test_turn_on_with_timer_service(hass, mock_bridge, mock_api, monkeypat
|
|||
assert state.state == STATE_OFF
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device"
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
@ -74,7 +74,7 @@ async def test_set_auto_off_service(hass, mock_bridge, mock_api):
|
|||
entity_id = f"{SWITCH_DOMAIN}.{slugify(device.name)}"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.set_auto_shutdown"
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.set_auto_shutdown"
|
||||
) as mock_set_auto_shutdown:
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
|
@ -99,7 +99,7 @@ async def test_set_auto_off_service_fail(hass, mock_bridge, mock_api, caplog):
|
|||
entity_id = f"{SWITCH_DOMAIN}.{slugify(device.name)}"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.set_auto_shutdown",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.set_auto_shutdown",
|
||||
return_value=None,
|
||||
) as mock_set_auto_shutdown:
|
||||
await hass.services.async_call(
|
||||
|
|
|
@ -43,7 +43,7 @@ async def test_switch(hass, mock_bridge, mock_api, monkeypatch):
|
|||
|
||||
# Test turning on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device",
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
|
@ -56,7 +56,7 @@ async def test_switch(hass, mock_bridge, mock_api, monkeypatch):
|
|||
|
||||
# Test turning off
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device"
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device"
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
SWITCH_DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
|
@ -87,7 +87,7 @@ async def test_switch_control_fail(hass, mock_bridge, mock_api, monkeypatch, cap
|
|||
|
||||
# Test exception during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device",
|
||||
side_effect=RuntimeError("fake error"),
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
|
@ -111,7 +111,7 @@ async def test_switch_control_fail(hass, mock_bridge, mock_api, monkeypatch, cap
|
|||
|
||||
# Test error response during turn on
|
||||
with patch(
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherApi.control_device",
|
||||
"homeassistant.components.switcher_kis.switch.SwitcherType1Api.control_device",
|
||||
return_value=SwitcherBaseResponse(None),
|
||||
) as mock_control_device:
|
||||
await hass.services.async_call(
|
||||
|
|
Loading…
Reference in New Issue