Bump wled 0.3.0, reduce calls stability improvements (#32903)

This commit is contained in:
Franck Nijhof 2020-03-17 20:17:59 +01:00 committed by GitHub
parent 7bbffa6e6d
commit aece76f6cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 7 deletions

View File

@ -26,7 +26,7 @@ from .const import (
DOMAIN, DOMAIN,
) )
SCAN_INTERVAL = timedelta(seconds=10) SCAN_INTERVAL = timedelta(seconds=5)
WLED_COMPONENTS = (LIGHT_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN) WLED_COMPONENTS = (LIGHT_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN)
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -94,7 +94,7 @@ def wled_exception_handler(func):
async def handler(self, *args, **kwargs): async def handler(self, *args, **kwargs):
try: try:
await func(self, *args, **kwargs) await func(self, *args, **kwargs)
await self.coordinator.async_refresh() self.coordinator.update_listeners()
except WLEDConnectionError as error: except WLEDConnectionError as error:
_LOGGER.error("Error communicating with API: %s", error) _LOGGER.error("Error communicating with API: %s", error)
@ -128,7 +128,7 @@ class WLEDDataUpdateCoordinator(DataUpdateCoordinator):
async def _async_update_data(self) -> WLEDDevice: async def _async_update_data(self) -> WLEDDevice:
"""Fetch data from WLED.""" """Fetch data from WLED."""
try: try:
return await self.wled.update() return await self.wled.update(full_update=not self.last_update_success)
except WLEDError as error: except WLEDError as error:
raise UpdateFailed(f"Invalid response from API: {error}") raise UpdateFailed(f"Invalid response from API: {error}")

View File

@ -3,7 +3,7 @@
"name": "WLED", "name": "WLED",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/wled", "documentation": "https://www.home-assistant.io/integrations/wled",
"requirements": ["wled==0.2.1"], "requirements": ["wled==0.3.0"],
"dependencies": [], "dependencies": [],
"zeroconf": ["_wled._tcp.local."], "zeroconf": ["_wled._tcp.local."],
"codeowners": ["@frenck"], "codeowners": ["@frenck"],

View File

@ -2105,7 +2105,7 @@ wirelesstagpy==0.4.0
withings-api==2.1.3 withings-api==2.1.3
# homeassistant.components.wled # homeassistant.components.wled
wled==0.2.1 wled==0.3.0
# homeassistant.components.wunderlist # homeassistant.components.wunderlist
wunderpy2==0.1.6 wunderpy2==0.1.6

View File

@ -736,7 +736,7 @@ watchdog==0.8.3
withings-api==2.1.3 withings-api==2.1.3
# homeassistant.components.wled # homeassistant.components.wled
wled==0.2.1 wled==0.3.0
# homeassistant.components.bluesound # homeassistant.components.bluesound
# homeassistant.components.rest # homeassistant.components.rest

View File

@ -25,7 +25,19 @@ async def init_integration(
aioclient_mock.post( aioclient_mock.post(
"http://example.local:80/json/state", "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"}, headers={"Content-Type": "application/json"},
) )