mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Made homeassistant.stop code leaner
This commit is contained in:
parent
ead057cb04
commit
f07622e0d7
@ -34,13 +34,8 @@ def start_home_assistant(eventbus):
|
|||||||
""" Start home assistant. """
|
""" Start home assistant. """
|
||||||
request_shutdown = threading.Event()
|
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,
|
eventbus.listen_once(EVENT_HOMEASSISTANT_STOP,
|
||||||
forge_shutdown_listener(request_shutdown))
|
lambda event: request_shutdown.set())
|
||||||
|
|
||||||
Timer(eventbus)
|
Timer(eventbus)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user