Add sensor setup type hints [r] (#63312)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
595e8a327c
commit
822ac203c3
13 changed files with 128 additions and 14 deletions
|
@ -4,6 +4,8 @@ Support for Rejseplanen information from rejseplanen.dk.
|
|||
For more info on the API see:
|
||||
https://help.rejseplanen.dk/hc/en-us/articles/214174465-Rejseplanen-s-API
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import suppress
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
|
@ -14,7 +16,10 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME, TIME_MINUTES
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -73,7 +78,12 @@ def due_in_minutes(timestamp):
|
|||
return int(diff.total_seconds() // 60)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
def setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
add_devices: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up the Rejseplanen transport sensor."""
|
||||
name = config[CONF_NAME]
|
||||
stop_id = config[CONF_STOP_ID]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue