Skip to content

Commit

Permalink
Replace DEVICE_CLASS_TIMESTAMP with SensorDeviceClass.TIMESTAMP (#23)
Browse files Browse the repository at this point in the history
Update sensor.py to use SensorDeviceClass.TIMESTAMP instead of the deprecated DEVICE_CLASS_TIMESTAMP, ensuring compatibility with Home Assistant Core 2025.1.
  • Loading branch information
040medien authored Oct 29, 2024
1 parent 4173d0d commit cd81e45
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions custom_components/hass_stadtreinigung_hamburg/sensor.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorDeviceClass
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle, slugify
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_NAME, DEVICE_CLASS_TIMESTAMP
from homeassistant.const import CONF_NAME
from homeassistant.helpers.entity import Entity
import logging
from datetime import datetime
from datetime import timedelta
from datetime import datetime, timedelta
from homeassistant.core import HomeAssistant
from typing import Optional

Expand Down Expand Up @@ -99,7 +98,7 @@ def unit_of_measurement(self):
@property
def device_class(self) -> Optional[str]:
"""Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_TIMESTAMP
return SensorDeviceClass.TIMESTAMP

@property
def extra_state_attributes(self):
Expand Down

0 comments on commit cd81e45

Please sign in to comment.