Use new SensorDeviceClass enum in hvv_departures (#61780)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-14 11:55:31 +01:00 committed by GitHub
parent f4edd0ea20
commit 96e54ca939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import async_timeout
from pygti.exceptions import InvalidAuth from pygti.exceptions import InvalidAuth
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.const import ATTR_ATTRIBUTION
@ -172,7 +172,7 @@ class HvvDepartureBinarySensor(CoordinatorEntity, BinarySensorEntity):
@property @property
def device_class(self): def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES.""" """Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_PROBLEM return BinarySensorDeviceClass.PROBLEM
@property @property
def extra_state_attributes(self): def extra_state_attributes(self):

View file

@ -5,8 +5,8 @@ import logging
from aiohttp import ClientConnectorError from aiohttp import ClientConnectorError
from pygti.exceptions import InvalidAuth from pygti.exceptions import InvalidAuth
from homeassistant.components.sensor import SensorEntity from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ID, DEVICE_CLASS_TIMESTAMP from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ID
from homeassistant.helpers import aiohttp_client from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity import DeviceInfo
from homeassistant.util import Throttle from homeassistant.util import Throttle
@ -195,7 +195,7 @@ class HVVDepartureSensor(SensorEntity):
@property @property
def device_class(self): def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES.""" """Return the class of this device, from component DEVICE_CLASSES."""
return DEVICE_CLASS_TIMESTAMP return SensorDeviceClass.TIMESTAMP
@property @property
def extra_state_attributes(self): def extra_state_attributes(self):