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

Classes

class  CityBikesNetwork
 
class  CityBikesNetworks
 
class  CityBikesRequestError
 
class  CityBikesStation
 

Functions

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

Variables

 _LOGGER = logging.getLogger(__name__)
 
string ATTR_EMPTY_SLOTS = "empty_slots"
 
string ATTR_EXTRA = "extra"
 
string ATTR_FREE_BIKES = "free_bikes"
 
string ATTR_NETWORK = "network"
 
string ATTR_NETWORKS_LIST = "networks"
 
string ATTR_STATIONS_LIST = "stations"
 
string ATTR_TIMESTAMP = "timestamp"
 
string ATTR_UID = "uid"
 
tuple CITYBIKES_ATTRIBUTION
 
string CITYBIKES_NETWORKS = "citybikes_networks"
 
string CONF_NETWORK = "network"
 
string CONF_STATIONS_LIST = "stations"
 
string DEFAULT_ENDPOINT = "https://api.citybik.es/{uri}"
 
string MONITORED_NETWORKS = "monitored-networks"
 
 NETWORK_SCHEMA
 
 NETWORKS_RESPONSE_SCHEMA
 
string NETWORKS_URI = "v2/networks"
 
string PLATFORM = "citybikes"
 
 PLATFORM_SCHEMA
 
int REQUEST_TIMEOUT = 5
 
 SCAN_INTERVAL = timedelta(minutes=5)
 
 STATION_SCHEMA
 
 STATIONS_RESPONSE_SCHEMA
 
string STATIONS_URI = "v2/networks/{uid}?fields=network.stations"
 

Detailed Description

Sensor for the CityBikes data.

Function Documentation

◆ async_citybikes_request()

def homeassistant.components.citybikes.sensor.async_citybikes_request (   hass,
  uri,
  schema 
)
Perform a request to CityBikes API endpoint, and parse the response.

Definition at line 138 of file sensor.py.

◆ async_setup_platform()

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

Definition at line 157 of file sensor.py.

Variable Documentation

◆ _LOGGER

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

Definition at line 41 of file sensor.py.

◆ ATTR_EMPTY_SLOTS

string homeassistant.components.citybikes.sensor.ATTR_EMPTY_SLOTS = "empty_slots"

Definition at line 43 of file sensor.py.

◆ ATTR_EXTRA

string homeassistant.components.citybikes.sensor.ATTR_EXTRA = "extra"

Definition at line 44 of file sensor.py.

◆ ATTR_FREE_BIKES

string homeassistant.components.citybikes.sensor.ATTR_FREE_BIKES = "free_bikes"

Definition at line 45 of file sensor.py.

◆ ATTR_NETWORK

string homeassistant.components.citybikes.sensor.ATTR_NETWORK = "network"

Definition at line 46 of file sensor.py.

◆ ATTR_NETWORKS_LIST

string homeassistant.components.citybikes.sensor.ATTR_NETWORKS_LIST = "networks"

Definition at line 47 of file sensor.py.

◆ ATTR_STATIONS_LIST

string homeassistant.components.citybikes.sensor.ATTR_STATIONS_LIST = "stations"

Definition at line 48 of file sensor.py.

◆ ATTR_TIMESTAMP

string homeassistant.components.citybikes.sensor.ATTR_TIMESTAMP = "timestamp"

Definition at line 49 of file sensor.py.

◆ ATTR_UID

string homeassistant.components.citybikes.sensor.ATTR_UID = "uid"

Definition at line 50 of file sensor.py.

◆ CITYBIKES_ATTRIBUTION

tuple homeassistant.components.citybikes.sensor.CITYBIKES_ATTRIBUTION
Initial value:
1 = (
2  "Information provided by the CityBikes Project (https://citybik.es/#about)"
3 )

Definition at line 68 of file sensor.py.

◆ CITYBIKES_NETWORKS

string homeassistant.components.citybikes.sensor.CITYBIKES_NETWORKS = "citybikes_networks"

Definition at line 72 of file sensor.py.

◆ CONF_NETWORK

string homeassistant.components.citybikes.sensor.CONF_NETWORK = "network"

Definition at line 52 of file sensor.py.

◆ CONF_STATIONS_LIST

string homeassistant.components.citybikes.sensor.CONF_STATIONS_LIST = "stations"

Definition at line 53 of file sensor.py.

◆ DEFAULT_ENDPOINT

