Skip to content

Try Pomona without hardware: the fake greenhouse

A five minute walkthrough. The fake greenhouse (examples/simulators/fake_greenhouse.py) publishes realistic readings for two zones, lets you break sensors and cause real problems with buttons, and keeps a hidden answer key. A scorer then lays Pomona's cards next to that key. Full reference: examples/simulators/README.md.

Two kinds of trouble are kept strictly apart:

  • Sensor faults: the reading is wrong, the plant is fine (stuck, drift, jump, spike, noisy, dropout, dead clock, plausible offset). A good system says "cannot confirm this sensor".
  • Real events: the plant really is in trouble and the readings are correct (heat spike, cold night, humid night, nutrient over-concentration, dry zone). A good system raises the matching card.

With Docker

make up                  # full stack: Core, model-router, automation-engine, dashboard, MQTT
make fake-greenhouse     # second terminal: demo scenario to MQTT, control page at http://127.0.0.1:8090/
  1. Open the control page (http://127.0.0.1:8090/) and the dashboard (see GETTING_STARTED.md for its address).
  2. Press buttons on the control page, or Hidden random to start something without seeing what it is. The page shows only what Pomona receives; the answer key stays hidden until the run is over.
  3. Alerts need time: a card is raised only after its label has lasted 10 minutes (30 for humidity). Give each experiment 15 to 30 minutes.
  4. When done, stop the simulator (Ctrl+C) and grade the run against a running automation-engine:
python3 scripts/score_fake_greenhouse.py --truth data/fake_greenhouse/truth.jsonl \
  --automation-url http://127.0.0.1:8085 --core-url http://127.0.0.1:8080 \
  --report data/fake_greenhouse/report.md --json data/fake_greenhouse/score.json

Without Docker

make fake-greenhouse-score                          # about 30 minutes: quick scenario at 30 s per tick
SCENARIO=examples/simulators/scenarios/demo.json make fake-greenhouse-score   # about 3.5 hours
CONTROL_PORT=8090 make fake-greenhouse-score        # also serve the control page while it runs

This starts Core (with its outcome feed), the model-router and the automation-engine from the service venvs, posts readings to Core over REST (no MQTT broker needed), then scores the run twice: against the running stack and offline (an in-process replay of the same readings through the real pipeline and alert monitor). Outputs land in data/fake_greenhouse/ (gitignored): truth.jsonl (the answer key), report_stack.md, report_offline.md and the matching score_*.json.

The offline scorer and the browser game run the alert monitor in-process with the gap rule off and the 60 s future-clock rule, while the Docker services default to ALERT_MAX_GAP_SECONDS=1800 and MAX_FUTURE_SAMPLE_S=300. With the simulator's regular ticks neither changes a result.

Blind spots: a real fault and a silent probe

The worst failure for an advisory system is a calm screen while something is really wrong, because the one probe that would show it has dropped out. scenarios/blind_spot.json runs real events (dry zone, heat spike, nutrient over-concentration, humid night) and, 3 minutes after each starts, silences the probe that decides it (probe_dropout: the field is missing from every packet). There is also a control where an optional probe goes silent but another probe still shows the fault.

python3 examples/simulators/fake_greenhouse.py --dry-run --out /tmp/e.jsonl --truth-log /tmp/t.jsonl \
  --scenario examples/simulators/scenarios/blind_spot.json
services/model-router/.venv/bin/python scripts/score_fake_greenhouse.py --truth /tmp/t.jsonl --offline \
  --report /tmp/r.md --fail-on-miss

The scorer adds a Blind spots table (only when the truth log has a probe_dropout). A case is a silent probe while a real event runs and the true state has crossed a label that probe decides. Its verdict, from what Pomona actually emits:

Verdict Meaning
FALSE REASSURANCE While the probe was silent and the fault ran: no card for the event, no sensor card, (offline) no reading of that field flagged (vetoed or a missing-data label) and no silent-device flag. The zone looked fine. Counted apart from caught and missed; --fail-on-miss fails on it
can't confirm (pass) At least one of: a sensor card (sensor_check, sensor_flatline) raised or open; (offline) a reading flagged for that field; the device marked silent, meaning no Core-accepted reading for longer than Core's device_timeout_seconds (120 s), which the dashboard shows under Device health. The row says which (Via), and "passive flag only" when the device flag was the only sign
alerted (pass) The event's own card was open or raised while the probe was silent, from other evidence
too short to judge / no fault in window / no real event Not judged

Real episodes that a silent probe kept from ever raising are listed here and not counted as missed. Core stores a packet that is missing a probe (the field is absent or null; only a packet with no reading at all is refused), the router flags the missing reading from the first packet, and the sensor_check alert is raised after 3 of them in a row (about 60 s at 30 s ticks). So in blind_spot.json each probe-dropout case ends in "can't confirm" through the sensor_check card, or "alerted" by the event's own rule where another probe still carries the event; the passive device-silent flag stays a reported category for a node whose packets stop arriving altogether.

Zones with several devices

A real zone often has more than one node: a climate box for air and humidity, a node in the substrate for pH, EC and moisture, sometimes two probes for the same field. A scenario can build that with a top-level devices key. It gives a zone a list of devices, each with its own probes:

"devices": {"greenhouse-a": [
  {"device_id": "climate-1", "sensors": ["air_temperature_c", "humidity_pct"]},
  {"device_id": "substrate-1", "sensors": ["ec_ms_cm", "ph", "soil_moisture_pct", "substrate_temperature_c"]}]}

A zone that is not listed (and every zone in a scenario without the key) keeps one device, as before: nothing that ran before changes. Each device sends its own packets with its own device_id and sequence. A fault is started on one device ("device": "climate-1" in a step, or the device selector on the control page), so only that device's packets go wrong. A real event (heat spike, dry zone) is the zone's truth and every device sees it. The truth log has one row per device per tick, and the scorer joins everything by zone and device. Two extra keys, offsets and wander, make a second probe of the same field sit a little differently from the first, as real probes do. The full list of keys is in the simulator README.

Two scenarios use it:

  • scenarios/multi_device.json: demo.json with zone A split into climate-1 (air, humidity) and substrate-1 (pH, EC, moisture, substrate temperature). The steps are the demo's, so the verdicts should match the demo's: the same episodes with the same outcomes, zero false alarms.
  • scenarios/slow_drift.json: zone A has two climate devices and two moisture probes (substrate-2 sends the alias name substrate_moisture_pct). It has four slow drifts down, a stuck humidity probe, a humid night and a dropout of climate-2. The first 240 ticks (2 hours) are clean.
SCENARIO=examples/simulators/scenarios/multi_device.json make fake-greenhouse     # against the Docker stack
SCENARIO=examples/simulators/scenarios/slow_drift.json make fake-greenhouse-score # no Docker, about 8.3 hours
python3 examples/simulators/fake_greenhouse.py --dry-run --out /tmp/e.jsonl --truth-log /tmp/t.jsonl \
  --scenario examples/simulators/scenarios/slow_drift.json                        # no MQTT, no sleeping
services/model-router/.venv/bin/python scripts/score_fake_greenhouse.py --truth /tmp/t.jsonl --offline \
  --report /tmp/r.md

Scenarios that have a devices key need this simulator version or newer. An older one ignores the key and puts every step on the zone's single device. If your local stack already holds a one-device run, the old fake-substrate-01 packets of zone A stay in Core's 7-day window, so zone A shows a third, quiet device. Use a fresh database for a clean picture.

In the report, a fault or false alarm in a multi-device zone reads zone · device in the Zone column (for example greenhouse-a · climate-1), and a real event's "Pomona raised" names the device that raised its card. A card on any device of the zone counts for a real event. A sensor card counts only on the device that was faulted. Zones with one device look as before.

What slow_drift.json gives (offline, seed 23, 1000 ticks), now that Core and the in-process engine compare each probe with the other probes of its zone (the slow-drift pair check, see SENSOR_QUALITY_REASONER.md). Before it, all four drifts were noticed only when they ended (+2460 s). Minutes count from the drift's start tick:

Drift Result
air on climate-1 (-0.1 C/min) caught on the drifting probe, climate-1, after 32.0 minutes
air on zone B's only probe MISSED: there is no second probe, so it is noticed only when it ends (the single-probe limit)
humidity on climate-2 (-0.5 %RH/min) caught on the drifting probe, climate-2, after 21.5 minutes
moisture on substrate-2 (substrate_moisture_pct, -0.5 %/min) caught on the partner probe (substrate-1 took the card): scored caught_on_partner, after 17.5 minutes

Which probe takes the card in a two-probe zone is close to a coin flip, so both outcomes pass. The stuck humidity probe on climate-1 is still caught after about 90 s, the humid night still raises high_humidity_fan after about 30 minutes, and there are 0 false alarms and 0 wrong cards. The game itself is unchanged: it has one probe per zone, so its Drift trick is still scored as missed until a second probe is added to a zone.

In a 46-minute real-time run against the stack before the pair check (the scenario's first 92 ticks), a stuck humidity probe started on climate-1 from the control page was caught after about 90 s, in stack mode and offline, with 0 false alarms; the dashboard showed the also climate-2 pair lines, one trend per device and the alert with its device and check text.

With the pair check, an 8-hour real-time stack run of slow_drift.json gave the same verdicts as the offline table above, with 0 false alarms and 0 wrong cards. In a stack run of the humidity drift on climate-2, the dashboard's humidity tile showed both values with "probes disagree: check both with a meter". The trust line said it could not confirm humidity, and the alert row named the device with the pair-check text.

Reading the report

report_*.md has one row per episode: where, when, what really happened, the expected answer, and what Pomona raised, with a verdict.

Verdict Meaning
caught A real event raised its card (delay shown), or a sensor fault raised a sensor check while it was still going on
caught as can't-confirm (safe) A real event whose domain card never came, but the sensor check raised while that probe was flagged: Pomona said "check the probe" instead of acting on a doubtful reading
MISSED A real event that lasted longer than the rule's window raised nothing
MISSED (noticed only when it ended) A sensor fault whose check-the-sensor card was raised only after the fault stopped, when the reading snapped back to the true value (a slow drift of pH, EC or air temperature). The card's label began on the first honest reading, so the lie itself was not seen. Counted as a miss in the sensor-fault totals (the summary says how many of the misses were of this kind); a card whose label began during the fault but was raised a reading or two after it ended still counts as caught
caught on the partner probe Multi-device zones only. A sensor fault on one device raised no card on that device while it ran, but a sensor card was raised on a partner (another device of the zone that has a probe for the same field) inside the fault's window, from a label that began no later than the fault's last reading. A card already open on the partner does not count. Offline, the card must be about the fault's field (a partner reading was vetoed on it or flagged missing); in stack mode that check is skipped and any sensor card on a partner counts. The card asks to check both probes. Counted apart from caught and missed; --fail-on-miss does not fail on it
too short to raise The episode was shorter than the rule's raise_after; no card was possible
no card rule The label has no rule in rules.yaml, so Pomona has no card for it (every label the simulator can produce has one today)
WRONG CARD A sensor fault on one field produced a domain card built on it
undetectable plausible_offset: an in-range constant offset nobody can see from one reading
rejected by Core A dead-clock reading refused at ingest, as intended
FALSE ALARM A card raised in normal operation, outside every episode's clear window
silent probe A real episode that a silent probe (probe_dropout) kept from raising; graded in the Blind spots table, not as missed

The stack and offline reports should agree on which rules raised. The offline report adds reading-level counts (normal frames with a card or a sensor check, trusted-wrong-card frames).

Honest limits

  • Time-lapse is not meaningful. Pomona's drift checks count samples and its alert windows use sample time; a sped-up run (--sim-speed above 1) makes both unrealistic. Run in real time. A busy machine also stretches real-time ticks, so wall-clock delays in a stack report can be longer than offline while the sample counts agree.
  • A slow drift of the only probe of a field is still missed. The pair check needs a second device in the zone with the same field, and judges a probe only when it reports at least every 5 minutes. Zone B's air probe in slow_drift.json and every probe of the game have no partner, so their drifts are noticed only when they end. A drift of substrate temperature is not covered even with a partner. With two probes the card may land on the good one; it asks to check both.
  • The pair check adds partner flags to the reading-level counts. In slow_drift.json, normal frames with a sensor check outside a fault's tail went from 11 to 105. The 94 new ones are all on the partner of a device that is faulted at that moment (88) or in its recovery tail (6), none with nothing faulted in the zone, and none raised a card. In a two-probe zone the flag locks onto one probe. A flagged reading is vetoed and stops serving as a partner, so the other probe has no usable partner and is not judged; it stays unvetoed and keeps serving as the partner, so the flagged probe stays flagged. The lock can switch once from the drifter to the good probe: when one drifter reading lands just under the limit, the good probe is judged against it and flagged, and from then on it holds the flag. Both mean "the probes disagree", which is true; the card on the drifter, already raised, stays. The scorer counts them as normal frames because its tail rule is per faulted device.
  • The first packet of a multi-device zone is judged alone. It is checked before the zone's other devices have reported, so a sensor check on that one reading can appear in the reading-level counts. It is a flag on one reading only; no card came from it in the runs above.
  • Demos take time. A card needs its label to persist for 10 minutes (30 for humidity) and a fault needs 11 samples to leave Pomona's history, so a meaningful run is 30 minutes or more.
  • What the scorer shows on the current rules: heat_stress raises the heat_stress_check card (check vents, fans and shading) after 10 minutes, and cold_stress (cold_night, air or substrate at or below 16 C) raises cold_stress_check (check heating and insulation) after 10 minutes; a slow drift of pH (0.02 per minute) is flagged after about 18 minutes (0.01 per minute after about 36, but 0.005 per minute over two hours stays unseen); a slow EC drift (0.05 mS/cm per minute) is flagged after about 10 minutes when it lasts 40 minutes, but a gentle or short one may be noticed only when it ends; a slow drift of air temperature, humidity or substrate moisture is seen while it lasts when the zone has a second probe for the field (the pair check), and otherwise only when it ends and the reading snaps back (scored as missed, "noticed only when it ended", the game's case); a drift of substrate temperature is not seen while it lasts; a fast EC drift (0.3 mS/cm per minute) is flagged within about 2 minutes; a stuck pH or EC probe is caught after about 6 minutes of freeze (shorter than 8 to 10 minutes it may not be); a +4 C air-temperature jump, a +15 %RH humidity jump, a +15 % substrate-moisture jump and a +4 C substrate-temperature jump are each flagged within a minute (and then accepted as the new level after 4, 4, 8 and 13 minutes); a noisy humidity, air, pH, substrate-moisture or substrate-temperature probe is caught within about 4 to 6 minutes, and so is a noisy EC probe at this 30-second rate, in about 6 to 8 minutes (not on a stream slower than 90 seconds); a single-sample spike is flagged but too short to raise a card; plausible_offset started mid-stream is flagged for as long as it lasts (from the start of a stream nobody can see it).
  • Pomona now keeps a trusted reference per probe, so a real step (a nutrient overdose) shows first as "can't confirm, check the probe" (a safe catch, scored as such) and the domain card follows only after a calibration confirms the level (make fake-greenhouse has a Calibrate button, and calibrate steps in scenarios). Until then the probe stays flagged: that is by design, and a risk if nobody confirms.
  • The sensor_check card is raised after 3 flagged readings in a row, so a chance run of identical readings (the stuck check) can raise a card. Soil moisture (0.1 % steps, noise of several steps) did this once in 23 normal runs of 6 simulated hours at 30 s (seed 4; seed 66 in the next 57): five equal readings in a row. A moisture freeze must now also span 2 minutes, so at 30 s the card needs seven equal readings, and seeds 1 to 80 give no false card. A frozen moisture probe gets its card 1 minute later at 30 s sampling (after 3.5 minutes of repeats instead of 2.5); nothing changes at 1-minute or slower sampling. The softer flatline hint has its own rule and waits 10 minutes.
  • Closing those gaps was bounded by real logs, not by the game: a stuck pH/EC probe is judged only if the stream normally changes in at least 70 % of its readings (real drain probes sit still for hours and are never judged), a freeze shorter than about 8 to 10 minutes, or a second freeze of the same probe soon after the first that lasts less than about 21 minutes, is not caught; a jump of humidity (below 12 %RH), moisture (below 8 %) or substrate temperature (below 1.5 C) is not caught because real probes make such changes; a slow drift of air temperature, humidity, moisture or substrate temperature, a noisy EC probe on a stream slower than 90 seconds and a frozen substrate-temperature probe (thermal mass) are still missed; a step is flagged only as long as it is physically impossible and then accepted as the new level; and the noise limits at 30 seconds for air temperature, humidity and pH are scaled from real 5-minute logs rather than measured: they were checked on one real fast log (3 months of 10-second data from one closed growth chamber, no false flags), and a greenhouse with vents and doors may behave differently. The fixed EC noise limit (0.20 mS/cm, streams at 90 seconds or faster) rests on tank EC only; there is no public fast drain EC. Details and real-data rates: SENSOR_TEMPORAL_CHECKS.md.
  • A flagged level that nobody confirms stays "can't confirm" until a calibration (a probe broken for six hours stays flagged for the six hours, and its card stays open). That is by design; a lapse is an opt-in Core setting (TRUST_BASELINE_MAX_AGE_S). On real historical logs, which have no operator to calibrate, this keeps drain probes flagged for long stretches; see SENSOR_TEMPORAL_CHECKS.md.
  • The fake model is simple physics, not a validated crop model; the dry zone dries in minutes.
  • The control page has no authentication. Keep it on 127.0.0.1.