本帖最后由 wes58 于 2024-12-18 04:24 编辑
In function void user_init(bool isRetention) you can see this line:
bdb_defaultReportingCfg(SAMPLE_LIGHT_ENDPOINT, HA_PROFILE_ID, ZCL_CLUSTER_GEN_ON_OFF, ZCL_ATTRID_ONOFF,
0x0000, 0x003c, (u8 *)&reportableChange);
This is where reporting for on/off is registered.
You can add the code below to register reporting for level change:
bdb_defaultReportingCfg(SAMPLE_LIGHT_ENDPOINT, HA_PROFILE_ID, ZCL_CLUSTER_GEN_LEVEL_CONTROL, ZCL_ATTRID_LEVEL_CURRENT_LEVEL,
0x0000, 0x003c, (u8 *)&reportableChange);
This way, you can add reporting for any attribute that is defined in sampleLightEpCfg.c You have to ensure that the attribute is reportable - ACCESS_CONTROL_REPORTABLE
const zclAttrInfo_t level_attrTbl[] =
{
{ ZCL_ATTRID_LEVEL_CURRENT_LEVEL, ZCL_DATA_TYPE_UINT8, ACCESS_CONTROL_READ | ACCESS_CONTROL_REPORTABLE, (u8*)&g_zcl_levelAttrs.curLevel },
As far as where report is sent to - if I understand you correctly - the report will be sent to any device that is bound with this device.
You can use ZGC_TOOL to bind gateway to the sampleLight device, and bind any other device to the sampleLight device that you want to receive report.
|