<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to add multiple elements in a server node?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35374/how-to-add-multiple-elements-in-a-server-node</link><description>I am experimenting with the mesh light-switch example. I want to control two LEDs on a single node using the SimpleOnOff model. I know I should add a separate element and add the second SimpleOnOff model in it, but how do I do it? Is there any sample</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 26 Jun 2018 07:18:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35374/how-to-add-multiple-elements-in-a-server-node" /><item><title>RE: How to add multiple elements in a server node?</title><link>https://devzone.nordicsemi.com/thread/137582?ContentTypeID=1</link><pubDate>Tue, 26 Jun 2018 07:18:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1939e33f-4437-4f5b-96a0-f4b4872fb4f0</guid><dc:creator>Prasad</dc:creator><description>&lt;p&gt;Finally I was able to get it working... Here are the changes!&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;diff --git a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/provisioner/src/node_setup.c b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/provisioner/src/node_setup.c
index d9a6576..7ed5c85 100644
--- a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/provisioner/src/node_setup.c
+++ b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/provisioner/src/node_setup.c
@@ -144,6 +144,7 @@ static const config_steps_t server1_server2_config_steps[] =
     NODE_SETUP_CONFIG_APPKEY_ADD,
     NODE_SETUP_CONFIG_APPKEY_BIND_HEALTH,
     NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_SERVER,
+    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_SERVER,
     NODE_SETUP_CONFIG_PUBLICATION_HEALTH,
     NODE_SETUP_CONFIG_PUBLICATION_ONOFF_SERVER1_2,
     NODE_SETUP_CONFIG_SUBSCRIPTION_ONOFF_SERVER,
@@ -340,6 +341,7 @@ static void config_step_execute(void)
 {
     uint32_t status;
     static uint16_t model_element_addr = 0;
+    static bool next_element = false;
 
     /* This example configures the provisioned nodes in the following way
      * Node 0: Client node (Switch)
@@ -394,16 +396,34 @@ static void config_step_execute(void)
         /* Bind the On/Off server to the application key: */
         case NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_SERVER:
         {
-            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;App key bind: Simple On/Off server\n&amp;quot;);
-            access_model_id_t model_id;
-            model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
-            model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
-            uint16_t element_address = m_current_node_addr;
-            retry_on_fail(config_client_model_app_bind(element_address, m_appkey_idx, model_id));
-
-            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
-            expected_status_set(CONFIG_OPCODE_MODEL_APP_STATUS, sizeof(exp_status), exp_status);
-            break;
+            if (!next_element)
+            {
+              __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Configure first element\n&amp;quot;);
+              access_model_id_t model_id;
+              model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
+              model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
+              uint16_t element_address = m_current_node_addr;
+              retry_on_fail(config_client_model_app_bind(element_address, m_appkey_idx, model_id));
+
+              static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
+              expected_status_set(CONFIG_OPCODE_MODEL_APP_STATUS, sizeof(exp_status), exp_status);
+              next_element = true;
+              break;
+            }
+            else
+            {
+              __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Configure next element\n&amp;quot;);
+              access_model_id_t model_id;
+              model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
+              model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
+              uint16_t element_address = m_current_node_addr + 1;
+              retry_on_fail(config_client_model_app_bind(element_address, m_appkey_idx, model_id));
+
+              static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
+              expected_status_set(CONFIG_OPCODE_MODEL_APP_STATUS, sizeof(exp_status), exp_status);
+              next_element = false;
+              break;
+            }
         }
 
         /* Bind the On/Off client to the application key: */
diff --git a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h
index 9d70cc1..312ba5f 100644
--- a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h
+++ b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h
@@ -82,7 +82,7 @@
  * @note This value has to be greater than two to fit the configuration and health models,
  * plus the number of models needed by the application.
  */
-#define ACCESS_MODEL_COUNT (3)
+#define ACCESS_MODEL_COUNT (4)
 
 /**
  * The number of elements in the application.
@@ -90,7 +90,7 @@
  * @warning If the application is to support multiple _instances_ of the _same_ model, they cannot
  * belong in the same element and a separate element is needed for the new instance.
  */
-#define ACCESS_ELEMENT_COUNT (1)
+#define ACCESS_ELEMENT_COUNT (2)
 
 /**
  * The number of allocated subscription lists for the application.
diff --git a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c
index 1048083..1367e26 100644
--- a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c
+++ b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c
@@ -57,12 +57,17 @@
 #define RTT_INPUT_POLL_PERIOD_MS (100)
 #define LED_PIN_NUMBER           (BSP_LED_0)
 #define LED_PIN_MASK             (1u &amp;lt;&amp;lt; LED_PIN_NUMBER)
+#define LED_PIN_NUMBER_1           (BSP_LED_1)
+#define LED_PIN_MASK_1             (1u &amp;lt;&amp;lt; LED_PIN_NUMBER_1)
+
 #define LED_BLINK_INTERVAL_MS    (200)
 #define LED_BLINK_CNT_START      (2)
 #define LED_BLINK_CNT_RESET      (3)
 #define LED_BLINK_CNT_PROV       (4)
 
 static simple_on_off_server_t m_server;
+static simple_on_off_server_t m_server1;
+
 static bool                   m_device_provisioned;
 
 static void provisioning_complete_cb(void)
@@ -89,6 +94,21 @@ static bool on_off_server_set_cb(const simple_on_off_server_t * p_server, bool v
     return value;
 }
 
+
+static bool on_off_server_get_cb_1(const simple_on_off_server_t * p_server)
+{
+    return hal_led_pin_get(LED_PIN_NUMBER_1);
+}
+
+static bool on_off_server_set_cb_1(const simple_on_off_server_t * p_server, bool value)
+{
+    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Got SET command to %u\n&amp;quot;, value);
+    hal_led_pin_set(LED_PIN_NUMBER_1, value);
+    return value;
+}
+
+
+
 static void node_reset(void)
 {
     __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- Node reset  -----\n&amp;quot;);
@@ -122,6 +142,16 @@ static void button_event_handler(uint32_t button_number)
             break;
         }
 
+        case 1:
+        {
+            uint8_t value = !hal_led_pin_get(LED_PIN_NUMBER_1);
+            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;User action \n&amp;quot;);
+            hal_led_pin_set(LED_PIN_NUMBER_1, value);
+            (void)simple_on_off_server_status_publish(&amp;amp;m_server1, value);
+            break;
+        }
+
+
         /* Initiate node reset */
         case 3:
         {
@@ -151,7 +181,10 @@ static void models_init_cb(void)
     m_server.get_cb = on_off_server_get_cb;
     m_server.set_cb = on_off_server_set_cb;
     ERROR_CHECK(simple_on_off_server_init(&amp;amp;m_server, 0));
-    ERROR_CHECK(access_model_subscription_list_alloc(m_server.model_handle));
+
+    m_server1.get_cb = on_off_server_get_cb_1;
+    m_server1.set_cb = on_off_server_set_cb_1;
+    ERROR_CHECK(simple_on_off_server_init(&amp;amp;m_server1, 1));
 }
 
 static void mesh_init(void)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note that these changes are just to demonstrate the regions of code that you need to change for adding multiple elements. I just checked this with only 1 server board. The light switch client application already has multiple nodes in it(for 4 switches), I found it very helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add multiple elements in a server node?</title><link>https://devzone.nordicsemi.com/thread/136201?ContentTypeID=1</link><pubDate>Thu, 14 Jun 2018 14:14:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06ac0cd6-a803-408d-b554-9ab4387d70e9</guid><dc:creator>Mttrinh</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, you have to make some changes in the provisioner application. Seems like the code in the server application is correct, I suggest you to have a look at this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/24563/adding-second-element-to-a-light-control-server-node-mesh-example" target="_blank" rel="noopener noreferrer"&gt;post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add multiple elements in a server node?</title><link>https://devzone.nordicsemi.com/thread/136114?ContentTypeID=1</link><pubDate>Thu, 14 Jun 2018 09:42:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42ed998c-9af4-49cb-9dbd-6a2cec68c0dc</guid><dc:creator>Prasad</dc:creator><description>&lt;p&gt;I have been studying the server, client and provisioner application since yesterday, I understand that I would need to do some changes in the provisioner application. Can someone from Nordic respond to this question??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to add multiple elements in a server node?</title><link>https://devzone.nordicsemi.com/thread/135906?ContentTypeID=1</link><pubDate>Wed, 13 Jun 2018 11:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8cdfb745-2446-489c-8319-3a2fb529f2a6</guid><dc:creator>Prasad</dc:creator><description>&lt;p&gt;I did this in the server application application. When I press button 2 on the server board, LED 2 gets lit up, but now how do I control it from button 2 of my client board?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;diff --git a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h
index 9d70cc1..312ba5f 100644
--- a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h
+++ b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/include/nrf_mesh_config_app.h
@@ -82,7 +82,7 @@
  * @note This value has to be greater than two to fit the configuration and health models,
  * plus the number of models needed by the application.
  */
-#define ACCESS_MODEL_COUNT (3)
+#define ACCESS_MODEL_COUNT (4)
 
 /**
  * The number of elements in the application.
@@ -90,7 +90,7 @@
  * @warning If the application is to support multiple _instances_ of the _same_ model, they cannot
  * belong in the same element and a separate element is needed for the new instance.
  */
-#define ACCESS_ELEMENT_COUNT (1)
+#define ACCESS_ELEMENT_COUNT (2)
 
 /**
  * The number of allocated subscription lists for the application.
diff --git a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c 
b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c
index 1048083..dabafd7 100644
--- a/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c
+++ b/Tools/nrf5_SDK_for_Mesh_v2.0.1_src/examples/light_switch/server/src/main.c
@@ -57,12 +57,17 @@
 #define RTT_INPUT_POLL_PERIOD_MS (100)
 #define LED_PIN_NUMBER           (BSP_LED_0)
 #define LED_PIN_MASK             (1u &amp;lt;&amp;lt; LED_PIN_NUMBER)
+#define LED_PIN_NUMBER_1           (BSP_LED_1)
+#define LED_PIN_MASK_1             (1u &amp;lt;&amp;lt; LED_PIN_NUMBER_1)
+
 #define LED_BLINK_INTERVAL_MS    (200)
 #define LED_BLINK_CNT_START      (2)
 #define LED_BLINK_CNT_RESET      (3)
 #define LED_BLINK_CNT_PROV       (4)
 
 static simple_on_off_server_t m_server;
+static simple_on_off_server_t m_server1;
+
 static bool                   m_device_provisioned;
 
 static void provisioning_complete_cb(void)
@@ -89,6 +94,21 @@ static bool on_off_server_set_cb(const simple_on_off_server_t * p_server, bool v
     return value;
 }
 
+
+static bool on_off_server_get_cb_1(const simple_on_off_server_t * p_server)
+{
+    return hal_led_pin_get(LED_PIN_NUMBER);
+}
+
+static bool on_off_server_set_cb_1(const simple_on_off_server_t * p_server, bool value)
+{
+    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Got SET command to %u\n&amp;quot;, value);
+    hal_led_pin_set(LED_PIN_NUMBER, value);
+    return value;
+}
+
+
+
 static void node_reset(void)
 {
     __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- Node reset  -----\n&amp;quot;);
@@ -122,6 +142,16 @@ static void button_event_handler(uint32_t button_number)
             break;
         }
 
+        case 1:
+        {
+            uint8_t value = !hal_led_pin_get(LED_PIN_NUMBER_1);
+            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;User action \n&amp;quot;);
+            hal_led_pin_set(LED_PIN_NUMBER_1, value);
+            (void)simple_on_off_server_status_publish(&amp;amp;m_server1, value);
+            break;
+        }
+
+
         /* Initiate node reset */
         case 3:
         {
@@ -151,7 +181,10 @@ static void models_init_cb(void)
     m_server.get_cb = on_off_server_get_cb;
     m_server.set_cb = on_off_server_set_cb;
     ERROR_CHECK(simple_on_off_server_init(&amp;amp;m_server, 0));
-    ERROR_CHECK(access_model_subscription_list_alloc(m_server.model_handle));
+
+    m_server1.get_cb = on_off_server_get_cb_1;
+    m_server1.set_cb = on_off_server_set_cb_1;
+    ERROR_CHECK(simple_on_off_server_init(&amp;amp;m_server1, 1));
 }
 
 static void mesh_init(void)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>