Bluetooth mesh sensor client example gives different outputs in different mobile devices

Hello

I tried bluetooth mesh sensor server and client example, everything is good including provisioning process in mobile but the output is different with different mobiles. i have 2 mobiles where i tested in both mobiles i get output of this part as shown in picture-1

picture-1

and

picture-2

and from the picture-2 of code except chip temperature i can see other printk functions in output.

I tried this in my colleague mobile in that i can see picture-2 outputs but not picture-1 output.

I am really confused, why this happens? Can anyone help me as soon as possible please...

Regards

SaSu

Parents
  • Hi,

    1. Which devices did you use for the sensor server and client samples?
    2. Could you add the output you see on your mobiles as well? 
    3. Are there any differences between the mobiles? Different OS'?

    Kind regards,
    Andreas

  • Hello

    Sorry for late response. 1. For sensor_server thingy:53 with nRF5340DK and for sensor_client nRF52840DK

    2. From my colleague mobile i dont have screenshot also he is not available now its android and output comes from picture-2 i.e "chip temperature is .. ", "presence detected" and so on. I have two mobiles one is android and other is IOS so in both i could not see "chip temperature" output line its directly jumping to picture-1 i.e "Relative runtime in 0 to 30 degrees : 0.0000 percent" and also i can see presence detected lines when i press button on thingy-53.

    3. Already answered in point 2

    Regards

  • Ok, so I see that you have the callback function in you sensor_client:

    static void sensor_cli_data_cb(struct bt_mesh_sensor_cli *cli,
    			       struct bt_mesh_msg_ctx *ctx,
    			       const struct bt_mesh_sensor_type *sensor,
    			       const struct sensor_value *value)
    {
    	if (sensor->id == bt_mesh_sensor_present_dev_op_temp.id) {
    		printk("Chip temperature: %s\n",
    		       bt_mesh_sensor_ch_str_real(value));
    	} else if (sensor->id == bt_mesh_sensor_presence_detected.id) {
    		if (value->val1) {
    			printk("Precense detected\n");
    		} else {
    			printk("End of presence\n");
    		}
    	} else if (sensor->id ==
    		   bt_mesh_sensor_time_since_presence_detected.id) {
    		if (value->val1) {
    			printk("%s second(s) since last presence detected\n",
    			       bt_mesh_sensor_ch_str_real(value));
    		} else {
    			printk("No presence detected, or under 1 second since presence detected\n");
    		}
    	}
    }

    If you set a breakpoint inside sensor_cli_data_cb, is this ever triggered?

    And if it does, is sensor->id equal to bt_mesh_sensor_present_dev_op_temp.id?

    BR,
    Edvin

  • It is triggering and sensor->id is not equal to bt_mesh_sensor_present_dev_op_temp.id.

    Here are the screenshots for that. And i want the bt_mesh_sensor_present_dev_op_temp.id same as sensor->id. What should i do?

    Regards

  • Ok, so the issue is not that printk() is not working. The issue is that it never enters the condition:

    else if (sensor->id == bt_mesh_sensor_presence_detected.id)

    I am not that familiar with the sensor_cli API. But apparently, you are triggering the callback with sensor->id == bt_mesh_sensor_time_since_presence_detected.id. How do you trigger this?

  • sensor->id == bt_mesh_sensor_time_since_presence_detected.id this is triggering when button is pressed on thingy-53. I need the solution for my problem (i.e., bt_mesh_sensor_present_dev_op_temp.id should be same as sensor->id). I am really waiting for the answer, its been so many days i posted this and its really very important to me.

    Thank You and Regards

  • Hello SaSu,

    Remember that I don't know much about your application. What is the application flow from when you press the button on the thingy until the callback is triggered? Is it the same thingy that is running the application that produced the logs that you sent? Or does the Thingy send some message over Mesh to the device that printed the logs?

Reply
  • Hello SaSu,

    Remember that I don't know much about your application. What is the application flow from when you press the button on the thingy until the callback is triggered? Is it the same thingy that is running the application that produced the logs that you sent? Or does the Thingy send some message over Mesh to the device that printed the logs?

Children
  • It is the same thingy that sending the logs(eg: 4 seconds since presence detected when i pressed button on thingy)

    FYI: Since you told you have no idea about my application it is the sample mesh program which is in nordic developer website(Mesh_Sensor and Mesh_Client) and i did not change anything also followed the same steps for provisioning process in the app too.

  • Hello,

    If you program the default, unmodified example to a DK, without provissioning it, What does the log look like? Mine looks like this:

    Is that not the case for you?

    I know it says that it is getting an error, but that is only because it is not provisioned that it returns:

    #define EADDRNOTAVAIL 125 /**< Can't assign requested address */

    Best regards,

    Edvin

  • Hi

    I am getting like this.

    So, what should i do now?

    Regards

  • Hello Edvin

    I am still waiting for your reply for the next step as i already told its very important to me. Hope you understand.

    Thank You

    Regards

  • Hello,

    I understand, but I am missing quite a few steps of understanding. What happens between you pressing the button on the thingy and you end up in the sensor_cli_data_cb()? Can you please try to set a breakpoint there to check the callstack? Where is the sensor->id being set? 

    Are you using the sample as it is descibred in the sample description? You have one node acting as a server and one as a client? The sensor_cli_data_cb() is triggered on the client, right? 

    I needed to try the sample that you are talking about, and I want to clear up a few things:

    The thingy is programmed with the sensor_server sample, not the sensor_client sample, right?

    Edvin said:
    Is it the same thingy that is running the application that produced the logs that you sent? Or does the Thingy send some message over Mesh to the device that printed the logs?
    SaSu said:
    It is the same thingy that sending the logs(eg: 4 seconds since presence detected when i pressed button on thingy)

    And the logs are coming from a separate device in the same network? So the callback is not a button handler. It is a callback handler from the sensor. 

    I need to leave the office now. I will be back on Monday. But you need to look into the implementation. Where in the sensor server is it triggering the message that triggers the callback in the sensor_client that prints the "presence detected" message. Because by default, it is not set up to send the temperature data. Alternatively, you can figure out how it prints the.

    65.000000 second(s) since last presence detected
    Relative runtime in 0 to 20 degrees: 0.000000 percent
    Relative runtime in 20 to 25 degrees: 0.000000 percent
    Relative runtime in 25 to 30 degrees: 100.000000 percent
    Relative runtime in 30 to 100 degrees: 0.000000 percent
    71.000000 second(s) since last presence detected
    

    Where it gathers the temperature data from. You should be able to find that. 

    Best regards,

    Edvin

Related