Govee Sensor Offset Calibration Procedure

Status (2026-12-04): nothing has been changed by this writeup. The two existing offsets (GrowTent2 CO₂ monitor, 2026-11-29) are already live in the Prometheus rule layer. The calibration-table machinery and the weekly loop below are a plan awaiting authorization to deploy. This is the runbook to follow once approved.

This is the durable procedure for keeping the 13 Govee sensors feeding the citrus/greenhouse/tent dashboards accurate — both at day zero (pre-deployment baseline) and week over week (drift), for temperature and humidity.

The data path, and where calibration lands

Govee calibration data flow

The chain is: sensor → gateway → Govee cloud → Home Assistant (govee custom component, polls the cloud API every ~5 min) → Prometheus (homeassistant scrape job) → citrus-rules.yml recording rules → Grafana dashboards + unified alerting → ntfy/bark/email.

Raw values arrive as homeassistant_citrus_temperature_c / homeassistant_citrus_humidity_percent / homeassistant_citrus_co2_ppm. Every dashboard and all 15 alert rules read only the recording series (citrus_temperature_c, citrus_humidity_percent, citrus_vpd_kpa, citrus_battery_percent). That makes the recording-rule file the single choke point: one edit there corrects dashboards, VPD math, and alerts together, and Prometheus keeps the offset's history for free.

Why not the other two places

Place Verdict Why
Govee Home app "calibration" keep at zero All three models support it, but the entry is an absolute target value (type 80 °F, and the device infers the delta), and the offset never reaches this stack: HA core issues #108887 and #121621 show HA reports the pre-calibration value, the cloud API returns raw tem/hum with the calibration as separate display metadata, and grep -i calib inside the HA govee component finds zero calibration code. It also desyncs the Govee app from Grafana and stores no audit trail.
Grafana transform at ingest no Transforms are per-panel (six citrus dashboards, every future panel), invisible to Prometheus, and absent for alert rules — an alert would evaluate the uncalibrated value while the graph shows the calibrated one.
Prometheus recording rules yes One edit → every surface + all alerts. Dated edits = permanent drift history. Prometheus is the only place already on the write path that dashboards and alerts share.

The fleet

Model Qty Placements Spec accuracy Power / transport
Govee H5100 5 Greenhouse Floor/Roof, GrowTent1, LivingRoom, UnheatedGarage ±0.54 °F / ±0.3 °C; ±3 %RH CR2016, BLE → H5151 Wi-Fi gateway (max 10)
GoveeLife H5107 (Thermo-Hygrometer 3 Lite) 6 GrowTent2, DeckCitrus, ColdFrame, IchangLemon, WorkoutRoom, Loquat (H5100 fire-yard trio retired 2026-12-04) ±0.3 °C (0–60 °C), ±0.5 °C below 0 °C; ±3 %RH 2×AAA, LoRa 915 MHz → kit gateway (max 30), IP65
GoveeLife H5140 (Air Quality Monitor) 2 GrowTent2-Co2Monitor, MainBedroom-Co2Monitor temp ±0.3 °C; RH ±2–3 %; CO₂ ±(40 ppm + 5 %) USB-C mains, Wi-Fi direct, Sensirion SCD4x NDIR

Official product pages:

Govee H5100 mini thermo-hygrometer GoveeLife H5107 kit: gateway + three probes GoveeLife H5140 air quality monitor

Current state (2026-12-04)

Two offsets exist, both in /var/www/monitoring/prometheus/alerts/citrus-rules.yml since 2026-11-29 (they show up in Grafana because every panel reads the corrected series):

  • GrowTent2-Co2Monitor temperature: −1.0 °C — the mains-powered unit self-heats (+1.0…2.2 °C vs neighbors when tent lights are on, ~0 at night).
  • GrowTent2-Co2Monitor humidity: +3.5 %RH — reads 2.7–3.8 %RH low, consistent with that same self-heating.

These are placement corrections (self-heating), not sensor error. Everything else runs at offset 0. Known blind spot: MainBedroom-Co2Monitor has no co-located sensor, so the weekly consensus below will never see it — only the quarterly anchor round covers it.


Phase A — pre-deployment baseline session (do once, then annually)

Goal: measure each probe's intrinsic error while every sensor is in the same air, and archive those numbers as day zero. Weekly corrections thereafter are expressed relative to this baseline, so intrinsic error and placement effects stay separable.

  1. Label before you dismount. Photograph each device's MAC/serial next to its friendly_name, and log battery %. Mis-identified sensors poison every later round.
  2. Setup: battery sensors (all H5100 + H5107, 11 units) ~10 cm apart inside a sealed plastic bin (~60–80 L; a sealed bin beats a cardboard box because the salt dish needs a closed volume). Add a shallow dish of table salt wetted with a few teaspoons of water — not dissolved slush, just wet salt. In ~12–24 h the headspace holds the sodium-chloride equilibrium: 75.61 %RH at 15 °C / 75.47 at 20 °C / 75.29 at 25 °C (±0.2) — a real absolute humidity reference, free.
  3. Cold-soak warmup: H5107s coming in from the cold frame/deck/garage sit open at room temp 1–2 h first; condensation reads RH high for hours.
  4. H5140s stay out of the shared bin. Two mains-powered monitors in a sealed volume self-heat and would poison the consensus for everyone else. If you want their intrinsic number, soak them separately in a small box (or skip: their useful offset is the placement one, measured in situ — see current state above).
  5. Cross-check, don't crown, the IR gun. Do not pick "the probe closest to the temperature gun" as reference: a ~$30 IR gun (±1–2 °F, ε = 0.95, measures surfaces not air) is a worse reference than the fleet itself — the median of 11 Govee probes has error ≈ spec/√N ≈ ±0.1 °C. Use the gun as an independent sanity check instead: aim it at a mug of water that soaked in the bin (water ε ≈ 0.96). If gun-vs-median disagree by more than ~1 °F, trust the median.
  6. Soak ~24 h. Temperature equilibrates in 2–4 h; run the full day so the salt anchor settles too. The sensors keep reporting through HA the whole time — Prometheus records the session automatically, no manual logging needed.
  7. Derive initial offsets from the last ~6 h of the soak window: per-sensor offset = fleet median − sensor median (temp and RH separately), plus one absolute RH anchor = fleet median − 75.4 (using the bin's air temperature row from the salt table above). Write those rows into the calibration table with basis baseline-bin-YYYYMMDD (see machinery below). These rows are never edited — they are day zero.
  8. Optional second temperature point: soak the five outdoor H5107s in the unheated garage (~4–7 °C) for an hour to probe linearity. Their own spec loosens to ±0.5 °C below 0 °C, so one offset may not serve both seasons; this round shows whether it doesn't.

Phase B — weekly drift check (report-only first)

Co-located battery Govees are interchangeable to ~±0.3 °C, so any group of them is a standing reference for each other. Drift between pair-mates is invisible in a group average (the sum is invariant) but obvious in the difference — which is exactly what to plot.

Consensus groups: GrowTent2 (H5107 + corrected CO₂ monitor) · Greenhouse (Floor+Roof) · indoor comfort (LivingRoom, WorkoutRoom, IchangLemon) · plus any two co-located sensors you add.

Weekly (a cron report, human-gated at first):

  • For each group, compute the 14-day median of pairwise differences: quantile_over_time(0.5, (sum(citrus_temperature_c{friendly_name="H5100_GreenhouseRoof"}) - sum(citrus_temperature_c{friendly_name="H5100_GreenhouseFloor"}))[14d:10m]) — the bare sum() wrappers are required: each sensor's series carries its own entity label, so a naive A - B matches nothing.
  • Deadbands (below spec noise, so we never chase noise): change a temperature offset only if the 14-day median difference exceeds ±0.4 °C; humidity ±4 %RH.
  • Caps: per adjustment ≤ ±0.5 °C and ≤ ±3 %RH; running total sanity cap ±1.5 °C / ±5 %RH (beyond that, suspect the sensor or the placement, not drift).
  • Apply by appending a dated row to the table + git commit + rule reload — never edit an old row. The offset series then is the audit trail: drift-since-day-zero is one query.
  • After ~4 clean months, this can become auto-apply-with-veto (cron posts proposed rows to ntfy; silence = assent) — that promotion is a separate decision.

The weekly loop is blind to fleet-wide drift by construction (if all 11 probes drift together, all differences stay zero). That's what Phase C exists for.

Phase C — quarterly absolute anchor

  • Salt jar, per RH sensor (or fleet, batched): a quart jar with wet table salt + the sensor, sealed, 6+ h at a logged room temp → compare to the salt-table value for that temp. This catches RH drift the consensus can't.
  • Annual repeat of the Phase A bin soak with the same salt anchor. Compare to day-zero rows: the diff is true fleet drift.
  • If a calibrated reference probe is ever bought, it joins the rounds and the salt jar becomes redundant for RH; the median stays the temp reference (the reference probe joins the pool, it doesn't rule it).

Humidity notes

RH is the dominant error term for the alerts that matter: at ~77 °F, ±5 %RH moves VPD by ≈0.35 kPa while ±1 °F moves it only ≈0.11 kPa — the VPD > 2.0 kPa stress alert is ~3× more RH-sensitive than temperature-sensitive. So RH calibration is not an add-on; it is the main event. Caveats: never anchor above ~80 %RH (condensation risk biases readings high), expect the tent RH sensor to drift fastest (membrane fouling in persistent high humidity), and remember the CO₂ monitors' RH error is mostly self-heating — correct it in situ, not in a jar.

The machinery (deploy plan — not yet deployed)

One CSV is the source of truth; everything else is derived:

# config/govee-calibration.csv  (corrected = raw + offset)
friendly_name,entity,quantity,offset,effective_date,basis
GrowTent2-Co2Monitor,growtent2_co2monitor,temp_c,-1.0,2026-11-29,self-heating-mains-unit-vs-h5107-growtent2
GrowTent2-Co2Monitor,growtent2_co2monitor,rh_pct,3.5,2026-11-29,self-heating-mains-unit-vs-h5107-growtent2
H5100_GrowTent1,h5100_growtent1,temp_c,0,2026-12-04,placeholder-every-sensor-has-a-row
  • entity must equal the home sensor id exactly — it is the join key into the raw scraped series.
  • Every sensor always has a row (offset 0 counts) — that removes or-guard gymnastics from the PromQL joins.
  • A small cron (cal2textfile.py) converts the CSV to node-collector textfile metrics: govee_cal_temp_c{entity="sensor.h5100_growtent1_temperature",...} into the already-scraped textfile dir.
  • The recording rules then read, per quantity:
- record: citrus_temperature_c
  expr: |
    label_replace(
      avg by (entity, domain, friendly_name) (homeassistant_citrus_temperature_c{friendly_name=~".+"})
      + on(entity) group_left()
        last_over_time(govee_cal_temp_c[7d]),
      "friendly_name", "$1", "friendly_name", "(.*) Temperature$")
  • Deploy = same drill as every monitoring change: backup citrus-rules.yml, edit, promtool check rules, reload Prometheus, verify a known panel value moved by exactly the delta, git push same turn. Rollback = restore backup.
  • Drift panel: one row per device plotting govee_cal_temp_c - (govee_cal_temp_c offset 90d) — literally "corrections since day zero", plus the raw-vs-calibrated overlay.

Guardrails

  • Keep every Govee app calibration at zero — it changes only what the Govee app draws and lies about what your alerts see.
  • No calibration in Grafana transforms — alerts would evaluate a different number than the graph shows.
  • Never apply a correction from a single event; only 14-day medians, inside the deadband/cap rules.
  • Offsets are additive and signed (offset = what is added to the raw value). Never write corrected absolute values anywhere in the stack.
  • Dated rows only — history is the point. LivingRoom stays exempt from comfort alerts regardless of calibration.

Appendix — useful queries

# raw vs corrected for one device
homeassistant_citrus_temperature_c{entity="sensor.h5100_greenhouseroof_temperature"}
citrus_temperature_c{friendly_name="H5100_GreenhouseRoof"}

# 14-day consensus difference between two co-located sensors
# (sum() wrappers required — see "weekly loop" above)
quantile_over_time(0.5,
  (sum(citrus_temperature_c{friendly_name="H5100_GreenhouseRoof"})
 - sum(citrus_temperature_c{friendly_name="H5100_GreenhouseFloor"}))[14d:10m])

# spread of the whole corrected fleet right now (health of consensus)
stddev(citrus_temperature_c{friendly_name!~".*Co2Monitor.*"})

# its 14-day trend — rising = drift, stable = consensus healthy
stddev_over_time(stddev(citrus_temperature_c{friendly_name!~".*Co2Monitor.*"})[14d:1h])

The toolkit (copy this)

Sensor swaps: Prometheus cannot rename stored series, so a one-time citrus_bridge group in the recording rules re-emits the retired device's live series under the new entity id from swap day forward (with an unless gate so the new sensor takes over silently the moment it reports). See prometheus/citrus-calibration-rules.yml in the repo for the exact bridge used when the yard Loquat became H5107_Loquat.

The whole apparatus lives in one small git repo (scripts/, config/, cron/, prometheus/). Ours is an internal LAN-only remote, so the parts worth copying are inlined here — nothing about them is secret.

config/consensus-groups.csv — which sensors share the same air:

group,friendly_names
growtent2,GrowTent2-Co2Monitor|H5107_GrowTent2
greenhouse,H5100_GreenhouseRoof|H5100_GreenhouseFloor
# yard-trio,ProbeA|ProbeB|ProbeC   # distinct microclimates: consensus needs SAME air
# indoor-comfort,H5100_LivingRoom|H5107_WorkoutRoom|H5107_IchangLemon  # distinct rooms

Those commented groups are a live lesson: the first run of the drift loop "proposed" 0.5–40 unit corrections for yard and cross-room pairs — stable placement facts, not drift. The caps caught them; the fix was the group file. Only same-air sensors belong in a group.

scripts/drift_report.py core — per-pair consensus with deadbands and caps; prints proposals to a side file, never edits the table itself:

def median_diff(metric, a, b, window="14d", step="10m"):
    # bare sum() collapses each side to an empty label set so the two
    # series match 1:1 (they never share entity/friendly_name values).
    q = (f'quantile_over_time(0.5, (sum({metric}{{friendly_name="{a}"}}) - '
         f'sum({metric}{{friendly_name="{b}"}}))[{window}:{step}])')
    return prom_instant(q)
# deadband ±0.4 C / ±4 %RH; per-change cap ±0.5 C / ±3 %RH;
# running-total cap ±1.5 C / ±5 %RH

scripts/cal2textfile.py keeps the newest non-future row per sensor+quantity and writes gauges like govee_cal_temp_c{entity="sensor.h5107_coldframe_temperature",friendly_name="H5107_ColdFrame",effective_date="2026-12-04",basis="..."} -0.4 atomically into the textfile dir. Future-dated rows = staged, not active.

scripts/baseline_session.py takes --start/--end of a bin soak and emits day-zero CSV rows: per-sensor median vs the fleet median (averaging ±0.3 °C spec noise over 11 sensors beats one reference probe), plus a fleet-wide RH shift from the salt reference (75.3 %RH at 25 °C).

cron/govee-calibration.cron:

*/5 * * * * root cd /opt/govee-calibration && python3 scripts/cal2textfile.py
15 7 * * 1 root cd /opt/govee-calibration && python3 scripts/drift_report.py --proposed config/govee-calibration.csv.proposed >> /var/log/govee-drift.log 2>&1