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

Classes

class  AirSensor
 
class  APIData
 

Functions

def parse_api_response (response)
 
def parse_site (entry_sites_data)
 
def parse_species (species_data)
 
None setup_platform (HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
list AUTHORITIES
 
string CONF_LOCATIONS = "locations"
 
 PLATFORM_SCHEMA
 
 SCAN_INTERVAL = timedelta(minutes=30)
 
string URL = "http://api.erg.kcl.ac.uk/AirQuality/Hourly/MonitoringIndex/GroupName=London/Json"
 

Detailed Description

Sensor for checking the status of London air.

Function Documentation

◆ parse_api_response()

def homeassistant.components.london_air.sensor.parse_api_response (   response)
Parse return dict or list of data from API.

Definition at line 219 of file sensor.py.

◆ parse_site()

def homeassistant.components.london_air.sensor.parse_site (   entry_sites_data)
Iterate over all sites at an authority.

Definition at line 181 of file sensor.py.

◆ parse_species()

def homeassistant.components.london_air.sensor.parse_species (   species_data)
Iterate over list of species at each site.

Definition at line 162 of file sensor.py.

◆ setup_platform()

None homeassistant.components.london_air.sensor.setup_platform ( HomeAssistant  hass,
ConfigType  config,
AddEntitiesCallback  add_entities,
DiscoveryInfoType | None   discovery_info = None 
)
Set up the London Air sensor.

Definition at line 70 of file sensor.py.

Variable Documentation

◆ _LOGGER

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

Definition at line 22 of file sensor.py.

◆ AUTHORITIES

list homeassistant.components.london_air.sensor.AUTHORITIES
Initial value:
1 = [
2  "Barking and Dagenham",
3  "Bexley",
4  "Brent",
5  "Bromley",
6  "Camden",
7  "City of London",
8  "Croydon",
9  "Ealing",
10  "Enfield",
11  "Greenwich",
12  "Hackney",
13  "Haringey",
14  "Harrow",
15  "Havering",
16  "Hillingdon",
17  "Islington",
18  "Kensington and Chelsea",
19  "Kingston",
20  "Lambeth",
21  "Lewisham",
22  "Merton",
23  "Redbridge",
24  "Richmond",
25  "Southwark",
26  "Sutton",
27  "Tower Hamlets",
28  "Wandsworth",
29  "Westminster",
30 ]

Definition at line 28 of file sensor.py.

◆ CONF_LOCATIONS

string homeassistant.components.london_air.sensor.CONF_LOCATIONS = "locations"

Definition at line 24 of file sensor.py.

◆ PLATFORM_SCHEMA

homeassistant.components.london_air.sensor.PLATFORM_SCHEMA
Initial value:
1 = SENSOR_PLATFORM_SCHEMA.extend(
2  {
3  vol.Optional(CONF_LOCATIONS, default=AUTHORITIES): vol.All(
4  cv.ensure_list, [vol.In(AUTHORITIES)]
5  )
6  }
7 )

Definition at line 61 of file sensor.py.

◆ SCAN_INTERVAL

homeassistant.components.london_air.sensor.SCAN_INTERVAL = timedelta(minutes=30)

Definition at line 26 of file sensor.py.

◆ URL

string homeassistant.components.london_air.sensor.URL = "http://api.erg.kcl.ac.uk/AirQuality/Hourly/MonitoringIndex/GroupName=London/Json"

Definition at line 59 of file sensor.py.