Skip to content

Commit

Permalink
Fix deprecated constants
Browse files Browse the repository at this point in the history
datetime as string
  • Loading branch information
toringer committed Apr 18, 2024
1 parent 92d519a commit 1b75324
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions custom_components/met_next_6_hours_forecast/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_NAME,
TEMP_CELSIUS,
SPEED_METERS_PER_SECOND,
LENGTH_MILLIMETERS,
UnitOfTemperature,
UnitOfSpeed,
UnitOfLength,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down Expand Up @@ -56,9 +56,9 @@ def format_condition(condition: str) -> str:
class SixHoursWeather(WeatherEntity):
"""Representation of a Met.no next 6 hours forecast sensor."""

_attr_native_temperature_unit = TEMP_CELSIUS
_attr_native_wind_speed_unit = SPEED_METERS_PER_SECOND
_attr_native_precipitation_unit = LENGTH_MILLIMETERS
_attr_native_temperature_unit = UnitOfTemperature.CELSIUS
_attr_native_wind_speed_unit = UnitOfSpeed.METERS_PER_SECOND
_attr_native_precipitation_unit = UnitOfLength.MILLIMETERS
_attr_supported_features = WeatherEntityFeature.FORECAST_HOURLY

def __init__(
Expand Down Expand Up @@ -210,7 +210,7 @@ async def async_update(self):
]
if "probability_of_precipitation" in details
else None,
datetime=time,
datetime=time.strftime("%Y-%m-%dT%H:%M:%S+00:00"),
condition=condition,
native_pressure=current["air_pressure_at_sea_level"],
wind_bearing=current["wind_from_direction"],
Expand Down

0 comments on commit 1b75324

Please sign in to comment.