Add more types related to BME690

This commit is contained in:
grove5_admin committed 2026-05-01 09:04:52 -07:00
1 parent a5d1ed0560
commit 8ffb2384aa
2 files changed
+17

No files matched your search

+9
View File
@@ -67,6 +67,8 @@ class GasSweepPoint(BaseModel):
resistance_norm: Optional[float] = None # baseline normalized, set by daemon
adc_gas_res: Optional[int] = None # raw 10-bit gas ADC from BME690
gas_range: Optional[int] = None # gas range 0-15 (affects resistance calc)
res_heat: Optional[int] = None # heater resistance register (DAC target)
idac: Optional[int] = None # initial heater DAC drive
heater_stable: bool
valid: bool
@@ -127,6 +129,11 @@ class SweepBaseline(BaseModel):
humidity_ref: Optional[float] = None
temp_ref: Optional[float] = None
co2_ref: Optional[float] = None
# Mean (BME.temp_c - SCD43.temp_c) across the baseline window.
# BME runs hot from hotplate self-heating; this is a stable
# per-enclosure offset, recomputed every baseline refresh. None when
# SCD43 was unavailable during baseline establishment.
bme_temp_offset: Optional[float] = None
# ── Anomaly ───────────────────────────────────────────────────────────────
@@ -166,6 +173,7 @@ class STM32Payload(BaseModel):
co2: Optional[CO2Reading] = None
health: SensorHealth
baseline: SweepBaseline
burn_in: bool = True # !baseline.established — skip fingerprinting
sweep: list[GasSweepPoint]
@model_validator(mode='after')
@@ -207,6 +215,7 @@ class EnvPayload(BaseModel):
sweep: list[GasSweepPoint]
zone_scores: ZoneScores = Field(default_factory=ZoneScores)
baseline: SweepBaseline
burn_in: bool = True # !baseline.established — skip fingerprinting
health: SensorHealth
anomalies: list[EnvAnomaly] = Field(default_factory=list)
+8
View File
@@ -168,6 +168,8 @@ export type GasSweepPoint = {
resistance_norm: number | null; // baseline normalized
adc_gas_res: number | null; // raw 10-bit gas ADC from BME690
gas_range: number | null; // gas range 0-15 (affects resistance calc)
res_heat: number | null; // heater resistance register (DAC target)
idac: number | null; // initial heater DAC drive
heater_stable: boolean;
valid: boolean;
};
@@ -186,6 +188,11 @@ export type SweepBaseline = {
humidity_ref: number;
temp_ref: number;
co2_ref: number | null;
// Mean BME690 temp bias vs SCD43 across the baseline window. BME runs
// hot from hotplate self-heating; this is a stable per-enclosure offset
// recomputed every time the baseline is re-established. null when SCD43
// was unavailable during baseline establishment.
bme_temp_offset: number | null;
};
export type SensorHealth = {
@@ -218,6 +225,7 @@ export type EnvPayload = {
sweep: GasSweepPoint[];
zone_scores: ZoneScores;
baseline: SweepBaseline;
burn_in: boolean; // !baseline.established — skip fingerprinting
health: SensorHealth;
anomalies: EnvAnomaly[];
};