start clean mesh (first terminal):
$ rm -rf ~/.config/meshcfg/config_db.json
$ sudo rm -rf /var/lib/bluetooth/mesh
$ sudo mkdir /var/lib/bluetooth/mesh
$ sudo /usr/libexec/bluetooth/bluetooth-meshd -nd --debug
provisioner (second terminal):
$ mesh-cfgclient
Warning: config file "/home/pi/.config/meshcfg/config_db.json" not found
[mesh-cfgclient]# create
Created new node with token 522b02d50de1c8a2
Proxy added: org.bluez.mesh.Node1 (/org/bluez/mesh/nodea186fe8c7e3b461daa29664eba26ed2d)
Proxy added: org.bluez.mesh.Management1 (/org/bluez/mesh/nodea186fe8c7e3b461daa29664eba26ed2d)
Attached with path /org/bluez/mesh/nodea186fe8c7e3b461daa29664eba26ed2d
[mesh-cfgclient]# appkey-create 0 0
device (third terminal):
$ bluez/test/test-mesh
join
Joining with UUID 3df8492249f1476491a1e4e1d051a5f7
Join procedure started
provisioner:
[mesh-cfgclient]# provision 3df8492249f1476491a1e4e1d051a5f7
device:
PromptStatic ( static-oob )
Enter 16 octet key on remote device: 6f4b1f31cbe0d0f81b0ef64a1c70b86c
provisioner:
[[mesh-agent]# ] Enter key (hex number): 6f4b1f31cbe0d0f81b0ef64a1c70b86c
device:
Joined mesh network with token 62cb5d464413e5c7
provisioner:
Assign addresses for 2 elements
Provisioning done:
Mesh node:
UUID = 3DF8492249F1476491A1E4E1D051A5F7
primary = 00aa
elements (2):
[mesh-cfgclient]# menu config
[mesh-cfgclient]# target 00aa
Configuring node 00aa
[config: Target = 00aa]# appkey-add 0
[config: Target = 00aa]# composition-get
Received DeviceCompositionStatus (len 29)
Received composion:
Feature support:
relay: yes
proxy: no
friend: yes
lpn: no
Element 0:
location: 0000
SIG defined models:
Model ID 0000 "Configuration Server"
Model ID 1000 "Generic OnOff Server"
Vendor defined models:
Model ID 05f1 0001
Element 1:
location: 0000
SIG defined models:
Model ID 1001 "Generic OnOff Client"
[config: Target = 00aa]# bind 00aa 0 1000
[config: Target = 00aa]# bind 00ab 0 1001
device:
attach
Attach mesh node to bluetooth-meshd daemon
Mesh app registered: /org/bluez/mesh/node3df8492249f1476491a1e4e1d051a5f7
Update Model Config 1000
Bindings: [0]
Update Model Config 1001
Bindings: [0]
dest
Enter 4-digit hex destination address:
00aa
Destination address: 00aa
client-menu
*** ON/OFF CLIENT MENU ***
on
Set state: 1
OnOffClient send command
Message Received on Element 00, src= 00ab, dst=00aa
State is ON
Message Received on Element 01, src= 00aa, dst=00ab
OnOffClient process message len = 3
Got state ON from 00aa
off
Set state: 0
OnOffClient send command
Message Received on Element 00, src= 00ab, dst=00aa
State is OFF
Message Received on Element 01, src= 00aa, dst=00ab
OnOffClient process message len = 3
Got state OFF from 00aa
get-state
OnOffClient send command
Message Received on Element 00, src= 00ab, dst=00aa
Get state
Message Received on Element 01, src= 00aa, dst=00ab
OnOffClient process message len = 3
Got state OFF from 00aa
Good idea !