Migrate homematicip_cloud to native_* (#74385)
parent
8259ce9868
commit
5e7174a5f4
|
@ -22,7 +22,7 @@ from homeassistant.components.weather import (
|
|||
WeatherEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
from homeassistant.const import SPEED_KILOMETERS_PER_HOUR, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
|
@ -71,6 +71,9 @@ async def async_setup_entry(
|
|||
class HomematicipWeatherSensor(HomematicipGenericEntity, WeatherEntity):
|
||||
"""Representation of the HomematicIP weather sensor plus & basic."""
|
||||
|
||||
_attr_native_temperature_unit = TEMP_CELSIUS
|
||||
_attr_native_wind_speed_unit = SPEED_KILOMETERS_PER_HOUR
|
||||
|
||||
def __init__(self, hap: HomematicipHAP, device) -> None:
|
||||
"""Initialize the weather sensor."""
|
||||
super().__init__(hap, device)
|
||||
|
@ -81,22 +84,17 @@ class HomematicipWeatherSensor(HomematicipGenericEntity, WeatherEntity):
|
|||
return self._device.label
|
||||
|
||||
@property
|
||||
def temperature(self) -> float:
|
||||
def native_temperature(self) -> float:
|
||||
"""Return the platform temperature."""
|
||||
return self._device.actualTemperature
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def humidity(self) -> int:
|
||||
"""Return the humidity."""
|
||||
return self._device.humidity
|
||||
|
||||
@property
|
||||
def wind_speed(self) -> float:
|
||||
def native_wind_speed(self) -> float:
|
||||
"""Return the wind speed."""
|
||||
return self._device.windSpeed
|
||||
|
||||
|
@ -129,6 +127,9 @@ class HomematicipWeatherSensorPro(HomematicipWeatherSensor):
|
|||
class HomematicipHomeWeather(HomematicipGenericEntity, WeatherEntity):
|
||||
"""Representation of the HomematicIP home weather."""
|
||||
|
||||
_attr_native_temperature_unit = TEMP_CELSIUS
|
||||
_attr_native_wind_speed_unit = SPEED_KILOMETERS_PER_HOUR
|
||||
|
||||
def __init__(self, hap: HomematicipHAP) -> None:
|
||||
"""Initialize the home weather."""
|
||||
hap.home.modelType = "HmIP-Home-Weather"
|
||||
|
@ -145,22 +146,17 @@ class HomematicipHomeWeather(HomematicipGenericEntity, WeatherEntity):
|
|||
return f"Weather {self._home.location.city}"
|
||||
|
||||
@property
|
||||
def temperature(self) -> float:
|
||||
def native_temperature(self) -> float:
|
||||
"""Return the temperature."""
|
||||
return self._device.weather.temperature
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def humidity(self) -> int:
|
||||
"""Return the humidity."""
|
||||
return self._device.weather.humidity
|
||||
|
||||
@property
|
||||
def wind_speed(self) -> float:
|
||||
def native_wind_speed(self) -> float:
|
||||
"""Return the wind speed."""
|
||||
return round(self._device.weather.windSpeed, 1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue