Deutsche Version · Project overview · VPS demo parity · VPS operations · Test lab: Mac edge + VPS
How sensor, app, and health data move through DeinHaus 4.0 — from a household Raspberry Pi to TH Deggendorf servers and research tooling.
Canonical stack: dh40-software-and-hardware-architecture-master/wohnung/docker/ (edge) and …/thd/ (central).
DH40 uses four parallel data paths (two at the household edge, one cloud-only health import, one Jetson research):
| Path | Store | Purpose | Consumers |
|---|---|---|---|
| Local time series | InfluxDB 1.8 (sensors) |
Live charts, recent history on the tablet | dh40-app Wohndaten, optional Chronograf |
| Central study pipeline | HiveMQ → MariaDB | Long-term study storage, exports, ML | THD research, dh40-spark, Streamlit, etc. |
| Withings health | Withings cloud → MariaDB (dh40_withings / database_science) |
Weight, sleep, activity from study devices | THD research, Streamlit — not local Influx charts |
| Camera / emergency ML | Local logs on Jetson (research only) | Fall / presence / audio emergency prototypes | Lab notebooks, thesis — not production Pi stack |
The tablet and lab UIs read local sensor data (MQTT + Influx). Anonymised Z-Wave and button data replicate to THD over VPN + MQTT bridge. Withings bypasses the Pi data plane — see §3. Cameras are a separate research track on Jetson — see §4.
zwavejs2mqtt (door, motion, climate, power, smoke, …)Topics follow the zwavejs2mqtt/<gateway>/<node>/… pattern. Examples:
| Topic pattern | Example measured | Used by |
|---|---|---|
…/Air_temperature |
Room temperature | Wohndaten chart, lab |
…/Humidity |
Relative humidity | Wohndaten, lab |
…/+/Door_state |
Door/window contact | Wohndaten table, lab |
…/+/Motion_sensor_status |
PIR motion | Wohndaten heatmap, lab |
…/Power |
Smart plug watts | Wohndaten chart |
…/Volatile_Organic_Compound_level |
VOC | Wohndaten chart |
…/level, …/isLow |
Battery level | Wohndaten table |
Full bridge topic list: wohnung/docker/mosquitto2mosquitto/config/mosquitto.conf.
Telegraf mqtt_consumer expects JSON (see influxdb/telegraf/mytelegraf.conf):
{
"time": 1719000000000,
"value": "22.5",
"nodeName": "Raumklimasensor",
"nodeLocation": "Wohnzimmer"
}
topic_parsing adds tags: sensor_id, measured, measured_detail.
MQTT (1883) → Telegraf → InfluxDB measurement mqtt_consumer
sensors, retention policy autogensensors/autogenSame MQTT stream is bridged to THD HiveMQ (TLS, client certificates, topic prefix data/<home_id>/). Connectors write to MariaDB database dh40 (raw).
| Request | Production | Content |
|---|---|---|
GET …/homeid.txt |
https://<pi>:8080/homeid.txt |
Study home ID (e.g. 01V56TVL) or DEMODEMO |
GET …/config.json |
https://<pi>:8080/config.json |
Withings OAuth tokens (per household; legacy — see §3) |
Served by config-provider (nginx). App maps home ID → study group → training video week.
When the resident taps UI buttons, dh40-app publishes via MQTT over WebSocket:
| Topic | Payload |
|---|---|
app/button_press |
{ buttonId, timestamp } per tap |
app/full_button_log |
Periodic bulk export of local button history |
Production: mqtts://<pi>:8883. These topics are also bridged to HiveMQ for MariaDB.
dh40-app queries InfluxDB Flux (not MQTT) for historical sensor charts:
deinhaus40 + household Influx passwordWithings devices do not connect to the Raspberry Pi and do not use local MQTT or Influx. They pair with the participant’s phone and Withings’ cloud (Health Mate). The study imports health metrics via a central batch job on THD, parallel to but separate from the Z-Wave edge pipeline.
Repos: dh40-withings-mariadb-main, dh40-withings-auth-server-main, dh40_config_provider_poc-main, dh40-app-withings-poc-master (POC only).
| Piece | Role |
|---|---|
| Withings hardware | Scale, watch, sleep analyzer, etc. |
| Health Mate app | Pairing and daily use; participant views their own metrics |
| dh40-app “Gesundheitsdaten” page | Links to Health Mate (withings://home) — no Withings charts in dh40-app |
| Wohndaten charts | Influx only (environmental Z-Wave sensors) |
dh40-withings-auth-server (Flask) or an equivalent OAuth flow.refresh_token and access_token.Withings-Tokens/<home_id>/credentials.json (e.g. 01V56TVL).The Pi config-provider may also serve config.json with OAuth fields — used by dh40-app-withings-poc (browser → Pi config → Withings API). In the main dh40-app, fetchWithingsConfig is disabled (App.tsx); production import does not depend on the tablet fetching tokens.
dh40-withings-mariadb) Runs on THD Docker (docker-compose.yml), not on the Pi:
| Schedule | Script | Action |
|---|---|---|
| Daily 17:00 | withings_to_db.py |
For each Withings-Tokens/<home_id>/, call Withings API and append rows |
| Daily 00:00 | sensor_data_transfer.py |
Unrelated to Withings — copies Z-Wave warehouse tables |
withings_to_db.py calls the Withings API (refreshing tokens as needed):
| API call | MariaDB table | Content |
|---|---|---|
measure_get_meas |
withings_measures |
Weight, heart rate, body composition, … |
sleep_get_summary |
withings_sleepsum |
Nightly sleep aggregates (duration, score, HR/RR stats, …) |
sleep_get |
withings_sleep |
Time-series sleep states, HR, RR, snoring |
Writes go to dh40_withings (raw) and dh40_warehouse / database_science (research warehouse).
| Z-Wave sensors | Withings health | |
|---|---|---|
| Device → hub | Z-Wave USB → Pi | Phone → Withings cloud |
| Edge protocol | MQTT on Pi | None on Pi |
| Local store | InfluxDB | None |
| Tablet charts | Wohndaten (Flux) | Health Mate app only |
| Central store | MQTT bridge → dh40 |
API pull → withings_* tables |
| Timing | Near real-time | Daily batch cron |
The Pi bridge config includes an inbound rule data/<home_id>/withings/# (HiveMQ → local Mosquitto). This is not the primary Withings import path; production data enters via withings_to_db.py on THD.
Withings tables in database_science feed batch tools: dh40-streamlit, sensor-data-science, dh40-spark — via THD VPN exports (https://dh40-vpn.th-deg.de:8443), same as other study data.
Video and audio emergency detection in DH40 are research sidecars — they are not deployed in the standard household Pi stack (wohnung/docker/), not on the public VPS demo, and not integrated with dh40-app live charts or the HiveMQ study bridge in the archived code.
Repos: dh40-camera-module-master, dh40-emergency-detection-main, dh40-smart-mirror-2-main (trade-show emotion demo).
| Project | Hardware | Input | Output (today) | Status |
|---|---|---|---|---|
dh40-camera-module |
Jetson Nano + webcam | Live video (/dev/video0) |
print('Fall detected'); commented MQTT stub in mediapipe/main.py |
Research prototype |
dh40-camera-module / jetson |
Jetson + jetson-inference | Video stream | detections.csv (person count, confidence) |
Separate SSD demo |
dh40-emergency-detection |
Jetson + mic + webcam | Audio (ESC-50, fall sounds) + video (MediaPipe) | Notebooks, local CSV/logs; compared audio vs video fall detection | Ongoing research / MA |
dh40-smart-mirror-2 |
Jetson + webcam | Face video | Emotion overlay on mirror display | Trade-show demonstrator |
dh40-camera-module flow (video fall detection) Typical lab setup from the repo README:
mediapipe/start.sh runs pose estimation (pose_estimation.py / main.py).FallDetector applies geometric rules (neck/COM movement, body angle, bounding-box aspect ratio) over a short frame window.Fall detected). MQTT publish code exists but is commented out — no broker, topic, or Pi integration configured.This is edge ML on Jetson, not streaming video to the tablet or THD.
dh40-emergency-detection flow (audio + video research) Parallel research track (contactless emergency detection):
| Track | Approach |
|---|---|
| Audio | Mel-spectrogram + CNN on ESC-50; extended with fall sound samples; live inference on Jetson |
| Video | Reuses MediaPipe fall-detection logic; compared against audio in project 2 |
| Future (MA) | ESP32 microphone network instead of single Jetson device |
No connection to Mosquitto, InfluxDB, or MariaDB in the archived codebase.
| Production Pi stack | Camera research sidecar | Consumer surveillance (Ring, etc.) | |
|---|---|---|---|
| Device | Raspberry Pi | Jetson Nano | Vendor camera + cloud |
| Data | MQTT JSON events | Local video processing | H.264 streams + clips |
| Tablet / phone | dh40-app on LAN | No integrated viewer | Vendor mobile app |
| Study DB | MQTT bridge → MariaDB | Not wired in repo | Vendor cloud |
| Purpose | Ambient sensing study | Fall / emergency ML R&D | Security monitoring |
In principle, a custom publisher could send events (e.g. fall_detected) to Mosquitto if someone implements the bridge — main.py even sketches paho.mqtt. Nothing in the canonical architecture repo does this today. Video itself is not stored in Influx or MariaDB.
Results stay in local logs, CSV, and notebooks on the Jetson or developer machine until manually exported. They do not flow through dh40-spark / Streamlit pipelines unless researchers add that separately.
dh40-laborvisualisierung subscribes to the same MQTT broker (WebSocket) and updates floor-plan tiles in real time. It does not use Influx for the live view.
| Mechanism | Role |
|---|---|
| dh40-ca | Issues OpenVPN client cert per home ID |
| OpenVPN | Pi joins THD network (e.g. reach 10.8.0.1) |
| MQTT bridge certs | ca.crt, <home_id>.crt/.key for HiveMQ TLS |
Self-signed dh40_web.crt |
HTTPS on Pi (config-provider, Influx proxy, mqtts) |
Without VPN + trusted certs, the Mosquitto → HiveMQ bridge does not run.
| Database | Typical contents |
|---|---|
dh40 |
Raw MQTT / sensor stream |
database_science |
Cleaned features, app logs, Withings (withings_*) |
Exports for researchers: https://dh40-vpn.th-deg.de:8443 (THD VPN required). See dh40-spark-main/data/README.md.
Downstream tools work on exports, not live MQTT:
| Project | Input | Role |
|---|---|---|
| dh40-spark | dh40-raw/, dh40-science/ dumps |
Large-scale PySpark / Jupyter |
| sensor-data-science | CSV exports | Daily sensor features + sleep merge |
| dh40-streamlit | Categorised CSV / Withings samples | Interactive exploration |
This path is orthogonal to the live household stack: no Influx on the research laptops unless you build a separate export.
_demo/) The IONOS demo simulates the household edge for presentations. It does not connect to HiveMQ or MariaDB.
| Production | Demo equivalent |
|---|---|
| zwavejs2mqtt | mqtt-simulator.py |
| config-provider :8080 | Caddy /config/ |
| influxdb-proxy :8087 | Caddy /influx/ |
| mqtts :8883 | wss://<domain>/mqtt |
| 30d Influx history | influx-seed (one-shot) |
| OpenVPN + HiveMQ bridge | Not deployed |
Details: demo-production-parity.md, vps-operations.md.
| Client | Protocol | Target | Data |
|---|---|---|---|
| dh40-app | HTTPS | config-provider | home ID, Withings config (legacy) |
| dh40-app | Flux/HTTPS | Influx proxy | Wohndaten time series |
| dh40-app | WSS/MQTT | Mosquitto | Button presses |
| dh40-app | deep link | Health Mate app | Open Withings UI (no DH40 data transfer) |
| laborvis | WSS/MQTT | Mosquitto | Live sensor tiles |
| Telegraf | TCP/MQTT | Mosquitto | Subscribe all sensor topics |
| Mosquitto bridge | TLS/MQTT | HiveMQ (THD) | Z-Wave + button study replication |
| dh40-withings-mariadb | HTTPS REST | Withings API | Measures + sleep → MariaDB |
| Researcher | HTTPS (VPN) | dh40-vpn.th-deg.de | DB exports (incl. withings_*) |