This repository has been archived by the owner on Jul 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from robmarkcole/minor-refactor
Update init
- Loading branch information
Showing
4 changed files
with
30 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,26 @@ | ||
"""The huesensors component.""" | ||
import asyncio | ||
import async_timeout | ||
|
||
|
||
def get_bridges(hass): | ||
from homeassistant.components import hue | ||
from homeassistant.components.hue.bridge import HueBridge | ||
|
||
return [ | ||
entry | ||
for entry in hass.data[hue.DOMAIN].values() | ||
if isinstance(entry, HueBridge) and entry.api | ||
] | ||
|
||
|
||
async def update_api(api): | ||
import aiohue | ||
|
||
try: | ||
with async_timeout.timeout(10): | ||
await api.update() | ||
except (asyncio.TimeoutError, aiohue.AiohueException) as err: | ||
_LOGGER.debug("Failed to fetch sensors: %s", err) | ||
return False | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters