mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 02:58:11 +01:00
Allow specifying the dashboard bind address (#2787)
This commit is contained in:
parent
15cd602e8b
commit
7e8012c1a0
2 changed files with 10 additions and 3 deletions
|
@ -637,6 +637,12 @@ def parse_args(argv):
|
||||||
type=int,
|
type=int,
|
||||||
default=6052,
|
default=6052,
|
||||||
)
|
)
|
||||||
|
parser_dashboard.add_argument(
|
||||||
|
"--address",
|
||||||
|
help="The address to bind to.",
|
||||||
|
type=str,
|
||||||
|
default="0.0.0.0",
|
||||||
|
)
|
||||||
parser_dashboard.add_argument(
|
parser_dashboard.add_argument(
|
||||||
"--username",
|
"--username",
|
||||||
help="The optional username to require for authentication.",
|
help="The optional username to require for authentication.",
|
||||||
|
|
|
@ -970,16 +970,17 @@ def start_web_server(args):
|
||||||
server.add_socket(socket)
|
server.add_socket(socket)
|
||||||
else:
|
else:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"Starting dashboard web server on http://0.0.0.0:%s and configuration dir %s...",
|
"Starting dashboard web server on http://%s:%s and configuration dir %s...",
|
||||||
|
args.address,
|
||||||
args.port,
|
args.port,
|
||||||
settings.config_dir,
|
settings.config_dir,
|
||||||
)
|
)
|
||||||
app.listen(args.port)
|
app.listen(args.port, args.address)
|
||||||
|
|
||||||
if args.open_ui:
|
if args.open_ui:
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
|
||||||
webbrowser.open(f"localhost:{args.port}")
|
webbrowser.open(f"http://{args.address}:{args.port}")
|
||||||
|
|
||||||
if settings.status_use_ping:
|
if settings.status_use_ping:
|
||||||
status_thread = PingStatusThread()
|
status_thread = PingStatusThread()
|
||||||
|
|
Loading…
Reference in a new issue