mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Allow get local ip to work without internet (#8855)
This commit is contained in:
parent
c49cce7243
commit
ac9c1235bb
@ -99,7 +99,10 @@ def get_local_ip():
|
||||
|
||||
return sock.getsockname()[0]
|
||||
except socket.error:
|
||||
try:
|
||||
return socket.gethostbyname(socket.gethostname())
|
||||
except socket.gaierror:
|
||||
return '127.0.0.1'
|
||||
finally:
|
||||
sock.close()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user