The latest development version of this page may be more current than this released 0.4.3 version.

Bluetooth: Mesh OnOff

Overview

This sample demonstrates Bluetooth mesh functionality. It has several standard mesh models, and supports provisioning over both the Advertising and the GATT Provisioning Bearers (i.e. PB-ADV and PB-GATT). The application also needs a functioning serial console, since that’s used for the Out-of-Band provisioning procedure.

On boards with LEDs, a Generic OnOff Server model exposes functionality for controlling the first LED on the board over the mesh.

On boards with buttons, a Generic OnOff Client model will send Onoff messages to all nodes in the network when the button is pressed.

Similar to the Mesh sample, except that this application based on model_cli & model_srv and it supports subscribe and publish operation.

Requirements

  • A board with Bluetooth LE Mesh support

  • Provisioner

Building and Running

examples/bluetooth/mesh_onoff

compile, burn, and more, see get-started chapter 。

Running result

I/mesh_onoff      [0.222] Initializing...

I/bt_hci_core     [0.248] No ID address. App must call settings_load()
I/mesh_onoff      [0.254] Bluetooth initialized

I/bt_hci_core     [0.384] Identity: 28:6D:CE:01:02:03 (public)
I/bt_hci_core     [0.388] HCI: version 4.2 (0x08) revision 0x0709, manufacturer 0x070c
I/bt_hci_core     [0.396] LMP: version 4.2 (0x08) subver 0x0709
I/mesh_onoff      [0.462] Mesh initialized

Interacting with the sample

The sample can either be provisioned into an existing mesh network with an external provisioner device, or self-provision through a button press.

When provisioning with a provisioner device, the provisioner must give the device an Application key and bind it to both Generic OnOff models.

Once provisioned, messages to the Generic OnOff Server will be used to turn the LED on or off, and button presses will be used to broadcast OnOff messages to all nodes in the same network.