# V21.0 — Connected virtual-device engineering laboratory

This release uses the validated V20.7.6 archive as its baseline. It preserves the 118 experiment entries, five courses, original studio destinations, simulation engines, reference toolkits, navy theme, source blocks and offline notebook library. It upgrades 18 notebook entries (including new P44) and retains the other 65. The 83 clean notebooks have independently executed in fresh local kernels using their default profiles; input SHA-256 digests accompany the execution report.

## Two explicitly distinct execution paths

- **Local/default:** virtual GPIO state + generated greenhouse samples; actual MQTT 3.1.1 TCP packets with a deliberately restricted exact-topic QoS 1 loopback peer; independent publisher and subscriber; actual SQLite inserts and readback; malformed payload rejection and sequence deduplication. The loopback peer is not Mosquitto/HiveMQ, does not implement production security, retransmission, retained messages, wildcard subscriptions or broker persistence. The notebook is an executable software experiment, not a physical electrical measurement.
- **HiveMQ:** in X12, X13 and the upgraded GPIO notebooks change `MODE` to `hivemq`. The Python client uses verified TLS to `broker.hivemq.com:8883`. It uses a unique random exact topic and synthetic data only, with separate publisher and subscriber. Public topics are not private or authenticated device identities. This mode is not locally verified, and connection failures raise errors rather than falling back.
- **Stack:** in P42/P43/P44 set `MODE = "stack"`; on a disposable Linux Colab runtime set `DOWNLOAD_SERVICES = True` if the binaries are missing. Vendor packages are downloaded from official signed APT indexes (signing fingerprints verified against vendor documentation), extracted into temporary directories, and version numbers printed. No system services are enabled. InfluxDB OSS 2 is chosen for the existing Flux curriculum; P42 writes directly to its HTTP API. P43 uses HiveMQ TLS and actual Telegraf to write to InfluxDB; P44 also starts Grafana, creates its real datasource and four-panel dashboard, reads the dashboard back and executes a genuine Grafana datasource query. All four fields are queried from InfluxDB and compared against transmitted values; Grafana's temperature query is compared too. Service health, count and value mismatches raise exceptions. No fake service pass. APT availability, installed binary dependencies, network policy, signing-key rotations and provider availability may affect execution. If the install fails, report blocked rather than changing a failure into a pass. For WSL/local runtime, install the official packages using vendor instructions and set `DOWNLOAD_SERVICES=False`. 

The full vendor path could not be executed in this build environment: DNS/package downloads and external broker access are unavailable, and InfluxDB, Telegraf and Grafana are not installed. The setup code, configuration syntax, query construction and parser were checked; actual vendor acceptance requires a student or instructor runtime. Hosted Colab is designed around notebook interaction, so this release uses Grafana's loopback HTTP API and inline plots, not a public tunnel or an externally hosted UI. For the interactive full Grafana UI use the original WSL P44 lab (or a local Jupyter runtime). Temporary services are stopped in `finally`/context managers; do not expose their ports publicly. No permanent API credentials are included.

## How to run
1. Open the portal → relevant lab → Experiment → download notebook.
2. Upload to https://colab.research.google.com/ or open Jupyter locally. Run all with default profile for the reproducible local baseline.
3. P42/P43/P44: optionally change MODE and DOWNLOAD_SERVICES as above, run all, and wait for actual health checks and query assertions. Review any errors; never disable TLS checking or APT signatures. For MQTT-only choose `hivemq` in the appropriate configuration cell. 
4. P44 outputs `psut-stack-evidence.json` and `psut-grafana-dashboard.json`; use the portal's imported-evidence viewer in P42/P43/P44 and the dashboard studio. The exported Grafana JSON is a real dashboard definition; its existence alone is not proof Grafana ran. Import the JSON into your own Grafana after provisioning the matching Flux datasource UID `psut-influx` with the correct bucket/org/token. The saved query filters by the original run; use a matching dataset or adjust the run tag and time range for later inspection. Inline plots render query results, not Grafana screenshots.
5. For serial labs P35/P36, the POSIX pseudo-terminal exchanges real bytes, not physical USB signals. P40 tests actual TCP stream framing and control responses. P34/X9/X10 test a local HTTP endpoint and offer optional actual ThingSpeak HTTPS writes and readback with your own channel keys (no keys in the notebook). Local endpoint is not the cloud service.
6. Preserve local and service acceptance evidence separately. Imported JSON consistency checks do not authenticate the claimed source or certify that hardware or cloud services actually ran.

## Independent validation
```
python3 verification/runner.py --profile connected-iot-notebooks --output connected-notebooks.json
python3 verification/runner.py --profile consolidated --output consolidated.json
python3 preflight2100.py
```

The new suite uses independent MQTT literal packet checks, repeated real loopback TCP/SQL cases, GPIO/PTY/HTTP/TCP framing tests, configuration and schema checks, and notebook hashes. All notebook code cells are clean in student downloads; executed notebooks are available separately. Original source highlighting is preserved; new code cells use native Jupyter/Colab syntax highlighting.

## References
- https://research.google.com/colaboratory/faq.html
- https://gpiozero.readthedocs.io/en/stable/api_pins.html
- https://hivemq.mqtt-dashboard.com/
- https://docs.influxdata.com/influxdb/v2/install/
- https://docs.influxdata.com/influxdb/v2/api/quick-start/
- https://docs.influxdata.com/telegraf/v1/install/
- https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian/
- https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/api-legacy/data_source/
