Use of scenes in BLE mesh with nrf52840

Hi,

I have autoprovisioned and autoconfigured my nrf52840 board (provisioning and configuring are made inside the software and not through external app/provisioner).

In particular, I have configured three couples of switch/led as client/server.

Now I'd like to set some scenes, for example:

  • two leds on and one off.
  • one led on and two off
  • all led on

My goal is to be able to recall one of these scenes 

How can I implement these scenes in the software? Which is the way to memorize them?

And then how can I recall each of them?

Here is my elements definition:

/* ELEMENTS */
static struct bt_mesh_elem elements[] = {
	BT_MESH_ELEM(1,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_CFG_SRV,
					 BT_MESH_MODEL_CFG_CLI(&cli_data),
					 BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
					 BT_MESH_MODEL_DFD_SRV(&dfd_srv),
					 BT_MESH_MODEL_ONOFF_CLI(&buttons[BUTTON_IDX].client),
					 BT_MESH_MODEL_ONOFF_SRV(&led_ctx[LED_IDX].srv)),
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_CHAT_CLI(&chat))),
	BT_MESH_ELEM(2,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_DFU_SRV(&dfu_srv)),
				 BT_MESH_MODEL_NONE),
	BT_MESH_ELEM(3,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_ONOFF_CLI(&buttons[BUTTON_IDX2].client),
					 BT_MESH_MODEL_ONOFF_SRV(&led_ctx[LED_IDX2].srv)),
				 BT_MESH_MODEL_NONE),
	BT_MESH_ELEM(4,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_ONOFF_CLI(&buttons[BUTTON_IDX3].client),
					 BT_MESH_MODEL_ONOFF_SRV(&led_ctx[LED_IDX3].srv)),
				 BT_MESH_MODEL_NONE),
};

I hope in your help as always

Best regards

Parents
  • Hi Stefano and thanks for your patience,

    First of all, doing things in regards to provisioning etc in Mesh programmatically is always a bit frowned upon, as having a dedicated provisioner is considered the safer choice. Though I assume you've already been told about this in the past, so I'll leave it at that. 

    In order to use scenes you'll have to use scene server models, and eg. using bt_mesh_scene_cli_store() and bt_mesh_scene_cli_recall(). Have a look here.

    The best way to learn how this can be done is probably using and testing out the Light dimmer and scene selector sample.

    Regards,

    Elfving

Reply
  • Hi Stefano and thanks for your patience,

    First of all, doing things in regards to provisioning etc in Mesh programmatically is always a bit frowned upon, as having a dedicated provisioner is considered the safer choice. Though I assume you've already been told about this in the past, so I'll leave it at that. 

    In order to use scenes you'll have to use scene server models, and eg. using bt_mesh_scene_cli_store() and bt_mesh_scene_cli_recall(). Have a look here.

    The best way to learn how this can be done is probably using and testing out the Light dimmer and scene selector sample.

    Regards,

    Elfving

Children
No Data
Related