mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Improve tankerkoenig generic coordinator typing (#116560)
This commit is contained in:
parent
fa920fd910
commit
bd24ce8d4d
@ -31,7 +31,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
TankerkoenigConfigEntry = ConfigEntry["TankerkoenigDataUpdateCoordinator"]
|
TankerkoenigConfigEntry = ConfigEntry["TankerkoenigDataUpdateCoordinator"]
|
||||||
|
|
||||||
|
|
||||||
class TankerkoenigDataUpdateCoordinator(DataUpdateCoordinator):
|
class TankerkoenigDataUpdateCoordinator(DataUpdateCoordinator[dict[str, PriceInfo]]):
|
||||||
"""Get the latest data from the API."""
|
"""Get the latest data from the API."""
|
||||||
|
|
||||||
config_entry: TankerkoenigConfigEntry
|
config_entry: TankerkoenigConfigEntry
|
||||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiotankerkoenig import GasType, PriceInfo, Station
|
from aiotankerkoenig import GasType, Station
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorStateClass
|
from homeassistant.components.sensor import SensorEntity, SensorStateClass
|
||||||
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CURRENCY_EURO
|
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CURRENCY_EURO
|
||||||
@ -109,5 +109,5 @@ class FuelPriceSensor(TankerkoenigCoordinatorEntity, SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def native_value(self) -> float:
|
def native_value(self) -> float:
|
||||||
"""Return the current price for the fuel type."""
|
"""Return the current price for the fuel type."""
|
||||||
info: PriceInfo = self.coordinator.data[self._station_id]
|
info = self.coordinator.data[self._station_id]
|
||||||
return getattr(info, self._fuel_type)
|
return getattr(info, self._fuel_type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user