This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How do i provision additional / alternative models in the light_switch example.

setup:

segger V4.20a

windows 10 pro

SDK: nRF5 SDK for MESH 3.2.0

hardware;

NRF52840

I am trying to implement the simple_on_off model instead of the regulat generic_on_off. 

This is being done as a proof of concept, to assure that the model in question is working, before trying to implement my own. I am aware that the purpose of the models are quite simmilar. My current implementation doesn't change the provisioner or any config files, other than adding the simple_on_off source files and modifying the main function.

These are some notable changes:

const simple_on_off_client_t m_on_off_client =
{
    .status_cb = app_on_off_client_status_cb,
    .timeout_cb = app_timeout_cb
};


//-------------------------------------------------------------------------
static void models_init_cb(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing and adding models\n");

    for (uint32_t i = 0; i < CLIENT_MODEL_INSTANCE_COUNT; ++i)
    {
    
      m_clients[i]=m_on_off_client;
      
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "added client: %d\n",i);
        ERROR_CHECK(simple_on_off_client_init(&m_clients[i], i + 1));
    }
}

//--------------------------------------------------------------------------

Apart from that i've ofcourse defined the cb functions, and made some other button configurations, but i doubt that's relevant.

My question is which modifications and considerations i'll need to make in order to provision.

Parents Reply Children
  • Hi Joakim

    I have already tried following the provided guide, but unfortunately to no help. As i am already using the simple_on_off models, i figure that the models should be intact, all the functions mentioned in " Creating new models" are already called.

    The modifications i've made to the simple_on_off model is changing the server and client model ID's to be the same as the generic_on _off (keep in mind that the generic_on_off model isn't implemented simultaneously). i also kept the generic_on_off  URI. I did all this under the preconception that the provisioner, wouldn't need to be changed.

    I however end up getting an error from my provisioner.

    i am guessing that the error is related with some expectations coming from the provisioner not being met by the client_model, but i can't figure out which.

  • I solved the error at hand:

    The error code was 2 (type access_status_t) meaning

    "The provided Model index is not valid in this Element."  My mistake was not defining the proper company_ID in node_setup.c, i fixed it by changing the value to "ACCESS_COMPANY_ID_NORDIC"

    but now i have a different error:

    <t:    6903896>, node_setup.c,  267, opcode status field: 1 

    "The provided value is not a valid address in this context."

    I haven't figured out how to fix this yet.

Related