diff --git a/docs/cli_command_availability.md b/docs/cli_command_availability.md index f34576446..77c3f9382 100644 --- a/docs/cli_command_availability.md +++ b/docs/cli_command_availability.md @@ -91,6 +91,7 @@ over the normal binary USB, BLE, or TCP connection: | [`get/set radio.fem.rxgain`](cli_commands.md#view-or-change-the-lora-fem-receive-path-gain-state-on-supported-boards) | Companion on a board with controllable LoRa FEM LNA | | [`get/set wifi.powersave`](cli_commands.md#browser-configuration-portal-esp32-repeater-and-room-server) | ESP32 WiFi Companion; active transport constraints still apply | | [`get/set bluetooth.name`](cli_commands.md#view-or-change-the-independent-bluetooth-name-companion) | Companion firmware | +| [`set pin <0-999999>`](cli_commands.md#set-the-bluetooth-pairing-pin-companion) | Companion text terminal, command `0x42`, and authorized LoRa CLI; saved, reboot to apply; affects Bluetooth-capable builds | | [`get/set bluetooth.mac`](cli_commands.md#view-or-change-the-bluetooth-address-ble-companion) | Every Companion build with Bluetooth | | [`get/set display.touch`](cli_commands.md#show-touchscreen-touch-areas) | Touchscreen Companions using the shared UI; text terminal and framed CLI; off after reboot | | [`get/set display.inbox`](cli_commands.md#set-companion-inbox-behavior) | Shared Companion UI; `history` (default), `pending`, or `unread`; saved across reboot | diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 4751484cf..a797e3062 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -1757,6 +1757,37 @@ the frame and reply format. --- +#### Set the Bluetooth pairing PIN (Companion) + +**Usage:** + +- `set pin <0-999999>` + +Choose a six-digit code for a fixed Bluetooth pairing PIN. For example: + +```text +set pin 654321 +reboot +``` + +The command saves the PIN across reboots and replies `> pin is now 654321`. +Reboot to activate the new code; the current Bluetooth session keeps its +existing PIN until then. A failed save reports an error and retains the +previous saved setting. + +`set pin 0` clears the saved override, rather than setting the pairing code to +`000000` or disabling Bluetooth. After reboot, the build's default policy +applies: normally `123456` without a display, or a generated PIN on eligible +display-equipped builds. + +This command is available in the Companion text terminal, binary command +`0x42` (`CMD_RUN_CLI_COMMAND`), and authorized LoRa CLI; a Bluetooth-capable build +is needed to use the PIN. Existing bonded clients may reconnect without being +asked for a PIN. +Forget the device on the phone and pair again if you need to enter the new code. + +--- + #### View or change the Bluetooth address (BLE Companion) **Usage:** diff --git a/docs/companion_radio_full.md b/docs/companion_radio_full.md index 04b8d970b..37242e645 100644 --- a/docs/companion_radio_full.md +++ b/docs/companion_radio_full.md @@ -592,8 +592,10 @@ switches to the first home page, and keeps the active six-digit PIN visible until Bluetooth connects or the two-minute pairing window expires. USB, WiFi, Ethernet, and hardware-serial connections do not suppress this screen. With no saved BLE PIN, display builds generate a new PIN at boot; builds without a -physical display use `123456`. A PIN saved through the Companion protocol takes -effect after reboot. +physical display use `123456`. Use `set pin 654321` in the Companion CLI to save +a fixed pairing PIN, then `reboot` to activate it. `set pin 0` restores the +default/generated PIN policy. A PIN saved through the Companion protocol also +takes effect after reboot. See the [PIN command reference](cli_commands.md#set-the-bluetooth-pairing-pin-companion). The Bluetooth device name is independently configurable. In the text terminal, use `get bluetooth.name` and `set bluetooth.name `; use diff --git a/docs/terminal_chat_cli.md b/docs/terminal_chat_cli.md index 1f4cc99fd..a0d56752c 100644 --- a/docs/terminal_chat_cli.md +++ b/docs/terminal_chat_cli.md @@ -215,6 +215,15 @@ advertisement identity. A custom name may contain spaces and is limited to 31 valid UTF-8 bytes. `default` restores `MeshCore-`. The saved change takes effect after reboot. `get ble.name` and `set ble.name` are short aliases. +``` +set pin {0-999999} +``` +Saves the Bluetooth pairing PIN. For example, run `set pin 654321`, then +`reboot` to activate it. `set pin 0` removes the saved override and restores the +build's default/generated PIN policy after reboot; it does not disable Bluetooth. +Existing bonds can reconnect without PIN entry, so forget the phone's device +entry and pair again if needed. See [Bluetooth pairing PIN](cli_commands.md#set-the-bluetooth-pairing-pin-companion). + ``` get bluetooth.mac set bluetooth.mac {address|random|random-every-boot|random-after-connect|default}