Use enums in trafikverket_train (#62026)
This commit is contained in:
parent
b4daa88d9e
commit
db4721bfba
1 changed files with 6 additions and 8 deletions
|
@ -6,14 +6,12 @@ import logging
|
||||||
from pytrafikverket import TrafikverketTrain
|
from pytrafikverket import TrafikverketTrain
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
from homeassistant.components.sensor import (
|
||||||
from homeassistant.const import (
|
PLATFORM_SCHEMA,
|
||||||
CONF_API_KEY,
|
SensorDeviceClass,
|
||||||
CONF_NAME,
|
SensorEntity,
|
||||||
CONF_WEEKDAY,
|
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
|
||||||
WEEKDAYS,
|
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_WEEKDAY, WEEKDAYS
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
|
@ -118,7 +116,7 @@ def next_departuredate(departure):
|
||||||
class TrainSensor(SensorEntity):
|
class TrainSensor(SensorEntity):
|
||||||
"""Contains data about a train depature."""
|
"""Contains data about a train depature."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_TIMESTAMP
|
_attr_device_class = SensorDeviceClass.TIMESTAMP
|
||||||
|
|
||||||
def __init__(self, train_api, name, from_station, to_station, weekday, time):
|
def __init__(self, train_api, name, from_station, to_station, weekday, time):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue