From aece76f6cd5ae5a237d2fe9c366ae2b809444dd3 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 17 Mar 2020 20:17:59 +0100 Subject: [PATCH] Bump wled 0.3.0, reduce calls stability improvements (#32903) --- homeassistant/components/wled/__init__.py | 6 +++--- homeassistant/components/wled/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/wled/__init__.py | 14 +++++++++++++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/wled/__init__.py b/homeassistant/components/wled/__init__.py index 19901ce297d..91c130a7a81 100644 --- a/homeassistant/components/wled/__init__.py +++ b/homeassistant/components/wled/__init__.py @@ -26,7 +26,7 @@ from .const import ( DOMAIN, ) -SCAN_INTERVAL = timedelta(seconds=10) +SCAN_INTERVAL = timedelta(seconds=5) WLED_COMPONENTS = (LIGHT_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN) _LOGGER = logging.getLogger(__name__) @@ -94,7 +94,7 @@ def wled_exception_handler(func): async def handler(self, *args, **kwargs): try: await func(self, *args, **kwargs) - await self.coordinator.async_refresh() + self.coordinator.update_listeners() except WLEDConnectionError as error: _LOGGER.error("Error communicating with API: %s", error) @@ -128,7 +128,7 @@ class WLEDDataUpdateCoordinator(DataUpdateCoordinator): async def _async_update_data(self) -> WLEDDevice: """Fetch data from WLED.""" try: - return await self.wled.update() + return await self.wled.update(full_update=not self.last_update_success) except WLEDError as error: raise UpdateFailed(f"Invalid response from API: {error}") diff --git a/homeassistant/components/wled/manifest.json b/homeassistant/components/wled/manifest.json index 4b501d0c67c..d501edbd631 100644 --- a/homeassistant/components/wled/manifest.json +++ b/homeassistant/components/wled/manifest.json @@ -3,7 +3,7 @@ "name": "WLED", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/wled", - "requirements": ["wled==0.2.1"], + "requirements": ["wled==0.3.0"], "dependencies": [], "zeroconf": ["_wled._tcp.local."], "codeowners": ["@frenck"], diff --git a/requirements_all.txt b/requirements_all.txt index 96364414e59..5b7e4438ed8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2105,7 +2105,7 @@ wirelesstagpy==0.4.0 withings-api==2.1.3 # homeassistant.components.wled -wled==0.2.1 +wled==0.3.0 # homeassistant.components.wunderlist wunderpy2==0.1.6 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ea3c27e5b1e..baa3b4dfffb 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -736,7 +736,7 @@ watchdog==0.8.3 withings-api==2.1.3 # homeassistant.components.wled -wled==0.2.1 +wled==0.3.0 # homeassistant.components.bluesound # homeassistant.components.rest diff --git a/tests/components/wled/__init__.py b/tests/components/wled/__init__.py index 41cbbf01074..b4b01c66d8a 100644 --- a/tests/components/wled/__init__.py +++ b/tests/components/wled/__init__.py @@ -25,7 +25,19 @@ async def init_integration( aioclient_mock.post( "http://example.local:80/json/state", - json={"success": True}, + json={}, + headers={"Content-Type": "application/json"}, + ) + + aioclient_mock.get( + "http://example.local:80/json/info", + json={}, + headers={"Content-Type": "application/json"}, + ) + + aioclient_mock.get( + "http://example.local:80/json/state", + json={}, headers={"Content-Type": "application/json"}, )