File tree Expand file tree Collapse file tree
custom_components/opencwb Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from homeassistant .core import HomeAssistant , callback
33from homeassistant .config_entries import ConfigEntry
44from homeassistant .components .weather import Forecast , WeatherEntityFeature , SingleCoordinatorWeatherEntity
5- from homeassistant .const import UnitOfPressure , UnitOfTemperature
5+ from homeassistant .const import UnitOfLength , UnitOfPressure , UnitOfSpeed , UnitOfTemperature
66from homeassistant .util .unit_conversion import PressureConverter
77from homeassistant .helpers .device_registry import DeviceEntryType
88from homeassistant .helpers .entity import DeviceInfo
99from homeassistant .helpers .entity_platform import AddEntitiesCallback
10- from homeassistant .const import (
11- UnitOfSpeed
12- )
1310
1411from .const import (
1512 ATTR_API_CLOUDS ,
@@ -56,6 +53,9 @@ async def async_setup_entry(
5653class OpenCWBWeather (SingleCoordinatorWeatherEntity [WeatherUpdateCoordinator ]):
5754 """Implementation of an OpenCWB sensor."""
5855 _attr_attribution = ATTRIBUTION
56+ _attr_native_temperature_unit = UnitOfTemperature .CELSIUS
57+ _attr_native_pressure_unit = UnitOfPressure .HPA
58+ _attr_native_precipitation_unit = UnitOfLength .MILLIMETERS
5959 _attr_native_wind_speed_unit = UnitOfSpeed .METERS_PER_SECOND
6060
6161 def __init__ (
You can’t perform that action at this time.
0 commit comments