diff --git a/homeassistant/components/wmspro/cover.py b/homeassistant/components/wmspro/cover.py index 77dd928bc95..b6f100280ad 100644 --- a/homeassistant/components/wmspro/cover.py +++ b/homeassistant/components/wmspro/cover.py @@ -2,13 +2,13 @@ from __future__ import annotations -import asyncio from datetime import timedelta from typing import Any from wmspro.const import ( WMS_WebControl_pro_API_actionDescription, WMS_WebControl_pro_API_actionType, + WMS_WebControl_pro_API_responseType, ) from homeassistant.components.cover import ATTR_POSITION, CoverDeviceClass, CoverEntity @@ -18,7 +18,6 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from . import WebControlProConfigEntry from .entity import WebControlProGenericEntity -ACTION_DELAY = 0.5 SCAN_INTERVAL = timedelta(seconds=10) PARALLEL_UPDATES = 1 @@ -61,7 +60,6 @@ class WebControlProCover(WebControlProGenericEntity, CoverEntity): """Move the cover to a specific position.""" action = self._dest.action(self._drive_action_desc) await action(percentage=100 - kwargs[ATTR_POSITION]) - await asyncio.sleep(ACTION_DELAY) @property def is_closed(self) -> bool | None: @@ -72,13 +70,11 @@ class WebControlProCover(WebControlProGenericEntity, CoverEntity): """Open the cover.""" action = self._dest.action(self._drive_action_desc) await action(percentage=0) - await asyncio.sleep(ACTION_DELAY) async def async_close_cover(self, **kwargs: Any) -> None: """Close the cover.""" action = self._dest.action(self._drive_action_desc) await action(percentage=100) - await asyncio.sleep(ACTION_DELAY) async def async_stop_cover(self, **kwargs: Any) -> None: """Stop the device if in motion.""" @@ -86,8 +82,7 @@ class WebControlProCover(WebControlProGenericEntity, CoverEntity): WMS_WebControl_pro_API_actionDescription.ManualCommand, WMS_WebControl_pro_API_actionType.Stop, ) - await action() - await asyncio.sleep(ACTION_DELAY) + await action(responseType=WMS_WebControl_pro_API_responseType.Detailed) class WebControlProAwning(WebControlProCover): diff --git a/homeassistant/components/wmspro/light.py b/homeassistant/components/wmspro/light.py index d828c8a26e8..52d092ed9f0 100644 --- a/homeassistant/components/wmspro/light.py +++ b/homeassistant/components/wmspro/light.py @@ -2,11 +2,13 @@ from __future__ import annotations -import asyncio from datetime import timedelta from typing import Any -from wmspro.const import WMS_WebControl_pro_API_actionDescription +from wmspro.const import ( + WMS_WebControl_pro_API_actionDescription, + WMS_WebControl_pro_API_responseType, +) from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity from homeassistant.core import HomeAssistant @@ -17,7 +19,6 @@ from . import WebControlProConfigEntry from .const import BRIGHTNESS_SCALE from .entity import WebControlProGenericEntity -ACTION_DELAY = 0.5 SCAN_INTERVAL = timedelta(seconds=15) PARALLEL_UPDATES = 1 @@ -56,14 +57,16 @@ class WebControlProLight(WebControlProGenericEntity, LightEntity): async def async_turn_on(self, **kwargs: Any) -> None: """Turn the light on.""" action = self._dest.action(WMS_WebControl_pro_API_actionDescription.LightSwitch) - await action(onOffState=True) - await asyncio.sleep(ACTION_DELAY) + await action( + onOffState=True, responseType=WMS_WebControl_pro_API_responseType.Detailed + ) async def async_turn_off(self, **kwargs: Any) -> None: """Turn the light off.""" action = self._dest.action(WMS_WebControl_pro_API_actionDescription.LightSwitch) - await action(onOffState=False) - await asyncio.sleep(ACTION_DELAY) + await action( + onOffState=False, responseType=WMS_WebControl_pro_API_responseType.Detailed + ) class WebControlProDimmer(WebControlProLight): @@ -90,6 +93,6 @@ class WebControlProDimmer(WebControlProLight): WMS_WebControl_pro_API_actionDescription.LightDimming ) await action( - percentage=brightness_to_value(BRIGHTNESS_SCALE, kwargs[ATTR_BRIGHTNESS]) + percentage=brightness_to_value(BRIGHTNESS_SCALE, kwargs[ATTR_BRIGHTNESS]), + responseType=WMS_WebControl_pro_API_responseType.Detailed, ) - await asyncio.sleep(ACTION_DELAY) diff --git a/homeassistant/components/wmspro/manifest.json b/homeassistant/components/wmspro/manifest.json index d4eda3a90a6..9185768165a 100644 --- a/homeassistant/components/wmspro/manifest.json +++ b/homeassistant/components/wmspro/manifest.json @@ -14,5 +14,5 @@ "documentation": "https://www.home-assistant.io/integrations/wmspro", "integration_type": "hub", "iot_class": "local_polling", - "requirements": ["pywmspro==0.2.2"] + "requirements": ["pywmspro==0.3.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index b198661ce18..93fb2a42536 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2596,7 +2596,7 @@ pywilight==0.0.74 pywizlight==0.6.3 # homeassistant.components.wmspro -pywmspro==0.2.2 +pywmspro==0.3.0 # homeassistant.components.ws66i pyws66i==1.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 09f4a62b597..c9d6b6349a0 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -2154,7 +2154,7 @@ pywilight==0.0.74 pywizlight==0.6.3 # homeassistant.components.wmspro -pywmspro==0.2.2 +pywmspro==0.3.0 # homeassistant.components.ws66i pyws66i==1.1