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:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user