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

How to use Power Config Cluster

Hello Nordic!

I want to control the battery level, and set alarms... I know that there is a cluster callled PowerConfig cluster and I have been reading it, but I acan't figure out how declare it.

I have the following code (it is written in Spanish, sorry):

typedef  struct contexto_alimentacion_s
{
    zb_uint8_t battery_voltage; // Atributo 3.3.2.2.3.1
    zb_uint8_t battery_size; // Atributo 3.3.2.2.4.2
    zb_uint8_t battery_quantity; // Atributo 3.3.2.2.4.4
    zb_uint8_t battery_rated_voltage; // Atributo 3.3.2.2.4.5
    zb_uint8_t battery_alarm_mask; // Atributo 3.3.2.2.4.6
    zb_uint8_t battery_voltage_min_threshold; // Atributo 3.3.2.2.4.7
} contexto_alimentacion_t;

static contexto_alimentacion_t contexto_alimentacion;

ZB_ZCL_DECLARE_POWER_CONFIG_ATTRIB_LIST(lista_atributos_alimentacion,
                                        &contexto_alimentacion.battery_voltage,
                                        &contexto_alimentacion.battery_size,
                                        &contexto_alimentacion.battery_quantity,
                                        &contexto_alimentacion.battery_rated_voltage,
                                        &contexto_alimentacion.battery_alarm_mask,
                                        &contexto_alimentacion.battery_voltage_min_threshold);

This is part of a bigger code which is using doorlock cluster too. Ithink that I have to use what is asked in this older post, am I right?

Anyway, can someone point me in the right direcction? Where can I find some examples of the Power Config cluster?

Thank you very much!

Parents
  • Hello Mazis, 

    I have already made it work --> the attribute value can be written without an error. (There was something bad in my SDK, I had to redownload it and put my project in fresh SDK and just change those few files)

    So now, I am trying to receive the attribute reports with zigbee CLI coordinator on my second DK.

    I can bind, but I can't subscribe to the power config battery remaining attribute.

    I also tried adding the power config to the multi_sensor example, and I can easily bind and subscribe to the other 2 attributes (pressure and temperature measurement), but I can't subscribe to battery reamining percentage.

    I get this error (which corresponding to ZCL documentation means FAILURE):

    the other 2 attributes from the device can be received easily. 

    here is the multi_sensor project:

    7711.multi_sensor_with_power_config.zip

    the only file I modified is the zb_multi_sensor.h

    Could you look at this if you have some spare time? Thanks!

    also: 1) the cluster num should be correct, I had to change it otherwise I couln't have seen the Power Config (0x0001) cluster in cluster list in CLI coordinator

    2)Yes, I use same macro as you (the EXT one)

    3)Yep, I think that is weird. I tried using the WINDOW_COVERING_CLUSTER ID but again, I coulnd't have seen Power Config cluster in CLI coordinator cluster list request

    4) So now I somewhat fixed the error when setting the zb_zcl_set_attr_val(), but I still can't subscribe to the attribute.

    Thank you very much Mazis!

    Best regards,

    Krystof Vydra

Reply
  • Hello Mazis, 

    I have already made it work --> the attribute value can be written without an error. (There was something bad in my SDK, I had to redownload it and put my project in fresh SDK and just change those few files)

    So now, I am trying to receive the attribute reports with zigbee CLI coordinator on my second DK.

    I can bind, but I can't subscribe to the power config battery remaining attribute.

    I also tried adding the power config to the multi_sensor example, and I can easily bind and subscribe to the other 2 attributes (pressure and temperature measurement), but I can't subscribe to battery reamining percentage.

    I get this error (which corresponding to ZCL documentation means FAILURE):

    the other 2 attributes from the device can be received easily. 

    here is the multi_sensor project:

    7711.multi_sensor_with_power_config.zip

    the only file I modified is the zb_multi_sensor.h

    Could you look at this if you have some spare time? Thanks!

    also: 1) the cluster num should be correct, I had to change it otherwise I couln't have seen the Power Config (0x0001) cluster in cluster list in CLI coordinator

    2)Yes, I use same macro as you (the EXT one)

    3)Yep, I think that is weird. I tried using the WINDOW_COVERING_CLUSTER ID but again, I coulnd't have seen Power Config cluster in CLI coordinator cluster list request

    4) So now I somewhat fixed the error when setting the zb_zcl_set_attr_val(), but I still can't subscribe to the attribute.

    Thank you very much Mazis!

    Best regards,

    Krystof Vydra

Children
No Data
Related