Skip to content

Commit

Permalink
Merge pull request #112 from hmmbob/patch-1
Browse files Browse the repository at this point in the history
Fix for HA 2024.1
  • Loading branch information
golles authored Jan 1, 2024
2 parents 8c686da + 3627e5b commit 8c23d06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions custom_components/knmi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME, PERCENTAGE, TEMP_CELSIUS, UnitOfSpeed
from homeassistant.const import CONF_NAME, PERCENTAGE, UnitOfSpeed, UnitOfTemperature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand All @@ -21,14 +21,14 @@
SensorEntityDescription(
key="dauwp",
name="Dauwpunt",
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
SensorEntityDescription(
key="gtemp",
name="Gevoelstemperatuur",
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
Expand Down
16 changes: 8 additions & 8 deletions custom_components/knmi/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_NAME,
LENGTH_KILOMETERS,
PRESSURE_HPA,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
UnitOfLength,
UnitOfPressure,
UnitOfSpeed,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -85,10 +85,10 @@ class KnmiWeather(WeatherEntity):
"""Defines a KNMI weather entity."""

_attr_attribution = "KNMI Weergegevens via https://weerlive.nl"
_attr_native_pressure_unit = PRESSURE_HPA
_attr_native_temperature_unit = TEMP_CELSIUS
_attr_native_visibility_unit = LENGTH_KILOMETERS
_attr_native_wind_speed_unit = SPEED_KILOMETERS_PER_HOUR
_attr_native_pressure_unit = UnitOfPressure.HPA
_attr_native_temperature_unit = UnitOfTemperature.CELSIUS
_attr_native_visibility_unit = UnitOfLength.KILOMETERS
_attr_native_wind_speed_unit = UnitOfSpeed.KILOMETERS_PER_HOUR
_attr_supported_features = WeatherEntityFeature.FORECAST_DAILY

def __init__(
Expand Down

0 comments on commit 8c23d06

Please sign in to comment.