Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
Fix state error if offline
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidy committed Feb 10, 2021
1 parent da644f4 commit de5efd4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions custom_components/wiz_light/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ def device_info(self):
"model": self._bulbtype.name,
}

async def update_state_available(self):
def update_state_available(self):
"""Update the state if bulb is available."""
self._state = self._light.status
self._available = True

async def update_state_unavailable(self):
def update_state_unavailable(self):
"""Update the state if bulb is unavailable."""
self._state = False
self._available = False
Expand All @@ -284,15 +284,15 @@ async def update_state(self):
_LOGGER.debug(
"[wizlight %s] state unavailable: %s", self._light.ip, self._state
)
await self.update_state_unavailable()
self.update_state_unavailable()
else:
await self.update_state_available()
self.update_state_available()
except TimeoutError as ex:
_LOGGER.debug(ex)
await self.update_state_unavailable()
self.update_state_unavailable()
except WizLightTimeOutError as ex:
_LOGGER.debug(ex)
await self.update_state_unavailable()
self.update_state_unavailable()
_LOGGER.debug("[wizlight %s] updated state: %s", self._light.ip, self._state)

def update_brightness(self):
Expand Down

0 comments on commit de5efd4

Please sign in to comment.