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

adding Simple_on_off Model to light_switch example and provision and configure it with provisioner example.

Hi 

  I am using Mesh SDK v4.2.0 and I want to add Simple_On_Off Model to the Light_Switch example and provision and configure it with the provisioner example.

So far I have added Simple_On_off Model to the Light_Switch example and can provision it with provisioner but it shows while configuring the model

                      node_setup.c,  282, opcode status field: 2 

 The issue is in provisioner in node_setup.c but could not solve it, need some advice.

Regards

Himanshu

Parents
  • Hi,

    The provisioner example is made specifically for the (unchanged) examples from the SDK. It uses the unique Uniform Resource Identifier (URI) from the beacon of the other examples, in order to figure out what models to expect. This means that the provisioner expects to configure generic on/of models after provisioning a light switch example. If you have changed the example, then the number and type of models may differ from what the provisioner example expects. You then have to change the provisioner example as well.

    Regards,
    Terje

  • Hi,

     Thanks for the response.

    Can you explain what are the changes needed to be made in the provisioner to provision and configure other models?

    Right now I want to provision and configure Simple_On_Off Model.

    Regards

    Himanshu

  • Hi,

    You need to look into (at least) the following files:

    • node_setup.c
    • config_scenarios.h
    • config_steps.h

    and add the code required for the devices, models and configuration steps that you need. Please note that the comment about "setup_select_steps()" in some of those files is out-dated.

    You should also consider using a new URI for your modified example. URIs are defined in example_common.h, and then you need to both change the code of the on/off node to use the new URI, and the provisioner example to connect that URI to your new configuration steps.

    Regards,
    Terje

Reply
  • Hi,

    You need to look into (at least) the following files:

    • node_setup.c
    • config_scenarios.h
    • config_steps.h

    and add the code required for the devices, models and configuration steps that you need. Please note that the comment about "setup_select_steps()" in some of those files is out-dated.

    You should also consider using a new URI for your modified example. URIs are defined in example_common.h, and then you need to both change the code of the on/off node to use the new URI, and the provisioner example to connect that URI to your new configuration steps.

    Regards,
    Terje

Children
  • Hi,

      Thanks, for the response. You have been a great help.

    I have modified the light_switch server and client to do the task. They are working fine.

    Now I want to know if we can provision and configure multiple servers to a single client using provisioner example, if yes then how?

    Regards,

    Himanshu

  • Hi,

    The configuration needed depend on the use case: What direction do the data go, what are the involved models, etc. For instance, with light bulbs / switches, the light bulb is the server (as it holds the state) and the light switch is the client (as it sends messages to and from the server, in order to change the state on the server.) Because of this, for lights and switches, the switches are configured to publish to a group address, and the lights are set to subscribe to one or more group addresses, so that each switch controls a given set of lights. Those sets can overlap, so for instance one button can turn al lights on/off, while other buttons control a few or individual lights.

    I strongly recommend using the nRF Mesh app, for getting familiar with configuration, as with that app you do the configuration manually. Then decide on the needs of a dedicated provisioner device.

    Usually in a Bluetooth mesh network, the provisioner role is performed from a smartphone or similar. The provisioner example is for demonstration and development purposes. Even if you are working on a product that needs to get configured without any user interaction, it can be a good idea to do the configuration from a smartphone. At the very least, for the provisioning process one would usually want some interaction in order to confirm that the device being provisioned is the correct one.

    Regards,
    Terje

  • Hi,

    I have just created 10 instances of client element/model on light_switch client node, the instances are created fine, checked in the debug terminal. 

    But the provisioner can only configure 3 models/elements as in the unchanged light_switch client example.

    My question is how can I configure multiple instances of clients from the provisioner.

     

    Regards,

    Himanshu

  • Hi,

    In the provisioner example, the file config_scenarios.h lists what configurations are to be performed for each scenario. For the CONFIG_SCENARIO_LIGHT_SWITCH_CLIENT_EXAMPLE scenario, CONFIG_ONOFF_CLIENT is listed twice, and so the provisioner will try to configure two generic on/off clients when it finds a light switch client. If you have added more generic on/off client models to the light switch example, then you can add more CONFIG_ONOFF_CLIENT entries in that scenario in the provisioner example.

    Note that the CONFIG_... macros are only listing steps, that will be performed by the function config_step_execute() in node_setup.c. This means those steps (the switch cases in config_step_execute()) will need an update as well, as for instance the step for configuring the on/off client uses the function server_pub_address_get() (also in node_setup.c) to figure out what address to publish to, and it has hard coded the use of two addresses: The client node is intended to have two on/off client models, which will have consecutive element addresses, and therefore if the client address is an odd number it will publish to the "odd" group, and if the client address is an even number it will publish to the "even" group. You probably have other requirements, and so you must change the existing implementation (or add a new one) that sets up the 10 client nodes with subscriptions and publications, so that they subscribe and publish to the right addresses for your scenario.

    Regards,
    Terje

  • Hi

    Thank you for your help. Now I am able to create 10 models of the client and communicate with servers on group address.

    Regards

    Himanshu

Related