mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Use shorthand attributes in ZAMG (#99925)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
parent
f121e891fd
commit
43fe8d16c3
@ -32,6 +32,10 @@ class ZamgWeather(CoordinatorEntity, WeatherEntity):
|
|||||||
"""Representation of a weather condition."""
|
"""Representation of a weather condition."""
|
||||||
|
|
||||||
_attr_attribution = ATTRIBUTION
|
_attr_attribution = ATTRIBUTION
|
||||||
|
_attr_native_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
|
_attr_native_pressure_unit = UnitOfPressure.HPA
|
||||||
|
_attr_native_wind_speed_unit = UnitOfSpeed.METERS_PER_SECOND
|
||||||
|
_attr_native_precipitation_unit = UnitOfPrecipitationDepth.MILLIMETERS
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str
|
self, coordinator: ZamgDataUpdateCoordinator, name: str, station_id: str
|
||||||
@ -48,16 +52,6 @@ class ZamgWeather(CoordinatorEntity, WeatherEntity):
|
|||||||
configuration_url=MANUFACTURER_URL,
|
configuration_url=MANUFACTURER_URL,
|
||||||
name=coordinator.name,
|
name=coordinator.name,
|
||||||
)
|
)
|
||||||
# set units of ZAMG API
|
|
||||||
self._attr_native_temperature_unit = UnitOfTemperature.CELSIUS
|
|
||||||
self._attr_native_pressure_unit = UnitOfPressure.HPA
|
|
||||||
self._attr_native_wind_speed_unit = UnitOfSpeed.METERS_PER_SECOND
|
|
||||||
self._attr_native_precipitation_unit = UnitOfPrecipitationDepth.MILLIMETERS
|
|
||||||
|
|
||||||
@property
|
|
||||||
def condition(self) -> str | None:
|
|
||||||
"""Return the current condition."""
|
|
||||||
return None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_temperature(self) -> float | None:
|
def native_temperature(self) -> float | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user