mirror of
https://github.com/Electric-Special/ha-core.git
synced 2026-03-21 03:03:17 +01:00
Improve type hints in tomorrowio weather (#163246)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from pytomorrowio.const import CURRENT
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -36,7 +38,7 @@ class TomorrowioEntity(CoordinatorEntity[TomorrowioDataUpdateCoordinator]):
|
||||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
||||
def _get_current_property(self, property_name: str) -> int | str | float | None:
|
||||
def _get_current_property(self, property_name: str) -> Any | None:
|
||||
"""Get property from current conditions.
|
||||
|
||||
Used for V4 API.
|
||||
|
||||
@@ -175,37 +175,37 @@ class TomorrowioWeatherEntity(TomorrowioEntity, SingleCoordinatorWeatherEntity):
|
||||
return CONDITIONS[condition]
|
||||
|
||||
@property
|
||||
def native_temperature(self):
|
||||
def native_temperature(self) -> float | None:
|
||||
"""Return the platform temperature."""
|
||||
return self._get_current_property(TMRW_ATTR_TEMPERATURE)
|
||||
|
||||
@property
|
||||
def native_pressure(self):
|
||||
def native_pressure(self) -> float | None:
|
||||
"""Return the raw pressure."""
|
||||
return self._get_current_property(TMRW_ATTR_PRESSURE)
|
||||
|
||||
@property
|
||||
def humidity(self):
|
||||
def humidity(self) -> float | None:
|
||||
"""Return the humidity."""
|
||||
return self._get_current_property(TMRW_ATTR_HUMIDITY)
|
||||
|
||||
@property
|
||||
def native_wind_speed(self):
|
||||
def native_wind_speed(self) -> float | None:
|
||||
"""Return the raw wind speed."""
|
||||
return self._get_current_property(TMRW_ATTR_WIND_SPEED)
|
||||
|
||||
@property
|
||||
def wind_bearing(self):
|
||||
def wind_bearing(self) -> float | None:
|
||||
"""Return the wind bearing."""
|
||||
return self._get_current_property(TMRW_ATTR_WIND_DIRECTION)
|
||||
|
||||
@property
|
||||
def ozone(self):
|
||||
def ozone(self) -> float | None:
|
||||
"""Return the O3 (ozone) level."""
|
||||
return self._get_current_property(TMRW_ATTR_OZONE)
|
||||
|
||||
@property
|
||||
def condition(self):
|
||||
def condition(self) -> str | None:
|
||||
"""Return the condition."""
|
||||
return self._translate_condition(
|
||||
self._get_current_property(TMRW_ATTR_CONDITION),
|
||||
@@ -213,7 +213,7 @@ class TomorrowioWeatherEntity(TomorrowioEntity, SingleCoordinatorWeatherEntity):
|
||||
)
|
||||
|
||||
@property
|
||||
def native_visibility(self):
|
||||
def native_visibility(self) -> float | None:
|
||||
"""Return the raw visibility."""
|
||||
return self._get_current_property(TMRW_ATTR_VISIBILITY)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user