Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed to async/await #13246

Merged
merged 4 commits into from
Mar 17, 2018
Merged

Changed to async/await #13246

merged 4 commits into from
Mar 17, 2018

Conversation

thrawnarn
Copy link
Contributor

@thrawnarn thrawnarn commented Mar 15, 2018

Description:

  • Updated to async/await
  • Fixed bug in asyn_init, the callback from async_track_time_interval started to supply trigger date as an argument which broke the implementation

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@@ -392,8 +383,8 @@ def async_update_status(self):
self._group_name = group_name
# the sleep is needed to make sure that the
# devices is synced
yield from asyncio.sleep(1, loop=self._hass.loop)
yield from self.async_trigger_sync_on_all()
time.sleep(1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined name 'time'

Copy link
Member

@balloob balloob Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never ever use time.sleep. It blocks the event loop or executor thread (depending on context). Keep using asyncio.sleep because you're inside an async context and that won't block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was confused :)
I've changed it back now

@asyncio.coroutine
def _start_poll_command(self):

async def _start_poll_command(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too many blank lines (2)

@@ -254,16 +249,16 @@ def force_update_sync_status(
on_updated_cb()
return True

@asyncio.coroutine
def _start_poll_command(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace


@asyncio.coroutine
def force_update_sync_status(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace


@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
async def async_setup_platform(hass, config, async_add_devices,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected 2 blank lines, found 1

@pvizeli pvizeli merged commit 05676ba into home-assistant:dev Mar 17, 2018
@thrawnarn thrawnarn deleted the bluesound-async branch March 19, 2018 15:22
@balloob balloob mentioned this pull request Mar 30, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants