1 """Coordinator to interact with an ESPHome dashboard."""
3 from __future__
import annotations
5 from datetime
import timedelta
9 from awesomeversion
import AwesomeVersion
10 from esphome_dashboard_api
import ConfiguredDevice, ESPHomeDashboardAPI
15 _LOGGER = logging.getLogger(__name__)
17 MIN_VERSION_SUPPORTS_UPDATE = AwesomeVersion(
"2023.1.0")
21 """Class to interact with the ESPHome dashboard."""
28 session: aiohttp.ClientSession,
35 name=
"ESPHome Dashboard",
41 self.
apiapi = ESPHomeDashboardAPI(url, session)
45 """Fetch device data."""
46 devices = await self.
apiapi.get_devices()
47 configured_devices = devices[
"configured"]
51 and configured_devices
52 and (current_version := configured_devices[0].
get(
"current_version"))
55 AwesomeVersion(current_version) > MIN_VERSION_SUPPORTS_UPDATE
58 return {dev[
"name"]: dev
for dev
in configured_devices}
None __init__(self, HomeAssistant hass, str addon_slug, str url, aiohttp.ClientSession session)
dict _async_update_data(self)
web.Response get(self, web.Request request, str config_key)