Fix exception in Shelly sleeping device that switches to polling (#45930)
This commit is contained in:
parent
7e9500e465
commit
fefe4a2021
2 changed files with 5 additions and 1 deletions
|
@ -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):
|
||||
|
|
|
@ -421,7 +421,7 @@ class ShellySleepingBlockAttributeEntity(ShellyBlockAttributeEntity, RestoreEnti
|
|||
@callback
|
||||
def _update_callback(self):
|
||||
"""Handle device update."""
|
||||
if self.block is not None:
|
||||
if self.block is not None or not self.wrapper.device.initialized:
|
||||
super()._update_callback()
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue