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

Proxy Server Publish Issue

Based on Mesh SDK 2.1.1.

I use light switch proxy client & proxy server to test server publish function.

But when I use the phone setting network, I found that the client's publish & subscribe settings, the server's publish function can be used correctly.

If the client only sets subscribe and doesn't set publish,the server's publish function can't be used.

Can I set the client's subscribe and server's publish separately to use the publish function?

client set publish & subscribeclient only set subscribe

left figure : client set publish & subscribe

right figure : client only set subscribe

Server set publish

figure : server set publish

  • Are you saying that if you set the client's generic on off model publish function to e.g. 0xC001 & set the server's generic on off model subscribe function to 0xC001, then you are able to send the status message from the server to the client by pressing Button 1 on the server? 

    I believe this is the only way to send the status message from the server to the client, as you are not publishing a message from the server to the client. You are only sending a status message telling the client what the LED 1 state is of the server.

  • No, this is simple on off model.

    I want  server publish and client subscribe.

    left figure + figure : Server publish and client subscribe => OK

    right figure + figure : Server publish and client subscribe => Not OK

  • I am pretty sure the reason that left figure + figure works is because the client publishes to the unicast address of the simple on off server (0x0004). Then, you are able to send status updates from the server to the client. Could you test & just try to make the client publishes to the simple on off server address? Please test without publishing & subscribing to the group addresses 0xC100 & 0xC200. Does that procedure work?

  • Why U say test & try to make client publish to the server address?

    I have already test client publish to the unicast address of the server node,and client publish to the group address of the server node,too.

    But, I want server publish to the client.

  • QK-Huang said:
    Why U say test & try to make client publish to the server address?

     Because I thought you just wanted to send a status message from the server back to the client.

    The reason the publishing from the server to the group address 0xC100 & subscribing to the group address from the client does not work is two-fold: firstly, when you press button 1 on the server, you are calling this code:

    static void button_event_handler(uint32_t button_number)
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);
        switch (button_number)
        {
            /* Pressing SW1 on the Development Kit will result in LED state to toggle and trigger
            the STATUS message to inform client about the state change. This is a demonstration of
            state change publication due to local event. */
            case 0:
            {
                uint8_t value = !hal_led_pin_get(LED_PIN_NUMBER);
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "User action \n");
                hal_led_pin_set(LED_PIN_NUMBER, value);
                (void)simple_on_off_server_status_publish(&m_server, value);
                break;
            }

    This code is only setting a server status publish, aka a status message. I am not exactly sure on this, but I believe a status message can only be sent to a unicast address. I believe the reason your scenario one worked to send the status message back to the client from the server was because the client was publishing directly to the unicast address of the server.

    In order to publish from the server to a group address & let the client subscribe to this group address, you will need to add the simple on off server model to the client & add the simple on off client model to the server. That way, both boards will act as both clients & servers.

    You can do something similar to what has been done here. I would not recommend you to use that source code directly, as it has not been tested as extensively as the mesh sdk.

    Also, if you notice that you are having issues with provisioning & configuring nodes via nRF Mesh, I would suggest you to migrate from mesh sdk v2.1.1 to mesh sdk v2.2.0. This version has more stable support for nRF Mesh. I would also make sure that you are using the latest version of nRF Mesh. We do have a migration guide here if you decide to download the mesh sdk v2.2.0 here: nrf5_SDK_for_Mesh_v2.2.0_src\doc\migration\

Related