dashboard: Only ping when polling is active (#6001)

fixes https://github.com/esphome/issues/issues/5257
This commit is contained in:
J. Nick Koston 2023-12-22 15:43:17 -10:00 committed by GitHub
parent 46c4c61b40
commit a97fc4f758
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,6 +31,7 @@ class PingStatus:
while not dashboard.stop_event.is_set(): while not dashboard.stop_event.is_set():
# Only ping if the dashboard is open # Only ping if the dashboard is open
await dashboard.ping_request.wait() await dashboard.ping_request.wait()
dashboard.ping_request.clear()
current_entries = dashboard.entries.async_all() current_entries = dashboard.entries.async_all()
to_ping: list[DashboardEntry] = [ to_ping: list[DashboardEntry] = [
entry for entry in current_entries if entry.address is not None entry for entry in current_entries if entry.address is not None