cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32WB] [Zigbee] Node name

LeoGrany
Associate II

Hello,

I have ran and modified few examples of applications for Zigbee on Nucleo STM32WB.

I have registered my STM32WB as a node of my existing Zigbee network and it works fine.

My coordinator indicates me that the Zigbee model of the node is "STM32WB".

I guess it is the node that somehow annonced his model. Is it possible to change this model name to put a custom name instead?

0693W000007YzWJQA0.png 

Thank you for your answer,

Best regards,

Léo

PS: is there a complete documentation of the API/stack available where I can find that kind of information?

1 ACCEPTED SOLUTION

Accepted Solutions
Remi QUINTIN
ST Employee

The Zigbee_OnOff_Server_Coord application has been updated to show how to handle the model name.

With this example, the manufacturer name is updated and retrieved via a ZbZclReadReq(..) request.

When launching this application (=> using the new app_zigbee.c file in attachment) , the traces shows that the manufacturer name has been correctly updated.

Be careful that the call to the function ZbZclBasicServerConfigDefaults must be done after calling ZbInit() and before creating any ZCL endpoints as it is explained in the description of this function.

Regarding your code, you used the raw memcpy function without adding string length on first byte.    

memcpy(defaultCustom.mfr_name,  "Granyy",  sizeof("Granyy")-1);

The right format is the one used in the example.

The first parameter (‘5’ in the example) must be equal to the length of the string (Hello)

  •    {5, 'H', 'E', 'L', 'L', 'O'}, /* ZCL_BASIC_ATTR_MFR_NAME */

Hope this helps.

View solution in original post

6 REPLIES 6
LeoGrany
Associate II

Hello,

I have made some progress on the matter. �?�?

I have found this structure in zigbee.h to change all the settings I want, including model name:

struct ZbZclBasicServerDefaults {
    uint8_t app_version; /**< ZCL_BASIC_ATTR_APP_VERSION */
    uint8_t stack_version; /**< ZCL_BASIC_ATTR_STACK_VERSION */
    uint8_t hw_version; /**< ZCL_BASIC_ATTR_HARDWARE_VERSION */
    uint8_t mfr_name[ZCL_BASIC_MANUFACTURER_NAME_LENGTH + 1U]; /**< ZCL_BASIC_ATTR_MFR_NAME (First byte length) */
    uint8_t model_name[ZCL_BASIC_MODEL_IDENTIFIER_LENGTH + 1U]; /**< ZCL_BASIC_ATTR_MODEL_NAME (First byte length) */
    uint8_t date_code[ZCL_BASIC_DATE_CODE_LENGTH + 1U]; /**< ZCL_BASIC_ATTR_DATE_CODE (First byte length) */
    uint8_t power_source; /**< ZCL_BASIC_ATTR_POWER_SOURCE (e.g. ZCL_BASIC_POWER_UNKNOWN) */
    uint8_t sw_build_id[ZCL_BASIC_SW_BUILD_ID_LENGTH + 1U]; /**< ZCL_BASIC_ATTR_SW_BUILD_ID (First byte length) */
};

I have tried to use it in app_zigbee.c as following:

static void APP_ZIGBEE_StackLayersInit(void)
{
  APP_DBG("APP_ZIGBEE_StackLayersInit");
 
  zigbee_app_info.zb = ZbInit(0U, NULL, NULL);
  assert(zigbee_app_info.zb != NULL);
 
  defaultCustom.app_version = 0;
  defaultCustom.stack_version = 10;
  defaultCustom.hw_version = 0;
  memcpy(defaultCustom.mfr_name,  "Granyy",  sizeof("Granyy")-1);
  memcpy(defaultCustom.model_name, "TEMP1234", sizeof("TEMP1234")-1);
  memcpy(defaultCustom.date_code, "26020221", sizeof("26022021")-1);
  defaultCustom.power_source = ZCL_BASIC_POWER_BATTERY;
  memcpy(defaultCustom.sw_build_id, "26020221", sizeof("26022021")-1);
  ZbZclBasicServerConfigDefaults(zigbee_app_info.zb, &defaultCustom);
  /* Create the endpoint and cluster(s) */
  APP_ZIGBEE_ConfigEndpoints();
 
/* ... */
}

Now my coordinator does not recognize or display model name as wanted. It seems to be empty (' ' ).

I have noticed that there is a function called: zb_hex_str_to_bin. I have tried to call it to transform my strings in Zigbee readable data (maybe I need to do that?). The function does not seem to be defined so I got a build error.

Can you help me? How can I use this structure properly?

@Remi QUINTIN

Thank you for your support,

Best,

Léo 

Remi QUINTIN
ST Employee

The Zigbee_OnOff_Server_Coord application has been updated to show how to handle the model name.

With this example, the manufacturer name is updated and retrieved via a ZbZclReadReq(..) request.

When launching this application (=> using the new app_zigbee.c file in attachment) , the traces shows that the manufacturer name has been correctly updated.

Be careful that the call to the function ZbZclBasicServerConfigDefaults must be done after calling ZbInit() and before creating any ZCL endpoints as it is explained in the description of this function.

Regarding your code, you used the raw memcpy function without adding string length on first byte.    

memcpy(defaultCustom.mfr_name,  "Granyy",  sizeof("Granyy")-1);

The right format is the one used in the example.

The first parameter (‘5’ in the example) must be equal to the length of the string (Hello)

  •    {5, 'H', 'E', 'L', 'L', 'O'}, /* ZCL_BASIC_ATTR_MFR_NAME */

Hope this helps.

Hello,

Thank you for your answer!

It works!

Léo

APyle.1
Associate

Hello everyone.

I'm trying to reproduce LeoGrany's idea to change default model and manufacturername.

But my coordinator register my device as STM32WB model.

@Remi QUINTIN​ wrote about app_zigbee.c file attachment. But in this topic there is no attachment.

Can anybody help me with a working example?

Managed to solve this issue using ZbZclBasicWriteDirect.

No more questions, thx.

AAnis.1
Associate II

Hello @Remi QUINTIN​  , @APyle.1​ , @Léo Granier​ 

I'm facing the exact same issue , i don't find any attached file app_zigbee.c , and i checked Zigbee_OnOff_Server_Coord example on the latest Github repo , there no example on how to handle the model name.

could you help please ?

Thank you