Open-source ESP32-C6 beehive monitoring hub for scales and sensors. Collects weight, climate, sound, vibration and bee traffic from up to 16 hives, with BLE, OTA, FastAPI/PostgreSQL backend, dashboards, MQTT and tested KiCad hardware.
Loading README and project media…
Project renamed: HiveScale → HiveHub. The project outgrew its original "dual scale" scope and now acts as a data collector / hub for many different types of beehive sensors and scales (up to 16 hives per ESP32), so the name was changed to match. A few internal identifiers — the database measurement columns, the OTA
targetvalue, the Docker image name (…/hivescale-api), the device's stored-config (NVS) namespace and MQTT topics — still use the oldhivescalename on purpose: changing them would need data/firmware migrations and could strand existing measurements or deployed-device config. The third-party beehivemonitoring.com "HiveScale" wireless weight scale is an unrelated product and keeps its own name.
Hardware status: all published PCBs are tested and working. The recommended build is the XIAO ESP32-C6 on the Scale Module V0.4 with NAU7802, MAX17048, TPS63020, TP4056, RTC, SD card and SHT40 — optionally expanded to 16 scales with the NAU7802 breakout PCB (TCA9548A mux + up to 8× NAU7802). See pcb-design/README.md. The old ESP32 30-pin board is obsolete and no longer recommended.
HiveHub is an ESP32-based data collector for beehive sensors and scales. It gathers weight, temperature, humidity, sound, vibration, power state, and network state from one or more hives (up to 16 per ESP32) and sends the readings to a self-hosted FastAPI backend backed by PostgreSQL, where they can be displayed in HivePal.
Every sensor is optional and compiled in per device — HiveHub reads the following directly on the ESP32:
On top of these wired sensors, HiveHub also bridges a range of wireless BLE/GATT sensors and scales (HolyIot, RuuviTag, HiveInside, and beehivemonitoring.com HiveHeart / HiveScale devices) — see Features below.
🌐 Website & setup guide: a small static site lives in
website/— a feature overview, a step-by-step setup guide, a complete "Build your own" guide (BOM with price estimates, wiring, firmware, backend — downloadable as PDF), and an in-browsersecrets.hconfigurator that builds your firmware config (sensors, BLE/GATT options, power modules) without hand-editing macros. It deploys to GitHub Pages via.github/workflows/pages.yml(enable Settings → Pages → Source: GitHub Actions), e.g.https://macnite.github.io/HiveHub/.
Every sensor is optional and compiled in per device — start with weight and add the rest.
HiveHub/
├── firmware/ # ESP32 PlatformIO project (src/, include/)
├── server/ # Python FastAPI backend, insights, migrations
│ └── dashboard/ # Built-in login-protected web dashboard (served at /dashboard)
├── docker/ # Docker Compose deployment
├── website/ # Static site + secrets.h configurator (GitHub Pages)
│ └── dashboard-demo/ # Backend-free dashboard demo (sample data)
├── docs/ # Hardware, API, deployment, and feature docs
├── pcb-design/ # KiCad breakout PCB design and fabrication files
├── test-data/ # Mock server and decoder/insight unit tests
└── .github/workflows/ # CI: backend image build + website Pages deploy
All links are affiliate links and support this project directly.
The recommended build is the XIAO ESP32-C6 on the Scale Module V0.4 — the complete bill of materials with price estimates and shop links lives on the Build your own page (also downloadable as CSV).
| Component | Role |
|---|---|
| Seeed Studio XIAO ESP32-C6 | Main controller (recommended — plugs into the Scale Module V0.4 PCB) |
| NAU7802 (I2C, on the Scale Module / breakout PCB) + load cells | Weight measurement (recommended — 2 scales on the Scale Module, up to 16 via the NAU7802 breakout PCB with its TCA9548A mux + up to 8× NAU7802) |
| SHT4x / SHT40 | Ambient temperature and humidity |
| DS3231 RTC | Offline timekeeping (remove its 4.7 kΩ I2C pull-ups — see the I2C pull-up note in docs/wiring.md) |
| MicroSD card module + card | Local cache and backup storage |
| MAX17048 | LiPo battery gauge (on the Scale Module) |
| TPS63020 buck-boost | Battery/5 V input to the regulated 3.3 V rail |
| TP4056 USB-C charger | LiPo charging |
| Momentary pushbutton | Provisioning and factory reset |
| IP-rated enclosure, glands, frame hardware | Outdoor installation |
| ESP32 Dev Board + 2x HX711 | Legacy 30-pin build (obsolete — no longer recommended) |
secrets.h)| Component | Firmware flag | Role |
|---|---|---|
| 2x DS18B20 waterproof probes | ENABLE_DS18B20_HIVE_TEMP | Internal hive temperature (or use an in-hive BLE sensor) |
| 2x INMP441 sound sensors | ENABLE_INMP441_MICS | Internal hive sound with per-band FFT |
| MAX17048 | ENABLE_MAX17048_BATTERY | LiPo voltage, state-of-charge, and low-battery alert |
| In-hive BLE sensor (HolyIot 25015 / RuuviTag / HiveInside / HiveHeart) | ENABLE_BLE_SCAN, ENABLE_BEEHIVE_GATT | Temp / humidity / pressure / vibration, no wiring — paired by MAC |
| CN3791 solar charger · 10 Ah LiPo · 6 V 4.5 W solar panel | Hardware only | Off-grid charging path feeding the Scale Module's TPS63020 |
Entrance traffic counting (in/out bees) is BLE/GATT-only:
0x30/0x31 slave path, including firmware updates over I2C) are no longer supported. BeeCounter firmware update over GATT is planned but not implemented yet, so there is currently no remote BeeCounter update path.Pins are defined in firmware/include/config.h (with optional per-device overrides in secrets.h). The firmware source is split into focused units under firmware/src/ (main.cpp, hivehub_network.cpp, portal.cpp, sensors.cpp, scale_bus.cpp, i2c_bus.cpp, hive_config.cpp, mics.cpp, ble_sensor.cpp, beehive_gatt.cpp, bee_counter_client.cpp, storage_power.cpp, device_prefs.cpp, status_led.cpp, globals.cpp).
The table below is the legacy 30-pin ESP32 map. The recommended XIAO ESP32-C6 build (pio run -e xiao_esp32c6) has its own pin map — NAU7802 scales over I2C on D4/D5, DS18B20 on D1, SD on D3/D8–D10, button on D2, no HX711/INMP441 — see docs/wiring.md and pcb-design/README.md.
| Signal | GPIO | Notes |
|---|---|---|
| HX711 #1 DOUT / SCK | 16 / 17 | Scale 1; SCK held high during deep sleep to power down the HX711 |
| HX711 #2 DOUT / SCK | 32 / 33 | Scale 2; SCK held high during deep sleep to power down the HX711 |
| DS18B20 1-Wire data | 4 | Shared bus for both probes; 4.7 kΩ pull-up to 3.3 V (ENABLE_DS18B20_HIVE_TEMP) |
| I2C SDA / SCL | 21 / 22 | RTC, SHT4x, NAU7802/TCA9548A, optional MAX17048 — shared bus at an explicit 100 kHz |
| SD CS / SCK / MISO / MOSI | 5 / 18 / 23 / 19 | MicroSD over SPI |
| Setup button | 27 | INPUT_PULLUP; short press opens provisioning AP, long press factory resets |
| INMP441 BCLK / WS / SD | 14 / 13 / 34 | I2S, shared by both mics; GPIO34 is input-only (ENABLE_INMP441_MICS) |
See docs/wiring.md for detailed wiring and pcb-design/README.md for the KiCad breakout PCB pinout.
cp firmware/include/secrets.example.h firmware/include/secrets.h
Edit firmware/include/secrets.h:
#define DEVICE_ID "hive-001"
#define API_KEY "your-api-key-here" // unique per device — see note below
#define CLAIM_CODE "ABCD-1234"
#define CLAIM_CODE_REVISION 1
#define API_BASE_URL "https://your-backend-domain.com" // HTTPS required (TLS is verified)
#define WIFI1_SSID "your-wifi-ssid-1"
#define WIFI1_PASS "your-wifi-password-1"
// WIFI2_* and WIFI3_* are optional fallbacks
Values in secrets.h seed the device's persistent Preferences on first boot. Later changes are usually made through the backend or provisioning portal. Set FORCE_RESEED true only when you intentionally want to overwrite stored preferences from the build file.
Per-device API key: give each device its own unique
API_KEY(generate one withopenssl rand -hex 32). The backend registers the key against the device'sdevice_idon first contact and rejects mismatches afterwards, so a leaked key only affects that one device. It no longer has to match the server'sAPI_KEYenvironment variable — that value is now only the master/admin key for tooling.
The firmware verifies the backend's TLS certificate. It ships the ISRG Root X1
(Let's Encrypt) root CA in firmware/include/ca_cert.h and syncs the clock over
NTP after connecting so validity can be checked. Therefore:
firmware/include/ca_cert.h (instructions are in that file).Optional sensors are enabled per build in secrets.h. The defaults shipped in secrets.example.h:
#define ENABLE_DS18B20_HIVE_TEMP 0 // wired in-hive temperature probes (default off)
#define ENABLE_INMP441_MICS 0 // stereo I2S mics + per-band FFT (default off)
#define ENABLE_BLE_SCAN 1 // in-hive BLE sensor bridge — HolyIot/RuuviTag/HiveInside (default on)
#define ENABLE_BEEHIVE_GATT 0 // beehivemonitoring.com HiveHeart / HiveScale over GATT (default off)
#define ENABLE_MAX17048_BATTERY 0 // LiPo fuel-gauge telemetry (default off)
The secrets.h configurator writes these (and the wireless-sensor macros) for you.
Cellular (SIM7080G) transport is no longer part of this firmware. LTE, solar, and battery handling now live on a separate Power Module that connects to the Scale Module over I2C/ESP-NOW. The ESP32 firmware itself is Wi-Fi only.
cd firmware
pio run --target upload
pio device monitor # 115200 baud
platformio.ini installs the required libraries automatically:
bogde/HX711, paulstoffregen/OneWire, milesburton/DallasTemperatureadafruit/Adafruit SHT4x Library, adafruit/RTClib, bblanchon/ArduinoJsonkosme/arduinoFFT — per-band FFT for the INMP441 mics and the vibration bandsh2zero/NimBLE-Arduino (2.x) — the in-hive BLE sensor bridge and GATT clientsOptional libraries:
sparkfun/SparkFun MAX1704x Fuel Gauge Arduino Library — ENABLE_MAX17048_BATTERYPress the setup button (D2 on the XIAO ESP32-C6, GPIO27 on the legacy 30-pin board) to manage field configuration without reflashing.
| Action | Result |
|---|---|
| Short press | Starts HiveHub-Setup-XXXX AP; open http://192.168.4.1 |
| Long press, 10 seconds | Clears stored Preferences and reboots |
The portal is organised by hive: it edits Wi-Fi networks, backend URL, device ID, claim code and API settings, and manages the hive registry — add a hive, pick its scale source (auto-detected NAU7802 channels or a wireless HiveScale) and one in-hive sensor (a DS18B20 probe by ROM or a BLE/GATT sensor by MAC, with a built-in BLE scan). It also offers live scale calibration (tare + known weight, fully offline) and an SD-card download (TAR) of the on-device backup. It closes automatically after 10 minutes. See docs/multi-hive.md and docs/ap-mode-sd-download.md.
cd docker
cp .env.example .env
# edit API_KEY, HIVEPAL_SERVICE_API_KEY, HIVEPAL_JWT_SECRET, POSTGRES_PASSWORD,
# PUBLIC_BASE_URL, and the database volume path in docker-compose.yml
docker compose up -d
The API listens on port 31115 by default. API_KEY and POSTGRES_PASSWORD
are required — compose refuses to start without them rather than falling
back to insecure defaults. Uploaded OTA firmware binaries persist in the
firmware-data volume.
| Setting | Default |
|---|---|
| API image | ghcr.io/macnite/hivehub:latest |
| API port | 31115 |
| Database image | postgres:16-alpine |
| Database name/user | hivescale |
See docs/docker-install.md and docs/truenas-install.md for full guides.
cd server
pip install -r requirements.txt
DATABASE_URL="postgresql://hivescale:password@localhost:5432/hivescale" \
API_KEY="your-master-admin-key" \
HIVEPAL_SERVICE_API_KEY="your-hivepal-service-key" \
HIVEPAL_JWT_SECRET="must-match-hivepal-jwt-secret" \
PUBLIC_BASE_URL="https://your-domain.example.com" \
uvicorn main:app --host 0.0.0.0 --port 8000
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string |
API_KEY | Yes | Master/admin key in X-API-Key for server-to-server tooling (firmware-release registration, command queueing, latest-measurements, time). Devices use their own per-device keys, registered on first contact. |
HIVEPAL_SERVICE_API_KEY | Yes, for HivePal | Service key sent by HivePal in X-HivePal-Service-Key |
HIVEPAL_JWT_SECRET | Yes, for HivePal | Shared HS256 secret used to verify the per-user Authorization: Bearer tokens HivePal sends. Must match HivePal's JWT_SECRET. |
PUBLIC_BASE_URL | Recommended | Public base URL used for OTA firmware download links |
FIRMWARE_DIR | Optional | Firmware binary directory, default /app/firmware |
DB_POOL_MIN_SIZE / DB_POOL_MAX_SIZE | Optional | DB connection pool bounds (default 1 / 10) |
RATE_LIMIT_ENABLED / RATE_LIMIT_DEFAULT | Optional | Per-client-IP rate limit (default on, 120/minute) |
MAX_BODY_BYTES / MAX_FIRMWARE_BYTES | Optional | Request-body and firmware-upload size caps (default 256 KiB / 16 MiB) |
ENABLE_LOCAL_DASHBOARD | Optional | Serve the built-in login-protected dashboard at /dashboard and its /api/v1/local/* API (default off). It serves every device on the server behind one login, so keep it off on multi-tenant deployments. |
DASHBOARD_SESSION_SECRET / DASHBOARD_SESSION_TTL_HOURS / DASHBOARD_COOKIE_SECURE | Optional | Dashboard login-session settings: signing secret (auto-generated and persisted when blank), session lifetime (default 168 h), HTTPS-only cookie flag |
TRUST_PROXY_HEADERS | Optional | Trust / for rate-limit client IPs (default ; set when the API port is exposed directly) |
The backend auto-creates tables and runs idempotent ALTER TABLE statements on startup; the SQL files in server/migrations/ can also be applied manually.
The backend can optionally mirror every measurement to an MQTT broker in addition to storing it in PostgreSQL — so HiveHub data flows into Home Assistant, Node-RED, openHAB or any MQTT consumer. It is off by default and purely additive: the bridge runs in a background thread and is fail-soft, so a broker outage never affects ingestion or the API.
Enable it by setting MQTT_ENABLED=true and pointing MQTT_HOST at your broker
(see server/.env.example / docker/.env.example for the full list):
MQTT_ENABLED=true
MQTT_HOST=192.168.1.10 # your broker (e.g. the Mosquitto add-on)
MQTT_PORT=1883
MQTT_USERNAME=hivescale # optional
MQTT_PASSWORD=... # optional
MQTT_HA_DISCOVERY=true # auto-create Home Assistant entities
With MQTT_BASE_TOPIC=hivescale (the default):
| Topic | Payload |
|---|---|
hivescale/bridge/availability | online / offline (bridge last-will) |
hivescale/<device_id>/availability | online / offline (per device) |
hivescale/<device_id>/state | Retained JSON of the latest reading (every non-null measurement field) |
When MQTT_HA_DISCOVERY=true, the bridge publishes
MQTT-discovery
configs the first time it sees each device. Home Assistant then automatically
creates one device per scale with a curated set of sensors — scale weights,
hive/ambient temperature & humidity, battery voltage/charge, solar power, Wi-Fi
signal, and bee-counter totals. Any in-hive wireless modules (a
beehivemonitoring.com HiveHeart/HiveScale or a HolyIOT BLE sensor) are exposed
as their own Home Assistant devices, nested under the hub, each carrying its own
full telemetry — temperature, humidity, battery and link signal (plus weight and
pressure for the scale, and sound frequency/energy/peak for the HiveHeart). Those
per-device temperature/humidity entities are published even though the hive's
resolved temperature/humidity also appear on the hub device, so a hive fitted
with several modules surfaces each one's readings separately. All other fields
remain available in the raw state JSON for custom templated sensors. Just make sure the
MQTT integration is set up
and pointed at the same broker.
See docs/mqtt.md for the full topic layout, every configuration variable, and the per-hive / per-module Home Assistant discovery details.
Interactive Swagger docs are at http://<host>:31115/docs. See docs/api.md for the full reference and schemas.
Require the X-API-Key header (per-device key, except where noted as master/admin).
| Method | Endpoint | Description |
|---|---|---|
GET | /health | Health check (no auth) |
GET | /api/v1/time | UTC server time for RTC sync (master/admin) |
POST | /api/v1/measurements | Submit a measurement (incl. optional telemetry) |
GET | /api/v1/measurements/latest | Latest measurements for dashboards (master/admin) |
GET/PATCH | /api/v1/devices/{id}/config | Get / update device configuration |
GET | /api/v1/devices/{id}/firmware | Check for a firmware update (?version=, ?target=hivescale, ?board=) |
POST | /api/v1/firmware/releases | Register a firmware release (master/admin) |
GET | /firmware/{filename} | Download a firmware binary |
POST | /api/v1/devices/{id}/commands | Queue a remote command (master/admin) |
POST | /api/v1/devices/{id}/commands/update-hiveinside | Queue a HiveInside OTA relay over BLE (?slot=1|2) |
GET | /api/v1/devices/{id}/commands/next | Claim next pending command |
POST | /api/v1/devices/{id}/commands/{cmd_id}/result | Report command result |
Require both X-HivePal-Service-Key and a per-user Authorization: Bearer <hivepal-jwt> token (verified with HIVEPAL_JWT_SECRET).
| Method | Endpoint | Description |
|---|---|---|
POST | /api/v1/app/devices/claim | Claim a device by claim code |
GET/DELETE | /api/v1/app/devices · /{id} | List devices · remove own membership |
GET/PATCH | /api/v1/app/devices/{id}/config | Get / update config (incl. tempco_*) |
GET/PATCH | /api/v1/app/devices/{id}/channels | List / update scale display names |
GET | /api/v1/app/devices/{id}/measurements[/latest] | Measurements (with date filter) / latest |
POST | /api/v1/app/devices/{id}/measurements/import | Bulk-import SD-card backup rows (idempotent) |
POST | /api/v1/app/devices/{id}/temp-compensation/fit | Fit a load-cell temperature coefficient |
GET/POST/DELETE | /api/v1/app/devices/{id}/members[...] | List / share / revoke device access |
POST | /api/v1/app/devices/{id}/calibration/start · /stop | Start / stop calibration mode |
POST | /api/v1/app/devices/{id}/firmware | Upload a firmware binary (multipart) and register it |
GET/POST | /api/v1/app/devices/{id}/firmware/status · /approve | OTA status / accept-to-apply approval |
POST | /api/v1/app/devices/{id}/commands/update-hiveinside | Trigger a HiveInside OTA relay |
GET | /api/v1/app/devices/{id}/insights[/summary|/history] | Rule-based colony insights, summary, and history |
Enabled only when ENABLE_LOCAL_DASHBOARD=true; every route returns 404 when
disabled. Access is gated by username + password login (HttpOnly session
cookie): the first visit runs a setup wizard that creates the initial admin
account, read endpoints need any valid session, and write/control endpoints
need the admin role. The API is not scoped per user — one login covers
every device on the server — so keep it off on multi-tenant deployments. These
endpoints power the built-in /dashboard UI; see
server/dashboard/README.md.
| Method | Endpoint | Description |
|---|---|---|
GET/POST | /api/v1/local/auth/status · /setup · /login · /logout | Session status / first-run wizard / sign in / sign out |
POST | /api/v1/local/auth/password · /email | Change own password / set alert e-mail |
GET/POST/DELETE | /api/v1/local/auth/users[/{id}] | Manage dashboard accounts (admin) |
GET | /api/v1/local/devices | List all devices + hive display names |
PATCH | /api/v1/local/devices/{id}/visibility | Hide / show a device in the hive picker (admin) |
GET | /api/v1/local/devices/{id}/measurements[/latest] | Measurements (date filter, down-sampled for charts) / latest |
POST | /api/v1/local/devices/{id}/measurements/import | Import an SD-card backup (.ndjson / .tar, admin) |
POST | /api/v1/local/devices/{id}/measurements/delete | Delete readings in a time range (admin + device claim code) |
GET/PATCH | /api/v1/local/devices/{id}/config | Read / update device config (interval, scale offsets/factors, temp comp) |
GET/PATCH | /api/v1/local/devices/{id}/channels | Read / rename the hive display names |
GET | /api/v1/local/devices/{id}/insights/summary · /history | Highest-severity insight summary / persisted alert history |
GET/POST | /api/v1/local/devices/{id}/firmware/status · (upload) · /approve | OTA status / upload binary / approve (admin) |
POST | · |
Core fields include weights, hive/ambient temperatures and humidity, raw HX711 values, firmware/config version, sensor status, boot count, and time source. Builds with optional hardware can also send:
mic_ok, per-channel mic_left_* / mic_right_* RMS/peak levels and per-band FFT energy (*_band_sub_bass_dbfs, *_band_hum_dbfs, *_band_piping_dbfs, *_band_stress_dbfs, *_band_high_dbfs).hive_N_humidity_percent, ble_N_humidity_percent, ble_N_pressure_hpa, and the beehivemonitoring.com hiveheart_N_* / hivescale_N_* fields.accel_N_ok, broadband accel_N_rms_mg / accel_N_peak_mg, and per-band energy accel_N_band_swarm_mg (8–30 Hz) / _fanning_mg (30–100 Hz) / _activity_mg (100–200 Hz) — populated by the in-hive BLE sensor.bee_counter_1_* / bee_counter_2_* lifetime totals, gate health, and status fields; the backend derives the interval in/out counts by differencing consecutive totals.battery_* (MAX17048) fields; the backend also still accepts the legacy solar_* fields.network_transport, calibration_mode, boot_count, time_source.The backend accepts network_transport for the future Power Module; on-device firmware reports network_transport: "wifi". (The old cellular_ok / cellular_csq fields were removed from the schema and are silently ignored if sent.) Fields are stored in dedicated PostgreSQL columns (plus raw_json) and returned through the latest-measurements and HivePal app APIs.
CLAIM_CODE in secrets.h before flashing, for example ABCD-1234.CLAIM_CODE_REVISION makes it send the new code once more.)POST /api/v1/app/devices/claim with the code.owner.To push a new claim code through OTA, change CLAIM_CODE, increment CLAIM_CODE_REVISION, and publish a new firmware build.
Commands are queued by the server and picked up by the device on its next cycle.
| Command type | Payload | Description |
|---|---|---|
calibrate_scale_1 / calibrate_scale_2 | {"known_weight_kg": 10.0} | Calibrate a scale with a known weight |
start_calibration_mode | {"interval_seconds": 5, "timeout_seconds": 600} | Temporarily use fast measurement cycles |
stop_calibration_mode | {} | Return to normal interval and deep sleep |
reboot | {} | Restart the ESP32 |
check_ota / ota_update | {} | Trigger an immediate OTA check |
update_hiveinside | {"slot": 1, "url": "...", "version": "...", "crc32": 123} | Relay firmware to a HiveInside sensor over BLE GATT (usually via the update-hiveinside helper) |
start_provisioning | {} | Start the Wi-Fi provisioning AP |
reset_wifi | {} | Clear saved Wi-Fi credentials and reboot |
reset_preferences / factory_reset | {} | Clear all Preferences and reboot |
The pcb-design/ directory contains the KiCad designs — all published boards are tested and working:
Start with pcb-design/README.md for the recommended setup, connector pinouts, fabrication files, and assembly notes.
A full index is in docs/README.md. Highlights:
CI (.github/workflows/ci.yml) builds both firmware targets, runs the host-level
I2C-hardening and BLE-decoder tests, the Python server suite, and syntax-checks
every website/dashboard script. To run the same checks locally:
# Server / insights suite (no database needed)
pip install -r server/requirements.txt pytest
DATABASE_URL=postgresql://unused/unused PYTHONPATH=server python3 test-data/test_counter_rules.py
DATABASE_URL=postgresql://unused/unused PYTHONPATH=server python3 test-data/test_accel_rules.py
DATABASE_URL=postgresql://unused/unused PYTHONPATH=server python3 test-data/test_ble_sensor_rules.py
DATABASE_URL=postgresql://unused/unused PYTHONPATH=server python3 test-data/test_sd_import.py
DATABASE_URL=postgresql://unused/unused PYTHONPATH=server python3 -m pytest -q test-data/test_tempcomp.py test-data/test_hiveheart_fft.py
# Firmware host tests (plain g++, no Arduino toolchain)
./firmware/host_test/run_tests.sh
g++ -std=gnu++17 -I firmware/include -o /tmp/t1 test-data/test_ruuvi_decode.cpp && /tmp/t1
g++ -std=gnu++17 -I firmware/include -o /tmp/t2 test-data/test_beehive_decode.cpp && /tmp/t2
# Firmware builds (needs PlatformIO)
cd firmware && pio run -e esp32dev && pio run -e xiao_esp32c6
curl examples for exercising a running backend are in
docs/test-commands.md; a mock server with sample data
lives in test-data/mock-server/.
docker compose logs hivescale-api for
ingest errors; verify the device's API_BASE_URL is HTTPS with a valid
certificate (the firmware verifies TLS) and NTP (UDP 123) is reachable.board
must match the device (esp32 vs esp32-c6), the version must be newer, and
the owner must have approved it (accept-to-apply gate). Also make sure
PUBLIC_BASE_URL is set, otherwise download URLs are relative.FIRMWARE_DIR; make sure the firmware-data volume (or a bind mount) is
attached.ENABLE_LOCAL_DASHBOARD=true on the API container.dashboard_users
table; deleting all rows re-runs the first-visit setup wizard.Issues and pull requests are welcome. Please run the test suite above before
submitting, keep the docs in sync with behavior changes, and note that
CLAUDE.md documents repository conventions for AI-assisted contributions.
To request support for a new hive sensor, see
docs/device-not-supported-yet.md.
Please do not open public issues for security vulnerabilities. Report them privately to the maintainer (see the commit history / GitHub profile for contact) so a fix can be released first.
MIT © 2026 Maximilian Nitschke
/dashboard for single-owner self-hosts, protected by username + password login (first visit runs a setup wizard; admin/viewer roles): cross-device hive comparison, charts for every data group, plus device-config editing, hive renaming, firmware/OTA and calibration controls, SD-backup import, and user management. Off by default (ENABLE_LOCAL_DASHBOARD); see server/dashboard/README.md and the live demo./api/v1/app/... endpoints using a HivePal service key, per-user JWTs, and per-user access roles.CF-Connecting-IPX-Forwarded-FortruefalseINSIGHTS_RECONCILE_* | Optional | Background insight-history reconciliation (see server/.env.example) |
SMTP_* / NOTIFY_MIN_SEVERITY | Optional | E-mail channel for insight alert notifications (off by default — see Insight alert notifications) |
WEB_PUSH_ENABLED / VAPID_* | Optional | Web Push channel for insight alert notifications (off by default — see Insight alert notifications) |
MQTT_* | Optional | MQTT bridge to Home Assistant / Node-RED / openHAB (off by default — see MQTT / Home Assistant integration) |
TZ | Optional | Server timezone, for example Europe/Berlin |
/api/v1/local/devices/{id}/calibration/start/stop| Start / stop calibration mode (admin) |
POST | /api/v1/local/devices/{id}/temp-compensation/fit | Fit a load-cell temperature coefficient (admin) |
GET | /api/v1/local/notifications/config | Which alert channels are enabled + VAPID public key |
POST | /api/v1/local/notifications/subscribe · /unsubscribe | Register / forget this browser's Web Push subscription |
POST | /api/v1/local/notifications/test | Send a test alert over every enabled channel |