8000 tellduslive: Fix exception when starting by molobrakos · Pull Request #7618 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tellduslive: Fix exception when starting #7618

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

Merged
merged 1 commit into from
Jun 2, 2017

Conversation

molobrakos
Copy link
Contributor
@molobrakos molobrakos commented May 16, 2017

Description:

Related issue (if applicable): fixes #7019

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

Checklist:

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

@molobrakos molobrakos changed the title tellduslive: Fix for https://github.com/home-assistant/home-assistant/issues/7019 tellduslive: Fix for #7019 May 16, 2017
@molobrakos molobrakos changed the title tellduslive: Fix for #7019 tellduslive: Fix exception when starting May 16, 2017
@@ -56,7 +57,8 @@ def setup(hass, config):
return False

hass.data[DOMAIN] = client
client.update(utcnow())

hass.bus.listen(EVENT_HOMEASSISTANT_START, client.update)
Copy link
Member

Choose a reason for hiding this comment

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

Instead of this, move self._client.entities.append(self) from TelldusEntity __init__ to a new method on that class:

@asyncio.coroutine
def async_added_to_hass(self):
    """Entity has been added to hass."""
    self._client.entities.append(self)

When async_added_to_hass gets called, hass is set so updating the client will not result in entities without hass

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, but with this change, the periodically polling of the server never starts, since update() reschedules itself after each run of sync. Should I make your change, in addition to keeping the hass.bus.listen-stuff?

Copy link
Member

Choose a reason for hiding this comment

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

Good point. Keep the start listener and start polling on START event. Append in added_to_hass hook

@balloob balloob merged commit 1855f1a into home-assistant:dev Jun 2, 2017
@balloob balloob mentioned this pull request Jun 2, 2017
@molobrakos molobrakos deleted the telldus-fix branch June 9, 2017 15:29
@home-assistant home-assistant locked and limited conversation to collaborators Oct 20, 2017
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.

Tellduslive and v0.42.2 problems
4 participants
0