string homeassistant.components.citybikes.sensor.DEFAULT_ENDPOINT = "https://api.citybik.es/{uri}"

Definition at line 55 of file sensor.py.

◆ MONITORED_NETWORKS

string homeassistant.components.citybikes.sensor.MONITORED_NETWORKS = "monitored-networks"

Definition at line 58 of file sensor.py.

◆ NETWORK_SCHEMA

homeassistant.components.citybikes.sensor.NETWORK_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(ATTR_ID): cv.string,
4  vol.Required(ATTR_NAME): cv.string,
5  vol.Required(ATTR_LOCATION): vol.Schema(
6  {
7  vol.Required(ATTR_LATITUDE): cv.latitude,
8  vol.Required(ATTR_LONGITUDE): cv.longitude,
9  },
10  extra=vol.REMOVE_EXTRA,
11  ),
12  },
13  extra=vol.REMOVE_EXTRA,
14 )

Definition at line 90 of file sensor.py.

◆ NETWORKS_RESPONSE_SCHEMA

homeassistant.components.citybikes.sensor.NETWORKS_RESPONSE_SCHEMA
Initial value:
1 = vol.Schema(
2  {vol.Required(ATTR_NETWORKS_LIST): [NETWORK_SCHEMA]}
3 )

Definition at line 105 of file sensor.py.

◆ NETWORKS_URI

string homeassistant.components.citybikes.sensor.NETWORKS_URI = "v2/networks"

Definition at line 60 of file sensor.py.

◆ PLATFORM

string homeassistant.components.citybikes.sensor.PLATFORM = "citybikes"

Definition at line 56 of file sensor.py.

◆ PLATFORM_SCHEMA

homeassistant.components.citybikes.sensor.PLATFORM_SCHEMA
Initial value:
1 = vol.All(
2  cv.has_at_least_one_key(CONF_RADIUS, CONF_STATIONS_LIST),
3  SENSOR_PLATFORM_SCHEMA.extend(
4  {
5  vol.Optional(CONF_NAME, default=""): cv.string,
6  vol.Optional(CONF_NETWORK): cv.string,
7  vol.Inclusive(CONF_LATITUDE, "coordinates"): cv.latitude,
8  vol.Inclusive(CONF_LONGITUDE, "coordinates"): cv.longitude,
9  vol.Optional(CONF_RADIUS, "station_filter"): cv.positive_int,
10  vol.Optional(CONF_STATIONS_LIST, "station_filter"): vol.All(
11  cv.ensure_list, vol.Length(min=1), [cv.string]
12  ),
13  }
14  ),
15 )

Definition at line 74 of file sensor.py.

◆ REQUEST_TIMEOUT

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

Definition at line 62 of file sensor.py.

◆ SCAN_INTERVAL

homeassistant.components.citybikes.sensor.SCAN_INTERVAL = timedelta(minutes=5)

Definition at line 64 of file sensor.py.

◆ STATION_SCHEMA

homeassistant.components.citybikes.sensor.STATION_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(ATTR_FREE_BIKES): cv.positive_int,
4  vol.Required(ATTR_EMPTY_SLOTS): vol.Any(cv.positive_int, None),
5  vol.Required(ATTR_LATITUDE): cv.latitude,
6  vol.Required(ATTR_LONGITUDE): cv.longitude,
7  vol.Required(ATTR_ID): cv.string,
8  vol.Required(ATTR_NAME): cv.string,
9  vol.Required(ATTR_TIMESTAMP): cv.string,
10  vol.Optional(ATTR_EXTRA): vol.Schema(
11  {vol.Optional(ATTR_UID): cv.string}, extra=vol.REMOVE_EXTRA
12  ),
13  },
14  extra=vol.REMOVE_EXTRA,
15 )

Definition at line 109 of file sensor.py.

◆ STATIONS_RESPONSE_SCHEMA

homeassistant.components.citybikes.sensor.STATIONS_RESPONSE_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(ATTR_NETWORK): vol.Schema(
4  {vol.Required(ATTR_STATIONS_LIST): [STATION_SCHEMA]}, extra=vol.REMOVE_EXTRA
5  )
6  }
7 )

Definition at line 125 of file sensor.py.

◆ STATIONS_URI

string homeassistant.components.citybikes.sensor.STATIONS_URI = "v2/networks/{uid}?fields=network.stations"

Definition at line 66 of file sensor.py.