1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Don't run unnecessary methods in executor pool (#14853)

* Don't run unnecessary methods in executor pool

* Lint

* Lint 2
This commit is contained in:
Paulus Schoutsen
2018-06-07 15:31:21 -04:00
committed by GitHub
parent 50321a29b5
commit 90a51160c4
13 changed files with 23 additions and 32 deletions

View File

@@ -171,13 +171,6 @@ class Entity(object):
"""Flag supported features."""
return None
def update(self):
"""Retrieve latest state.
For asyncio use coroutine async_update.
"""
pass
# DO NOT OVERWRITE
# These properties and methods are either managed by Home Assistant or they
# are used to perform a very specific function. Overwriting these may
@@ -320,10 +313,10 @@ class Entity(object):
)
try:
# pylint: disable=no-member
if hasattr(self, 'async_update'):
# pylint: disable=no-member
yield from self.async_update()
else:
elif hasattr(self, 'update'):
yield from self.hass.async_add_job(self.update)
finally:
self._update_staged = False