1 """The ecoforest coordinator."""
5 from pyecoforest.api
import EcoforestApi
6 from pyecoforest.exceptions
import EcoforestError
7 from pyecoforest.models.device
import Device
12 from .const
import POLLING_INTERVAL
14 _LOGGER = logging.getLogger(__name__)
18 """DataUpdateCoordinator to gather data from ecoforest device."""
20 def __init__(self, hass: HomeAssistant, api: EcoforestApi) ->
None:
21 """Initialize DataUpdateCoordinator."""
27 update_interval=POLLING_INTERVAL,
32 """Fetch all device and sensor data from api."""
34 data = await self.
apiapi.
get()
35 except EcoforestError
as err:
36 raise UpdateFailed(f
"Error communicating with API: {err}")
from err
38 _LOGGER.debug(
"Ecoforest data: %s", data)
None __init__(self, HomeAssistant hass, EcoforestApi api)
Device _async_update_data(self)
web.Response get(self, web.Request request, str config_key)