8000 Fix Nest doing I/O inside event loop by balloob · Pull Request #4855 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix Nest doing I/O inside event loop #4855

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
Dec 12, 2016
Merged

Fix Nest doing I/O inside event loop #4855

merged 1 commit into from
Dec 12, 2016

Conversation

balloob
Copy link
Member
@balloob balloob commented Dec 11, 2016

Description:
This fixes Nest doing I/O inside the event loop as reported in #4210 (comment)

CC @technicalpickles

@balloob balloob added this to the 0.34.5 milestone Dec 11, 2016
@mention-bot
Copy link

@balloob, thanks for your PR! By analyzing the history of the files in this pull request, we identified @technicalpickles, @fabaff and @pvizeli to be potential reviewers.

@balloob balloob merged commit df98d5b into dev Dec 12, 2016
@balloob balloob deleted the nest-async branch December 12, 2016 01:34
balloob added a commit that referenced this pull request Dec 12, 2016
@technicalpickles
Copy link
Contributor

I had seen that warning before, but didn't know what caused it 👍

In general, should formatting happen during update? Or is it just because there's a replace happening?

@balloob
Copy link
Member Author
balloob commented Dec 13, 2016

This was the offending line self.device.temperature_scale. Anything on device can end up generating a request to the Nest servers.

@@ -128,13 +128,20 @@ def __init__(self, structure, device, variable):

# device specific
self._location = self.device.where
self._name = self.device.name_long
self._name = "{} {}".format(self.device.name_long,
self.variable.replace("_", " "))
Copy link
Contributor

Choose a reason for hiding this comment

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

This line introduced this error when you have Cameras:

16-12-16 11:16:52 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform nest
Traceback (most recent call last):
  File "/Users/technicalpickles/src/picklehome/vendor/home-assistant/homeassistant/helpers/entity_component.py", line 150, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/technicalpickles/src/picklehome/vendor/home-assistant/homeassistant/components/binary_sensor/nest.py", line 98, in setup_platform
    activity_zone)]
  File "/Users/technicalpickles/src/picklehome/vendor/home-assistant/homeassistant/components/binary_sensor/nest.py", line 121, in __init__
    super(NestActivityZoneSensor, self).__init__(structure, device, None)
  File "/Users/technicalpickles/src/picklehome/vendor/home-assistant/homeassistant/components/sensor/nest.py", line 136, in __init__
    self.variable.replace("_", " "))
AttributeError: 'NoneType' object has no attribute 'replace'

It looks like it's my bad use of inheritence, where an NestActivityZoneSensor in the binary sensor passes in variable of None, since it's doing it's own thing.

I'll followup with a PR to fix.

@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0