This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ZBOSS Declare Power Config Attribute List for Battery: bat_num

Hi

How do pass bat_num into the declaration for the power config attribute list?  Perhaps I overlooked it, but it wasn't evident to me when reviewing the Developing with Zboss API reference.  Moreover, when I make the declaration in the typical way:

ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(power_config_attr_list,
                                                    &battery_voltage,
                                                    &battery_size,
                                                    &battery_quantity,
                                                    &battery_rated_voltage,
                                                    &battery_alarm_mask,
                                                    &battery_voltage_min_threshold,
                                                    &battery_percentage_remaining,
                                                    &battery_voltage_threshold1,
                                                    &battery_voltage_threshold2,
                                                    &battery_voltage_threshold3,
                                                    &battery_percentage_min_threshold,
                                                    &battery_percentage_threshold1,
                                                    &battery_percentage_threshold2,
                                                    &battery_percentage_threshold3,
                                                    &battery_alarm_state);

I get the error "identifier "ZB_ZCL_ATTR_POWER_CONFIG_BATTERYbat_num_VOLTAGE_ID" is undefined." 

I see that ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(...) is defined to take the pointers I assigned above, but I also see that ZB_ZCL_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(bat_num,....) includes the requirement of bat_num to be sent through.

Is passing bat_num shown or explained anywhere in the documentation?  

Thank you

Parents
  • Hello,

    I am not particularly familiar with this battery attribute. Can you please upload a project that replicates this issue, so that I can have a look?

    Best regards,

    Edvin

  • Thanks Edvin.

    I've attached the project I'm working on.  Its a simple motorized window shade that uses the Zigbee HA window covering profile and a dc motor, encoder, and encoder buffer IC.  CMAKE is set to compile with the "new_window_shade.c" source, which is where I'm attempting to implement this power config (ultimately to provide reporting on battery levels) and am receiving the errors I noted above.

    I should note, when compiling with "window_shade.c", and changing my #include statements to use "window_shade.h" rather than "new_window_shade.h", the project compiles and has worked perfectly in my test setups for a couple weeks now using either a 52840-DK, -MDK, or nrf52840 dongle, despite the code still being a bit messy at this point.

    "window_shade.c" is identical to "new_window_shade.c", with the exception of the power config profile.  "new_window_shade.h" also includes my attempt at customized attribute declarations in order to include the power config items.

    NCS version is 1.8.0

    You'll find the offending ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(...) on line 120 of new_window_shade.c

    shade_1.zip

Reply
  • Thanks Edvin.

    I've attached the project I'm working on.  Its a simple motorized window shade that uses the Zigbee HA window covering profile and a dc motor, encoder, and encoder buffer IC.  CMAKE is set to compile with the "new_window_shade.c" source, which is where I'm attempting to implement this power config (ultimately to provide reporting on battery levels) and am receiving the errors I noted above.

    I should note, when compiling with "window_shade.c", and changing my #include statements to use "window_shade.h" rather than "new_window_shade.h", the project compiles and has worked perfectly in my test setups for a couple weeks now using either a 52840-DK, -MDK, or nrf52840 dongle, despite the code still being a bit messy at this point.

    "window_shade.c" is identical to "new_window_shade.c", with the exception of the power config profile.  "new_window_shade.h" also includes my attempt at customized attribute declarations in order to include the power config items.

    NCS version is 1.8.0

    You'll find the offending ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(...) on line 120 of new_window_shade.c

    shade_1.zip

Children
  • Hello,

    I am very sorry for the late reply. I asked our Zigbee team whether or not there was a bug in ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(), since there were no reference to battery_num as an input parameter. They told me that you can work around this by defining bat_num as empty in order to declare the default set attribute. Just do so before calling ZB_ZCL_DECLARE_POWER_CONFIG_BATTERY_ATTRIB_LIST_EXT(), e.g. in the top of main.c:

    This is the snippet I got:

    /* Define 'bat_num' as empty in order to declare default battery set attributes. */
    /* According to Table 3-17 of ZCL specification, defining 'bat_num' as 2 or 3 allows */
    /* to declare battery set attributes for BATTERY2 and BATTERY3 */
    #define bat_num

    After doing this in your project, I got another error, but I believe that is from your files. A missing referance to window_covering_installed_closed_limit_lift, which I see you have set as an extern, so I guess that is defined somewhere else.

    Best regards,

    Edvin

Related