-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
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
Conversation
@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. |
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? |
This was the offending line |
@@ -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("_", " ")) |
There was a problem hiding this comment.
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.
Description:
This fixes Nest doing I/O inside the event loop as reported in #4210 (comment)
CC @technicalpickles