[MESH_SDK] Unable to update mesh device group after a new device provisioned

Hi,

I have setup a provisioner using the provisioner example of the mesh sdk.

I have also setup 10 nodes using the on_off example of the mesh sdk.

I have provision all my node with the provisioner and no problem. After that I have add all the nodes to a group using the following mehtod (target is the device id and group is the group id).

uint8_t set_device_group(uint16_t target, uint16_t group)
{
  access_model_id_t a_m_id;
  a_m_id.company_id = SERVER_COMPANY_IDENTIFIER;
  a_m_id.model_id = MODEL_ID_ON_OFF;

  nrf_mesh_address_t address;
  address.type = NRF_MESH_ADDRESS_TYPE_GROUP;
  address.value = group;

  if (config_client_model_subscription_add(target, address, a_m_id) == NRF_SUCCESS)
  {
    return 0;
  }
  return 1;
}

All work fine, and all my device answers to the group target commands.

I also can remove groups from devices with this function and all work fine.

uint8_t remove_device_group(uint16_t target)
{
  access_model_id_t a_m_id;
  a_m_id.company_id = SERVER_COMPANY_IDENTIFIER;
  a_m_id.model_id = HX_MODEL_CONTROL_ID;

  if (config_client_model_subscription_delete_all(target, a_m_id) == NRF_SUCCESS)
  {
    serial_group_cb(target, group, SERIAL_GROUP_DEL);
    return 0;
  }
  return 1;
}

After turn off and on my nodes, all works fine. After that, I have free (un-provisioned) a device and re-provision it. The newly provisioned devices can be add to group but the other nodes can't be remove or added to a group => in my node_setup.c (file of the provisioner example), i have an acknoledge error code 1 for the group subscription commands.

static void config_client_msg_handle(const config_client_event_t * p_event, uint16_t length)
{
    if (mp_config_step->step == NODE_SETUP_IDLE || mp_config_step->step == NODE_SETUP_DONE)
    {
        if (p_event->opcode == 0x8019)
        {
          NRF_LOG_INFO("Acknoledge for publish address change : %x", p_event->p_msg->publication_status.status);
        }
        else if (p_event->opcode == 0x801F)
        {
          NRF_LOG_INFO("Acknoledge for subscription address change : %x", p_event->p_msg->subscription_status.status);
        }
        else
        {
          NRF_LOG_INFO("Got unexpected config client message in state %u\n", mp_config_step->step);
        }
        return;
    }
    else
    {
        status_check_t status = check_expected_status(p_event->opcode, p_event->p_msg);
        if (status == STATUS_CHECK_PASS)
        {
            mp_config_step++;
            m_send_timer.count = CLIENT_BUSY_SEND_RETRY_LIMIT;

            if (mp_config_step->step == NODE_SETUP_DONE)
            {
                node_setup_succeed();
            }
            else
            {
                config_step_execute();
            }
        }
        else if (status == STATUS_CHECK_FAIL)
        {
            node_setup_fail();
        }
    }
}

The only way to modify the groups of the others nodes is to free (reset/un-provision) the other nodes and re-provision them.

But if I do that, I got the same error 1 for the group subscription action for the nodes thats has been provisioned after the on-off.

So, can you help me to understand why I can't modify the nodes group (models subscriptions) after a on-off then a device added to the network ?

Regards.


All devices is on a nrf52840 board.

All nodes running on NRF5_SDK_16 and NRF_SDK_MESH_4.2.0

The provisioner run on NRF5_SDK_17 and NRF_SDK_MESH_5.0.0

Related