Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.uk_transport.sensor Namespace Reference

Classes

class  UkTransportLiveBusTimeSensor
 
class  UkTransportLiveTrainTimeSensor
 
class  UkTransportSensor
 

Functions

def _delta_mins (hhmm_time_str)
 
None setup_platform (HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
 _QUERY_SCHEME
 
string ATTR_ATCOCODE = "atcocode"
 
string ATTR_CALLING_AT = "calling_at"
 
string ATTR_LOCALITY = "locality"
 
string ATTR_NEXT_BUSES = "next_buses"
 
string ATTR_NEXT_TRAINS = "next_trains"
 
string ATTR_REQUEST_TIME = "request_time"
 
string ATTR_STATION_CODE = "station_code"
 
string ATTR_STOP_NAME = "stop_name"
 
string CONF_API_APP_ID = "app_id"
 
string CONF_API_APP_KEY = "app_key"
 
string CONF_DESTINATION = "destination"
 
string CONF_ORIGIN = "origin"
 
string CONF_QUERIES = "queries"
 
 PLATFORM_SCHEMA
 

Detailed Description

Support for UK public transport data provided by transportapi.com.

Function Documentation

◆ _delta_mins()

def homeassistant.components.uk_transport.sensor._delta_mins (   hhmm_time_str)
private
Calculate time delta in minutes to a time in hh:mm format.

Definition at line 283 of file sensor.py.

◆ setup_platform()

None homeassistant.components.uk_transport.sensor.setup_platform ( HomeAssistant  hass,
ConfigType  config,
AddEntitiesCallback  add_entities,
DiscoveryInfoType | None   discovery_info = None 
)
Get the uk_transport sensor.

Definition at line 60 of file sensor.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.uk_transport.sensor._LOGGER = logging.getLogger(__name__)
private

Definition at line 26 of file sensor.py.

◆ _QUERY_SCHEME

homeassistant.components.uk_transport.sensor._QUERY_SCHEME
private
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(CONF_MODE): vol.All(cv.ensure_list, [vol.In(["bus", "train"])]),
4  vol.Required(CONF_ORIGIN): cv.string,
5  vol.Required(CONF_DESTINATION): cv.string,
6  }
7 )

Definition at line 43 of file sensor.py.

◆ ATTR_ATCOCODE

string homeassistant.components.uk_transport.sensor.ATTR_ATCOCODE = "atcocode"

Definition at line 28 of file sensor.py.

◆ ATTR_CALLING_AT

string homeassistant.components.uk_transport.sensor.ATTR_CALLING_AT = "calling_at"

Definition at line 34 of file sensor.py.

◆ ATTR_LOCALITY

string homeassistant.components.uk_transport.sensor.ATTR_LOCALITY = "locality"

Definition at line 29 of file sensor.py.

◆ ATTR_NEXT_BUSES

string homeassistant.components.uk_transport.sensor.ATTR_NEXT_BUSES = "next_buses"

Definition at line 32 of file sensor.py.

◆ ATTR_NEXT_TRAINS

string homeassistant.components.uk_transport.sensor.ATTR_NEXT_TRAINS = "next_trains"

Definition at line 35 of file sensor.py.

◆ ATTR_REQUEST_TIME

string homeassistant.components.uk_transport.sensor.ATTR_REQUEST_TIME = "request_time"

Definition at line 31 of file sensor.py.

◆ ATTR_STATION_CODE

string homeassistant.components.uk_transport.sensor.ATTR_STATION_CODE = "station_code"

Definition at line 33 of file sensor.py.

◆ ATTR_STOP_NAME

string homeassistant.components.uk_transport.sensor.ATTR_STOP_NAME = "stop_name"

Definition at line 30 of file sensor.py.

◆ CONF_API_APP_ID

string homeassistant.components.uk_transport.sensor.CONF_API_APP_ID = "app_id"

Definition at line 38 of file sensor.py.

◆ CONF_API_APP_KEY

string homeassistant.components.uk_transport.sensor.CONF_API_APP_KEY = "app_key"

Definition at line 37 of file sensor.py.

◆ CONF_DESTINATION

string homeassistant.components.uk_transport.sensor.CONF_DESTINATION = "destination"

Definition at line 41 of file sensor.py.

◆ CONF_ORIGIN

string homeassistant.components.uk_transport.sensor.CONF_ORIGIN = "origin"

Definition at line 40 of file sensor.py.

◆ CONF_QUERIES

string homeassistant.components.uk_transport.sensor.CONF_QUERIES = "queries"

Definition at line 39 of file sensor.py.

◆ PLATFORM_SCHEMA

homeassistant.components.uk_transport.sensor.PLATFORM_SCHEMA
Initial value:
1 = SENSOR_PLATFORM_SCHEMA.extend(
2  {
3  vol.Required(CONF_API_APP_ID): cv.string,
4  vol.Required(CONF_API_APP_KEY): cv.string,
5  vol.Required(CONF_QUERIES): [_QUERY_SCHEME],
6  }
7 )

Definition at line 51 of file sensor.py.