mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix api_password conditional and close zeroconf when we shut down
This commit is contained in:
parent
e1ffdcc5f1
commit
1de45ebe8b
@ -32,7 +32,7 @@ def setup(hass, config):
|
||||
ZEROCONF_TYPE)
|
||||
|
||||
params = {"version": __version__, "base_url": hass.config.api.base_url,
|
||||
"needs_auth": (hass.config.api.api_password != "")}
|
||||
"needs_auth": (hass.config.api.api_password is not None)}
|
||||
|
||||
info = ServiceInfo(ZEROCONF_TYPE, zeroconf_name,
|
||||
socket.inet_aton(hass.config.api.host),
|
||||
@ -43,6 +43,7 @@ def setup(hass, config):
|
||||
def stop_zeroconf(event):
|
||||
"""Stop Zeroconf."""
|
||||
zeroconf.unregister_service(info)
|
||||
zeroconf.close()
|
||||
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_zeroconf)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user