Skip to content

Advertise a per-node name so several HiveInsides can be told apart - #70

Merged
MacNite merged 1 commit into
mainfrom
claude/hiveinside-device-name-tooltip-vf78y3
Aug 24, 2026
Merged

Advertise a per-node name so several HiveInsides can be told apart#70
MacNite merged 1 commit into
mainfrom
claude/hiveinside-device-name-tooltip-vf78y3

Conversation

@MacNite

@MacNite MacNite commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Why

Every node advertised the bare local name HiveInside. In a yard running more than one, a scanner listed several identical entries and the only thing separating them was the raw BLE address — not on the enclosure, not in HiveHub's dashboard, and not something a beekeeper has memorized.

What changed

beacon_init() appends a hyphen and the last two bytes of the node's identity address, so what goes on the air is HiveInside-8A3F. The suffix is derived from the address rather than provisioned, so it needs no setup step and survives a factory erase.

  • bt_set_name() keeps the GAP Device Name characteristic in step with the scan response, so a node does not call itself one thing while advertising another. That needs CONFIG_BT_DEVICE_NAME_DYNAMIC=y; CONFIG_BT_DEVICE_NAME_MAX is pinned to 15 rather than left at the default 28, which would reserve RAM for a name this firmware cannot produce.
  • The name buffer starts out holding the bare prefix, so a node whose identity address cannot be read — or whose suffix would not fit — still advertises a usable name instead of an empty or half-written one. snprintk reports what it would have written, so the truncation guard checks against the room it was given, not just a negative return.
  • Two build asserts hold the sizing: the scan response is measured at the name's full length against the 31-byte legacy limit, and CONFIG_BT_DEVICE_NAME_MAX must cover the name bt_set_name() is handed.

Firmware 0.4.7 → 0.5.0 — the advertised scan response changes.

Files

File
firmware-nrf54lm20a/src/beacon.c runtime name buffer, build_adv_name(), both scan-response paths, build asserts
firmware-nrf54lm20a/src/hive_config.h name is now a prefix; HIVEINSIDE_DEVICE_NAME_MAX; version bump
firmware-nrf54lm20a/prj.conf CONFIG_BT_DEVICE_NAME_DYNAMIC, CONFIG_BT_DEVICE_NAME_MAX
README.md per-node identity in Key features

Testing

Not built. This environment has no west/Zephyr toolchain, so the firmware is unbuilt here — CI is the first real compile. The change is source-level only (no build-system or manifest changes), and the sizing constraints that would normally bite are covered by the two BUILD_ASSERTs rather than left to a link error.

Companion

MacNite/HiveHub#171 surfaces this name in the dashboard's firmware panel. That side degrades gracefully on its own: a node still on 0.4.x shows its BLE address and a note saying 0.5.0 gives it a distinguishable name.

🤖 Generated with Claude Code

https://claude.ai/code/session_01T9ZUAmc45AB5Mf7ETM82Uv

Every node advertised the bare local name "HiveInside". In a yard running more
than one, a scanner listed several identical entries and the only thing
separating them was the raw BLE address — which is not on the enclosure, not in
HiveHub's dashboard, and not something a beekeeper has memorized.

beacon_init() now appends a hyphen and the last two bytes of the node's identity
address, so what goes on the air is "HiveInside-8A3F". The suffix is derived
from the address rather than provisioned, so it needs no setup step and survives
a factory erase. bt_set_name() keeps the GAP Device Name characteristic in step
with the scan response, so a node does not call itself one thing while
advertising another.

The name buffer starts out holding the bare prefix, so a node whose identity
address cannot be read, or whose suffix would not fit, still advertises a usable
name instead of an empty or half-written one.

Two build asserts hold the sizing: the scan response is still measured at the
name's full length against the 31-byte legacy limit, and CONFIG_BT_DEVICE_NAME_MAX
must cover the name bt_set_name() is handed.

Firmware 0.4.7 -> 0.5.0 (the advertised scan response changes).
@MacNite
MacNite merged commit 26cd8db into main Aug 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants