Correctly close lacrosse on homeassistant stop (#47555)

Since lacrosse.close() takes no arguments, but was directly added as a
listener to EVENT_HOMEASSISTANT_STOP, the following occured on shutdown:

Traceback (most recent call last):
  File "/usr/lib/python/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: close() takes 1 positional argument but 2 were given
This commit is contained in:
Jan-Philipp Litza 2021-03-07 13:53:48 +01:00 committed by GitHub
parent 48f1a55a28
commit 4018d0a152
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
_LOGGER.warning("Unable to open serial port: %s", exc)
return False
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, lacrosse.close)
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, lambda event: lacrosse.close())
if CONF_JEELINK_LED in config:
lacrosse.led_mode_state(config.get(CONF_JEELINK_LED))