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

Classes

class  ViaggiaTrenoSensor
 

Functions

def async_http_request (hass, uri)
 
None async_setup_platform (HomeAssistant hass, ConfigType config, AddEntitiesCallback async_add_entities, DiscoveryInfoType|None discovery_info=None)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
string ARRIVED_STRING = "Arrived"
 
string CANCELLED_STRING = "Cancelled"
 
string CONF_NAME = "train_name"
 
string CONF_STATION_ID = "station_id"
 
string CONF_STATION_NAME = "station_name"
 
string CONF_TRAIN_ID = "train_id"
 
string DEFAULT_NAME = "Train {}"
 
string ICON = "mdi:train"
 
list MONITORED_INFO
 
string NO_INFORMATION_STRING = "No information for this train now"
 
string NOT_DEPARTED_STRING = "Not departed yet"
 
 PLATFORM_SCHEMA
 
int REQUEST_TIMEOUT = 5
 
tuple VIAGGIATRENO_ENDPOINT
 

Detailed Description

Support for the Italian train system using ViaggiaTreno API.

Function Documentation

◆ async_http_request()

def homeassistant.components.viaggiatreno.sensor.async_http_request (   hass,
  uri 
)
Perform actual request.

Definition at line 81 of file sensor.py.

◆ async_setup_platform()

None homeassistant.components.viaggiatreno.sensor.async_setup_platform ( HomeAssistant  hass,
ConfigType  config,
AddEntitiesCallback  async_add_entities,
DiscoveryInfoType | None   discovery_info = None 
)
Set up the ViaggiaTreno platform.

Definition at line 67 of file sensor.py.

Variable Documentation

◆ _LOGGER

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

Definition at line 24 of file sensor.py.

◆ ARRIVED_STRING

string homeassistant.components.viaggiatreno.sensor.ARRIVED_STRING = "Arrived"

Definition at line 53 of file sensor.py.

◆ CANCELLED_STRING

string homeassistant.components.viaggiatreno.sensor.CANCELLED_STRING = "Cancelled"

Definition at line 54 of file sensor.py.

◆ CONF_NAME

string homeassistant.components.viaggiatreno.sensor.CONF_NAME = "train_name"

Definition at line 48 of file sensor.py.

◆ CONF_STATION_ID

string homeassistant.components.viaggiatreno.sensor.CONF_STATION_ID = "station_id"

Definition at line 49 of file sensor.py.

◆ CONF_STATION_NAME

string homeassistant.components.viaggiatreno.sensor.CONF_STATION_NAME = "station_name"

Definition at line 50 of file sensor.py.

◆ CONF_TRAIN_ID

string homeassistant.components.viaggiatreno.sensor.CONF_TRAIN_ID = "train_id"

Definition at line 51 of file sensor.py.

◆ DEFAULT_NAME

string homeassistant.components.viaggiatreno.sensor.DEFAULT_NAME = "Train {}"

Definition at line 46 of file sensor.py.

◆ ICON

string homeassistant.components.viaggiatreno.sensor.ICON = "mdi:train"

Definition at line 33 of file sensor.py.

◆ MONITORED_INFO

list homeassistant.components.viaggiatreno.sensor.MONITORED_INFO
Initial value:
1 = [
2  "categoria",
3  "compOrarioArrivoZeroEffettivo",
4  "compOrarioPartenzaZeroEffettivo",
5  "destinazione",
6  "numeroTreno",
7  "orarioArrivo",
8  "orarioPartenza",
9  "origine",
10  "subTitle",
11 ]

Definition at line 34 of file sensor.py.

◆ NO_INFORMATION_STRING

string homeassistant.components.viaggiatreno.sensor.NO_INFORMATION_STRING = "No information for this train now"

Definition at line 56 of file sensor.py.

◆ NOT_DEPARTED_STRING

string homeassistant.components.viaggiatreno.sensor.NOT_DEPARTED_STRING = "Not departed yet"

Definition at line 55 of file sensor.py.

◆ PLATFORM_SCHEMA

homeassistant.components.viaggiatreno.sensor.PLATFORM_SCHEMA
Initial value:
1 = SENSOR_PLATFORM_SCHEMA.extend(
2  {
3  vol.Required(CONF_TRAIN_ID): cv.string,
4  vol.Required(CONF_STATION_ID): cv.string,
5  vol.Optional(CONF_NAME): cv.string,
6  }
7 )

Definition at line 58 of file sensor.py.

◆ REQUEST_TIMEOUT

int homeassistant.components.viaggiatreno.sensor.REQUEST_TIMEOUT = 5

Definition at line 32 of file sensor.py.

◆ VIAGGIATRENO_ENDPOINT

tuple homeassistant.components.viaggiatreno.sensor.VIAGGIATRENO_ENDPOINT
Initial value:
1 = (
2  "http://www.viaggiatreno.it/infomobilita/"
3  "resteasy/viaggiatreno/andamentoTreno/"
4  "{station_id}/{train_id}/{timestamp}"
5 )

Definition at line 26 of file sensor.py.