Source code for pi_weather.api.models
"""API models definition"""
from pydantic import BaseModel
from pi_weather.utils.logs import get_logger
logger = get_logger(__name__)
[docs]
class LatestSensorReading(BaseModel):
"""Latest sensor reading data"""
sensor_ts: float
event_ts: float
pressure: float
temperature: float
altitude: float
[docs]
class LatestSTCC4SensorReading(BaseModel):
"""Latest sensor reading data (for STCC4)"""
sensor_status: int
temperature: float
humidity: float
co2_concentration: float
event_ts: float
air_quality: int
[docs]
class LatestAggregateReading(BaseModel):
"""Latest aggregate reading data"""
stcc4_event_ts: float
stcc4_sensor_status: int
stcc4_temperature: float
stcc4_humidity: float
stcc4_co2_concentration: float
stcc4_air_quality: int
bmp390_event_ts: float
bmp390_sensor_ts: float
bmp390_pressure: float
bmp390_temperature: float
bmp390_altitude: float