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

Mesh 2.2.0 Light Switch Example combine the address

Hi,

In the Light Switch Example, on-off instruction was send to either even or odd address, may I know how can I cancel this action so that I can send the on-off instruction to both even and odd address.

I attempted to modify the provisioner by remove the NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT2, however it doesn't work. 

May you give the guideline on how can I modify this? Thank you.

  • Hi,

    Very sorry for the delayed response. If you take a look at Mesh SDK v2.1.1, you can see in the switch cases NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT1 to NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT4 that the publication addresses are set for the client models (i.e. the buttons on the client dev kit) in the node_setup.c file of the provisioner example. In the documentation for the light switch example in Mesh SDK v2.1.1, you can see this line: "The provisioner configures Button 1 on the client board to control the first server, Button 2 to control the second server, Button 3 to control the servers with Odd addresses, and Button 4 to control the servers with Even addresses."

    As you can see from the four client switch cases, this is exactly what happens in the client_pub_state_set() function. The reason I am mentioning an older mesh sdk is that they clearly defined the odd & even addresses there.

    In the latest mesh sdk v2.2.0, the provisioner only sets up two client models (instead of 4 in mesh sdk v2.1.1). Also beware that the v2.1.1 uses the simple on off model, a proprietary model developed by Nordic, whereas v2.2.0 uses the generic on off model.

    See the NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT1 & NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT2 cases. The first client model is set to the odd group address & the second is set to the even group address.

    In the NODE_SETUP_CONFIG_SUBSCRIPTION_ONOFF_SERVER case in node_setup.c of the provisioner (mesh sdk v2.2.0), you can change these lines (or comment out this block):

                if (m_current_node_addr % 0x02)
                {
                    address.value  = GROUP_ADDRESS_ODD;
                }
                else
                {
                    address.value  = GROUP_ADDRESS_EVEN;
                }
    

    to address.value = GROUP_ADDRESS_EVEN;

    Then, looking at the light switch client example (v2.2.0), specifically the button_event_handler() function, you can see that pressing buttons 1 & 3 sends the APP_STATE_ON command, whereas pressing buttons 2 &4 sends the APP_STATE_OFF command. 

    The generic on off client #2 is set to the even group address from the provisioner. Therefore, pressing buttons 3 or 4 should set an unacknowledged (i.e. no response from server) message to the even group addresses to turn them on or off. However, since we commented out the code snippet, this should turn all of the provisioned servers on or off.

    I have tested this myself & it works very well. Could you please try that out & see if it works for you too?

    Kind Regards,

    Bjørn

  • Great to hear! Would you mind upvoting the answer if you thought it was good?

Related