1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-10 15:22:24 +01:00

dashboard: Add lookup by name to entries (#5790)

* Add lookup by name to entries

* adj

* tweak

* tweak

* tweak

* tweak

* tweak

* tweak

* preen
This commit is contained in:
J. Nick Koston
2023-11-19 21:29:40 -06:00
committed by GitHub
parent 4e4fe3c26d
commit cd9bf29df1
3 changed files with 32 additions and 44 deletions

View File

@@ -271,14 +271,15 @@ class EsphomePortCommandWebSocket(EsphomeCommandWebSocket):
) -> list[str]:
"""Build the command to run."""
dashboard = DASHBOARD
entries = dashboard.entries
configuration = json_message["configuration"]
config_file = settings.rel_path(configuration)
port = json_message["port"]
if (
port == "OTA"
and (mdns := dashboard.mdns_status)
and (host_name := mdns.get_path_to_host_name(config_file))
and (address := await mdns.async_resolve_host(host_name))
and (entry := entries.get(config_file))
and (address := await mdns.async_resolve_host(entry.name))
):
port = address