1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-31 04:34:10 +01:00
Files
core/homeassistant/components/nmbs/const.py
T

32 lines
799 B
Python

"""The NMBS integration."""
from typing import Final
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
DOMAIN: Final = "nmbs"
PLATFORMS: Final = [Platform.SENSOR]
CONF_STATION_FROM = "station_from"
CONF_STATION_TO = "station_to"
CONF_STATION_LIVE = "station_live"
CONF_EXCLUDE_VIAS = "exclude_vias"
def find_station_by_name(hass: HomeAssistant, station_name: str):
"""Find given station_name in the station list."""
return next(
(s for s in hass.data[DOMAIN] if station_name in (s.standard_name, s.name)),
None,
)
def find_station(hass: HomeAssistant, station_name: str):
"""Find given station_id in the station list."""
return next(
(s for s in hass.data[DOMAIN] if station_name in s.id),
None,
)