Environmental Sensors¶
Environmental Sensors API client and functional wrappers for pykada.
The SensorsClient provides access to sensor alert history and
time-series sensor readings (temperature, humidity, air quality, etc.)
through Verkada’s Sensor API.
Client¶
- class pykada.sensors.SensorsClient(api_key=None, token_manager=None)[source]¶
Bases:
BaseClientClient for interacting with Verkada’s Environmental Sensors API. This client provides methods to retrieve sensor alerts and sensor data.
Initialize the client with either an API key or a token manager. If not key is provided, a default token manager will be used based on the environment configuration (VERKADA_API_KEY in a .env file).
- Parameters:
api_key (
Optional[str]) – Optional API key for authentication.token_manager (
Optional[VerkadaTokenManager]) – Optional token manager for handling tokens.
- get_all_sensor_alerts(device_ids, start_time=None, end_time=None, fields=None)[source]¶
Returns all alerts for a set of sensors in an organization over a specified time range.
- Parameters:
- Return type:
- Returns:
A dictionary representing the JSON response containing sensor alerts.
- Raises:
ValueError – If device_ids is an empty list.
- get_sensor_alerts(device_ids, start_time=None, end_time=None, page_size=None, page_token=None, fields=None)[source]¶
Returns all alerts for a set of sensors in an organization over a specified time range.
- Parameters:
- Return type:
- Returns:
A dictionary representing the JSON response containing sensor alerts.
- Raises:
ValueError – If device_ids is an empty list.
- get_all_sensor_data(device_id, start_time=None, end_time=None, fields=None, interval=None)[source]¶
Returns sensor readings for a particular sensor over a specified time range.
- Parameters:
device_id (
str) – The unique identifier of the sensor.start_time (
Optional[int]) – Start time for sensor data (Unix timestamp in seconds).end_time (
Optional[int]) – End time for sensor data (Unix timestamp in seconds).fields (
Optional[List[str]]) – List of sensor fields to include in the response.interval (
Optional[str]) – The time interval for the requested sensor data. Data is stored at 1-second intervals for 30 days and at 5-minute intervals for data between 30 and 365 days old. Specify a number followed by a unit (s,m, orh), e.g."5m"for 5-minute intervals. If omitted, a default resolution is calculated from the time range.
- Return type:
- Returns:
A dictionary representing the JSON response containing sensor data.
- get_sensor_data(device_id, start_time=None, end_time=None, page_size=None, page_token=None, fields=None, interval=None)[source]¶
Returns sensor readings for a particular sensor over a specified time range.
- Parameters:
device_id (
str) – The unique identifier of the sensor.start_time (
Optional[int]) – Start time for sensor data (Unix timestamp in seconds).end_time (
Optional[int]) – End time for sensor data (Unix timestamp in seconds).fields (
Optional[List[str]]) – List of sensor fields to include in the response.interval (
Optional[str]) – The time interval for the requested sensor data. Data is stored at 1-second intervals for 30 days and at 5-minute intervals for data between 30 and 365 days old. Specify a number followed by a unit (s,m, orh), e.g."5m"for 5-minute intervals. If omitted, a default resolution is calculated from the time range.
- Return type:
- Returns:
A dictionary representing the JSON response containing sensor data.
- property request_manager: VerkadaRequestManager¶
Returns the request manager used by this client.
Functional wrappers¶
Environmental Sensors API client and functional wrappers for pykada.
The SensorsClient provides access to sensor alert history and
time-series sensor readings (temperature, humidity, air quality, etc.)
through Verkada’s Sensor API.
- pykada.sensors.check_sensor_fields(fields)[source]
Check if the provided sensor fields are valid. :type fields: :param fields: List of sensor fields to check.
- pykada.sensors.get_all_sensor_alerts(device_ids, start_time=None, end_time=None, fields=None)[source]
Returns all alerts for a set of sensors in an organization over a specified time range.
- Parameters:
- Returns:
A dictionary representing the JSON response containing sensor alerts.
- Raises:
ValueError – If device_ids is an empty list.
—
Note: This is a functional wrapper for its equivalent method in the SensorsClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a SensorsClient object directly for better performance.
- pykada.sensors.get_all_sensor_data(device_id, start_time=None, end_time=None, fields=None, interval=None)[source]
Returns sensor readings for a particular sensor over a specified time range.
- Parameters:
device_id (
str) – The unique identifier of the sensor.start_time (
Optional[int]) – Start time for sensor data (Unix timestamp in seconds).end_time (
Optional[int]) – End time for sensor data (Unix timestamp in seconds).fields (
Optional[List[str]]) – List of sensor fields to include in the response.interval (
Optional[str]) – The time interval for the requested sensor data. Data is stored at 1-second intervals for 30 days and at 5-minute intervals for data between 30 and 365 days old. Specify a number followed by a unit (s,m, orh), e.g."5m"for 5-minute intervals. If omitted, a default resolution is calculated from the time range.
- Returns:
A dictionary representing the JSON response containing sensor data.
—
Note: This is a functional wrapper for its equivalent method in the SensorsClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a SensorsClient object directly for better performance.
- pykada.sensors.get_sensor_alerts(device_ids, start_time=None, end_time=None, page_size=None, page_token=None, fields=None)[source]
Returns all alerts for a set of sensors in an organization over a specified time range.
- Parameters:
- Returns:
A dictionary representing the JSON response containing sensor alerts.
- Raises:
ValueError – If device_ids is an empty list.
—
Note: This is a functional wrapper for its equivalent method in the SensorsClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a SensorsClient object directly for better performance.
- pykada.sensors.get_sensor_data(device_id, start_time=None, end_time=None, page_size=None, page_token=None, fields=None, interval=None)[source]
Returns sensor readings for a particular sensor over a specified time range.
- Parameters:
device_id (
str) – The unique identifier of the sensor.start_time (
Optional[int]) – Start time for sensor data (Unix timestamp in seconds).end_time (
Optional[int]) – End time for sensor data (Unix timestamp in seconds).fields (
Optional[List[str]]) – List of sensor fields to include in the response.interval (
Optional[str]) – The time interval for the requested sensor data. Data is stored at 1-second intervals for 30 days and at 5-minute intervals for data between 30 and 365 days old. Specify a number followed by a unit (s,m, orh), e.g."5m"for 5-minute intervals. If omitted, a default resolution is calculated from the time range.
- Returns:
A dictionary representing the JSON response containing sensor data.
—
Note: This is a functional wrapper for its equivalent method in the SensorsClient. It creates a new client instance on every call, making it best for single, convenient operations. For making multiple API calls, instantiate and use a SensorsClient object directly for better performance.