Home Assistant Unofficial Reference 2024.12.1
types.py
Go to the documentation of this file.
1 """Types for the energy platform."""
2 
3 from __future__ import annotations
4 
5 from collections.abc import Awaitable, Callable
6 from typing import Protocol, TypedDict
7 
8 from homeassistant.core import HomeAssistant
9 
10 
11 class SolarForecastType(TypedDict):
12  """Return value for solar forecast."""
13 
14  wh_hours: dict[str, float | int]
15 
16 
17 type GetSolarForecastType = Callable[
18  [HomeAssistant, str], Awaitable[SolarForecastType | None]
19 ]
20 
21 
22 class EnergyPlatform(Protocol):
23  """Represents the methods we expect on the energy platforms."""
24 
25  @staticmethod
27  hass: HomeAssistant, config_entry_id: str
28  ) -> SolarForecastType | None:
29  """Get forecast for solar production for specific config entry ID."""
SolarForecastType|None async_get_solar_forecast(HomeAssistant hass, str config_entry_id)
Definition: types.py:28