Made homeassistant.stop code leaner

This commit is contained in:
Paulus Schoutsen 2013-11-11 17:46:08 -08:00
parent ead057cb04
commit f07622e0d7

View File

@ -34,13 +34,8 @@ def start_home_assistant(eventbus):
""" Start home assistant. """
request_shutdown = threading.Event()
def forge_shutdown_listener(request_shutdown):
""" Creates a listener for shutdowns.
Local variables cannot be referenced but parameters can. """
return lambda event: request_shutdown.set()
eventbus.listen_once(EVENT_HOMEASSISTANT_STOP,
forge_shutdown_listener(request_shutdown))
lambda event: request_shutdown.set())
Timer(eventbus)