Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Device config tool — HiveHub</title>
<meta name="description" content="Optional HiveHub device config tool: build a firmware secrets.h in your browser to pre-seed a device before first boot. The recommended way to configure a device is the on-device provisioning portal. Nothing leaves your machine." />
<meta name="color-scheme" content="light dark" />
<!-- Set the theme before the stylesheet paints, so there's no light flash. -->
<script>
(function () {
try {
var t = localStorage.getItem("hivehub-theme");
if (t !== "dark" && t !== "light") {
t = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
document.documentElement.setAttribute("data-theme", t);
} catch (e) { /* localStorage blocked — fall back to the light default */ }
})();
</script>
<link rel="stylesheet" href="assets/style.css" />
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%E2%9A%99%EF%B8%8F%3C/text%3E%3C/svg%3E" />
</head>
<body>
<header class="site-nav">
<div class="wrap">
<a class="brand" href="index.html"><span class="logo">🐝</span> HiveHub</a>
<nav>
<a href="index.html">Home</a>
<a href="index.html#setup">Setup</a>
<a href="build.html">Build your own</a>
<a href="dashboard-demo/">Dashboard demo</a>
<a href="insights.html">Insights</a>
<a href="https://github.com/MacNite/HiveHub">GitHub</a>
<button data-theme-toggle class="btn small ghost theme-toggle" type="button" aria-label="Toggle dark mode"></button>
</nav>
</div>
</header>
<section style="border-top:none; padding-bottom:1rem">
<div class="wrap">
<h2>⚙️ Device config tool</h2>
<p class="sub">
Pick your device identity, Wi-Fi and the sensors you actually fitted, then download a
ready-to-build <code>firmware/include/secrets.h</code>. Everything runs locally in your
browser — <strong>no values are uploaded anywhere</strong>.
</p>
<div class="note" style="border:1px solid var(--border,#e4e7ec);border-left:4px solid var(--accent,#f59e0b);border-radius:8px;padding:12px 14px;margin:10px 0;background:rgba(245,158,11,.06)">
<strong>The recommended way to configure a device is the on-device provisioning portal.</strong>
After flashing, hold the setup button to start the HiveHub Wi-Fi access point, connect to it,
and set Wi-Fi, backend, hives and sensors right on the device — those settings live in the
device's storage and <strong>survive OTA updates</strong>. This tool is optional: it only
pre-seeds a brand-new device on first boot (and provides build defaults), so you can skip it
and pair everything from the portal instead.
</div>
</div>
</section>
<section style="border-top:none; padding-top:0">
<div class="wrap">
<div class="cfg-layout">
<!-- ── LEFT: the form ─────────────────────────────────────── -->
<form id="cfg" autocomplete="off">
<fieldset>
<legend>Hardware</legend>
<div class="field">
<label for="mcu">MCU / board <span class="hint">— selects the PlatformIO environment and pin map</span></label>
<select id="mcu">
<option value="esp32dev">30-pin ESP32 DevKit (legacy — no longer recommended)</option>
<option value="xiao_esp32c6">XIAO ESP32-C6 (recommended — NAU7802 scales + BLE sensors)</option>
</select>
</div>
<div id="antenna-row" style="display:none; margin-top:.6rem">
<label class="toggle">
<input type="checkbox" id="ext_antenna" />
<span><span class="t-title">📡 External u.FL antenna</span>
<span class="t-desc">Drives GPIO3 HIGH to enable the u.FL connector. Default: built-in ceramic patch antenna. Sets <code>XIAO_C6_USE_EXTERNAL_ANTENNA 1</code>.</span></span>
</label>
</div>
</fieldset>
<fieldset>
<legend>Device identity</legend>
<div class="field">
<label for="device_id">Device ID <span class="hint">— unique per device</span></label>
<input type="text" id="device_id" value="hive-001" />
</div>
<div class="field">
<label for="api_key">API key <span class="hint">— sent in the <code>X-API-Key</code> header</span></label>
<div class="row">
<input type="text" id="api_key" value="your-api-key-here" />
<button type="button" class="btn ghost small" id="gen_key" style="flex:0 0 auto">🎲 Generate</button>
</div>
</div>
<div class="field row">
<div>
<label for="claim_code">Claim code <span class="hint">— for HivePal pairing</span></label>
<input type="text" id="claim_code" value="ABCD-1234" />
</div>
<div style="flex:0 0 130px">
<label for="claim_rev">Claim revision</label>
<input type="number" id="claim_rev" value="1" min="1" />
</div>
</div>
</fieldset>
<fieldset>
<legend>Backend</legend>
<div class="field">
<label for="api_base">API base URL <span class="hint">— no trailing slash</span></label>
<input type="url" id="api_base" value="https://your-backend-domain.com" />
</div>
</fieldset>
<fieldset>
<legend>Wi-Fi networks <span class="hint" style="font-weight:400">— up to 3, used to seed Preferences</span></legend>
<div id="wifi-list"></div>
<p class="muted" style="font-size:.85rem; margin:.4rem 0 0">
Network 1 is required; 2 and 3 are optional fallbacks.
</p>
</fieldset>
<fieldset>
<legend>Sensors</legend>
<p class="muted" style="margin:.2rem 0 .6rem; font-size:.9rem">
Toggle on only what you fitted. Each enabled sensor is compiled into the firmware
for this device.
</p>
<div id="c6-wired-notice" class="note warn" style="display:none; margin-bottom:.8rem">
⚠ <strong>XIAO ESP32-C6 selected</strong> — wired INMP441 mics are
<strong>not supported</strong> on this board (no spare pins/HX711).
A single wired DS18B20 probe still works (see Hives below); use wireless BLE
in-hive sensors for anything else.
</div>
<!-- INMP441 mics -->
<div class="sensor" data-sensor="mics">
<span class="tag">Wired · I2S</span>
<label class="toggle">
<input type="checkbox" data-toggle />
<span><span class="t-title">🔊 INMP441 stereo microphones</span>
<span class="t-desc">Two I2S MEMS mics sharing one bus, with per-band FFT.</span></span>
</label>
<div class="opts">
<div class="field row">
<div><label>BCLK pin</label><input type="number" data-opt="bclk" value="14" /></div>
<div><label>WS pin</label><input type="number" data-opt="ws" value="13" /></div>
<div><label>SD pin</label><input type="number" data-opt="sd" value="34" /></div>
</div>
<div class="field row">
<div><label>Sample rate (Hz)</label><input type="number" data-opt="rate" value="16000" /></div>
<div><label>Sample frames</label><input type="number" data-opt="frames" value="8000" /></div>
</div>
</div>
</div>
<!-- In-hive vibration is BLE-only; the wired LIS3DH/LIS2DH12 driver was removed. -->
<!-- MAX17048 battery -->
<div class="sensor" data-sensor="max17048">
<span class="tag">Off-grid · I2C</span>
<label class="toggle">
<input type="checkbox" data-toggle />
<span><span class="t-title">🔋 MAX17048 LiPo fuel gauge</span>
<span class="t-desc">Battery voltage, state-of-charge and low-battery alert.</span></span>
</label>
<div class="opts">
<div class="field" style="max-width:240px">
<label>Low-battery alert (%)</label>
<input type="number" data-opt="alert" value="20" min="1" max="99" />
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Hives & sensors <span class="hint" style="font-weight:400">— up to 16, matches the on-device provisioning portal</span></legend>
<p class="muted" style="margin:.2rem 0 .6rem; font-size:.9rem">
Add a hive, choose its single scale source, then optionally one in-hive sensor: a
wired DS18B20 probe or one wireless BLE/GATT sensor. Pre-seeding this here is
<strong>optional</strong> — it saves a trip to the portal on first boot, but you can
just add hives from the portal instead and skip this section entirely.
</p>
<div id="hive-list"></div>
<p class="muted" id="hive-empty" style="font-size:.85rem;margin:.4rem 0 0">No hives yet — add one below.</p>
<button type="button" class="btn ghost small" id="add-hive" style="margin-top:.6rem">➕ Add hive</button>
<p class="muted" id="hive-full" style="display:none;font-size:.82rem;margin:.5rem 0 0">
Maximum number of hives reached.</p>
<!-- Shared in-hive BLE scan + collision-avoidance options (only when a hive uses a beacon/GATT sensor) -->
<div id="inhive-global" style="display:none; margin-top:1rem">
<div class="note info" style="margin:1rem 0 .5rem">Beacon in-hive sensors (HolyIot,
RuuviTag, HiveInside beacon mode) are scanned passively in one shared window each
cycle, so any number of them costs the same scan. GATT sensors (HiveInside GATT,
HiveHeart, wireless HiveScale, HiveTraffic) connect serially and are capped at
<code>MAX_GATT_READS_PER_CYCLE</code> per wake — see <code>docs/multi-hive.md</code>.
<strong>HiveTraffic bee counters (BLE/GATT only) can be paired to any hive.</strong>
Wired I2C BeeCounters are no longer supported.</div>
<div class="field row">
<div><label>Scan seconds / cycle</label><input type="number" id="ble_scan" value="6" min="1" /></div>
<div><label>HolyIot Company ID (16-bit)</label><input type="text" id="ble_company" value="0xFFFF" /></div>
</div>
<label class="toggle" style="margin:.4rem 0">
<input type="checkbox" id="ble_active" checked />
<span><span class="t-title" style="font-size:.92rem">Active scan</span>
<span class="t-desc">Also fetch the device name (better pairing, slightly more power).</span></span>
</label>
<p class="muted" style="margin:.6rem 0 .2rem; font-size:.85rem"><strong>Collision avoidance</strong>
— when a hive's in-hive BLE sensor supplies one of these, disable the wired sensor for
that hive so each value has a single source:</p>
<label class="toggle" style="margin:.3rem 0">
<input type="checkbox" id="ovr_temp" checked />
<span><span class="t-title" style="font-size:.92rem">Override wired DS18B20 temperature</span>
<span class="t-desc">In-hive temp comes from the BLE sensor instead of the 1-Wire probe.</span></span>
</label>
<label class="toggle" style="margin:.3rem 0">
<input type="checkbox" id="ovr_mics" checked />
<span><span class="t-title" style="font-size:.92rem">Override wired INMP441 microphones</span>
<span class="t-desc">Acoustics come from a HiveInside / HiveHeart sensor; the wired stereo mics are skipped.</span></span>
</label>
<div class="note info">The ambient SHT40 is never overridden — it measures outside-hive
climate, a different quantity stored separately, so it does not collide.</div>
</div>
</fieldset>
<fieldset>
<legend>Build flags</legend>
<label class="toggle" style="margin:.4rem 0">
<input type="checkbox" id="debug_mode" checked />
<span><span class="t-title">🐞 Debug mode</span>
<span class="t-desc">Extra serial debug logs (<code>DEBUG_MODE</code>).</span></span>
</label>
<label class="toggle" style="margin:.4rem 0">
<input type="checkbox" id="force_reseed" />
<span><span class="t-title">♻️ Force reseed <span style="color:var(--danger)">(dangerous)</span></span>
<span class="t-desc">Overwrite stored Preferences from secrets.h on every boot.</span></span>
</label>
</fieldset>
</form>
<!-- ── RIGHT: live output ─────────────────────────────────── -->
<div class="output">
<div class="bar">
<h2>secrets.h</h2>
<button type="button" class="btn ghost small" id="copy">📋 Copy</button>
<button type="button" class="btn small" id="download">⬇️ Download</button>
</div>
<pre id="preview" class="mono"></pre>
<div class="note info" style="margin-top:.8rem">
Save this as <code>firmware/include/secrets.h</code> (it is gitignored — never commit it),
then build with <code>pio run -e <span id="pio-env">esp32dev</span> --target upload</code>.
</div>
</div>
</div>
</div>
</section>
<footer>
<div class="wrap" style="display:flex; gap:1rem; justify-content:space-between; width:100%; flex-wrap:wrap">
<span>🐝 HiveHub — MIT © 2026 Maximilian Nitschke</span>
<span><a href="index.html">Home</a> · <a href="build.html">Build your own</a> · <a href="https://github.com/MacNite/HiveHub">GitHub</a></span>
</div>
</footer>
<div class="toast" id="toast"></div>
<script src="assets/configurator.js"></script>
<script src="assets/theme.js"></script>
</body>
</html>
7452d848cThis file is pinned to the selected release. Download the original to open it in your design tool.