Clean up some async stuff (#3915)

* Clean up some async stuff

* Adjust comments

* Pass hass instance to eventbus
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2016-10-17 19:38:41 -07:00
1 parent daea93d9f9
commit 4c8d1d9d2f
7 files changed
+139 -111

No files matched your search

+1 -4
View File
@@ -79,8 +79,7 @@ class NuimoThread(threading.Thread):
self._name = name
self._hass_is_running = True
self._nuimo = None
self._listener = hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP,
self.stop)
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, self.stop)
def run(self):
"""Setup connection or be idle."""
@@ -99,8 +98,6 @@ class NuimoThread(threading.Thread):
"""Terminate Thread by unsetting flag."""
_LOGGER.debug('Stopping thread for Nuimo %s', self._mac)
self._hass_is_running = False
self._hass.bus.remove_listener(EVENT_HOMEASSISTANT_STOP,
self._listener)
def _attach(self):
"""Create a nuimo object from mac address or discovery."""