Fix exception in Shelly sleeping device that switches to polling (#45930)

This commit is contained in:
Shay Levy 2021-02-04 12:07:30 +02:00 committed by GitHub
parent 7e9500e465
commit fefe4a2021
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -220,6 +220,10 @@ class ShellyDeviceWrapper(update_coordinator.DataUpdateCoordinator):
async def _async_update_data(self):
"""Fetch data."""
if self.entry.data.get("sleep_period"):
# Sleeping device, no point polling it, just mark it unavailable
raise update_coordinator.UpdateFailed("Sleeping device did not update")
_LOGGER.debug("Polling Shelly Device - %s", self.name)
try:
async with async_timeout.timeout(POLLING_TIMEOUT_SEC):