Zigbee nRF5 SDK for Thread and Zigbee

Hello, devzone.

I'm developing end device on nRF52840 using nRF5_SDK_for_Thread_and_Zigbee_v4.1.0.
I've connected my device to Home Assistant(HA) and have some configuration issues,
used clusters:
zb_zcl_identify_attrs_t identify_attr;//0003
zb_zcl_basic_attrs_ext_t basic_attr;//0000
zb_zcl_on_off_attrs_ext_t on_off_attr;//0006
zb_zcl_scenes_attrs_t scenes_attr;//0005
zb_zcl_groups_attrs_t groups_attr;//0004
zb_zcl_power_config_attr_t power_attr;//0001

it's based on zb_ha_on_off_output but i've added power config.
I have problem of HA see that my device is powered from DC source, in HA i can see and get all attributes of all clusters: basic_attr_cluster.power_source is battery source and power_config have all attributes configured based on specification minimal.
From connection log:
[0xdda9] Got Node Descriptor: NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered: 140>, manufacturer_code=4660, maximum_buffer_size=108, maximum_incoming_transfer_size=127, server_mask=11264, maximum_outgoing_transfer_size=127, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=False, *is_security_capable=False)
and there is *is_mains_powered=True but must be False.
So the question is:
- Where can i find configuration of Node Descriptor response?
- Where is full list of aviable configurations for SDK i'm using?
- Or it's HA send me wrong request?(posted simmilar question on HA forum)

I will be very grateful for any help. 

  • Hi,

    The mac_capability_flags, where the "mains powered" flag is set is part of the zb_af_node_desc_s/zb_zdo_node_desc_resp_s struct. I could not find this used anywhere in the examples in the SDK, but there is some sample code on this page, but this seems related to requesting the node descriptor from another node: zb_zdo_node_desc_req().

    I have asked our Zigbee developers what is the proper way to configure this, but I have not received any feedback yet. I will get back to you once I receive some updated information from them.

    Best regards,
    Jørgen

  • Hi,

    According to our developers, the node descriptor flags will be set according to the RX_ON_WHEN_IDLE configuration, before initialization of the ZBOSS stack. If this is set to false, the node descriptor should set the mains powered flag to false.

    It looks like your log reports "is_receiver_on_when_idle=True". Is is correct that you want to have a battery powered device with receiver on when idle? If not, in what order do you do the configurations in your application?

    There is no public API to set the node descriptor configuration directly.

    Best regards,
    Jørgen

  • int main(void)
    {
    zb_ret_t zb_err_code;
    zb_ieee_addr_t ieee_addr;
    
    /* Initialize timers, loging system and GPIOs. */
    timers_init();
    
    leds_buttons_init();
    
    /* Set Zigbee stack logging level and traffic dump subsystem. */
    ZB_SET_TRACE_LEVEL(ZIGBEE_TRACE_LEVEL);
    ZB_SET_TRACE_MASK(ZIGBEE_TRACE_MASK);
    ZB_SET_TRAF_DUMP_OFF();
    
    /* Initialize Zigbee stack. */
    ZB_INIT("switch");
    
    /* Set device address to the value read from FICR registers. */
    zb_osif_get_ieee_eui64(ieee_addr);
    zb_set_long_address(ieee_addr);
    
    zb_set_network_ed_role(IEEE_CHANNEL_MASK);
    zigbee_erase_persistent_storage(ERASE_PERSISTENT_CONFIG);
    zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(3000));
    zb_set_rx_on_when_idle(ZB_FALSE);
    
    /* Initialize application context structure. */
    UNUSED_RETURN_VALUE(ZB_MEMSET(&m_dev_ctx, 0, sizeof(m_dev_ctx)));
    
    ZB_ZCL_REGISTER_DEVICE_CB(zcl_device_cb);
    
    /* Register dimmer switch device context (endpoints). */
    ZB_AF_REGISTER_DEVICE_CTX(&on_off_output_ctx);
    
    valve_clusters_attr_init();
    /** Start Zigbee Stack. */
    zb_err_code = zboss_start_no_autostart();
    ZB_ERROR_CHECK(zb_err_code);
    
    while(1)
    {
    zboss_main_loop_iteration();
    UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
    }
    }

    This is slightly modified main from nRF_SDK examples that I'm using.
    In my config zb_set_rx_on_when_idle(ZB_FALSE); and as mentioned "node descriptor flags will be set according to the RX_ON_WHEN_IDLE", but still I recive node descriptor = 140(AllocateAddress|RxOnWhenIdle|MainsPowered), if I change zb_set_rx_on_when_idle(ZB_TRUE) it doesn't change node descriptor response.

    Now I'm trying to find the answer in zigpy which is used by HA. But didn't find anything suspicious, it looks like the node descriptor is 0 by default and is updated according to the response received, so it's my device sends that it is mains powered.


  • Hi,

    Did you manage to resolve this issue, or do you need more help from our side?

    Best regards,
    Jørgen

Related