dashboard: Centralize dashboard entries into DashboardEntries class (#5774)

* Centralize dashboard entries into DashboardEntries class

* preen

* preen

* preen

* preen

* preen
This commit is contained in:
J. Nick Koston
2023-11-15 20:49:56 -06:00
committed by GitHub
parent 5f1d8dfa5b
commit 149d814fab
7 changed files with 209 additions and 133 deletions
+3 -4
View File
@@ -7,7 +7,7 @@ import threading
from esphome import mqtt
from ..core import DASHBOARD, list_dashboard_entries
from ..core import DASHBOARD
class MqttStatusThread(threading.Thread):
@@ -16,7 +16,7 @@ class MqttStatusThread(threading.Thread):
def run(self) -> None:
"""Run the status thread."""
dashboard = DASHBOARD
entries = list_dashboard_entries()
entries = dashboard.entries.all()
config = mqtt.config_from_env()
topic = "esphome/discover/#"
@@ -51,8 +51,7 @@ class MqttStatusThread(threading.Thread):
client.loop_start()
while not dashboard.stop_event.wait(2):
# update entries
entries = list_dashboard_entries()
entries = dashboard.entries.all()
# will be set to true on on_message
for entry in entries: