Skip to content

Commit

Permalink
Merge PR #69: More debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed Nov 27, 2023
2 parents 894dddd + d34d9ab commit 144efd9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions common/zigbeeintegrationplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ void ZigbeeIntegrationPlugin::configureElectricalMeasurementInputClusterAttribut
}
electricalMeasurementCluster->readFormatting();

qCDebug(m_dc) << "Configuring attribute reporting for Electrical Measurement input cluster on" << endpoint->endpointId();

ZigbeeClusterLibrary::AttributeReportingConfiguration acTotalPowerConfig;
acTotalPowerConfig.attributeId = ZigbeeClusterElectricalMeasurement::AttributeACPhaseAMeasurementActivePower;
acTotalPowerConfig.dataType = Zigbee::Int16;
Expand All @@ -387,7 +389,7 @@ void ZigbeeIntegrationPlugin::configureElectricalMeasurementInputClusterAttribut
if (reportingReply->error() != ZigbeeClusterReply::ErrorNoError) {
qCWarning(m_dc) << "Failed to configure electrical measurement cluster attribute reporting" << reportingReply->error();
} else {
qCDebug(m_dc) << "Enabled attribute reporting successfully";
qCDebug(m_dc) << "Attribute reporting enabled successfully for electrical measurement cluster";
}
});
}
Expand All @@ -401,24 +403,28 @@ void ZigbeeIntegrationPlugin::configureMeteringInputClusterAttributeReporting(Zi
}
meteringCluster->readFormatting();

qCDebug(m_dc) << "Configuring attribute reporting for Metering input cluster on" << endpoint->endpointId();

ZigbeeClusterLibrary::AttributeReportingConfiguration instantaneousDemandConfig;
instantaneousDemandConfig.attributeId = ZigbeeClusterMetering::AttributeInstantaneousDemand;
instantaneousDemandConfig.dataType = Zigbee::Int24;
instantaneousDemandConfig.minReportingInterval = 1; // We want currentPower asap
instantaneousDemandConfig.maxReportingInterval = 120;
instantaneousDemandConfig.reportableChange = ZigbeeDataType(static_cast<quint8>(1)).data();
instantaneousDemandConfig.reportableChange = ZigbeeDataType(1, Zigbee::Int24).data();

ZigbeeClusterLibrary::AttributeReportingConfiguration currentSummationConfig;
currentSummationConfig.attributeId = ZigbeeClusterMetering::AttributeCurrentSummationDelivered;
currentSummationConfig.dataType = Zigbee::Uint48;
currentSummationConfig.minReportingInterval = 5;
currentSummationConfig.maxReportingInterval = 120;
currentSummationConfig.reportableChange = ZigbeeDataType(static_cast<quint8>(1)).data();
currentSummationConfig.reportableChange = ZigbeeDataType(1, Zigbee::Uint48).data();

ZigbeeClusterReply *reportingReply = meteringCluster->configureReporting({instantaneousDemandConfig, currentSummationConfig});
connect(reportingReply, &ZigbeeClusterReply::finished, this, [=](){
if (reportingReply->error() != ZigbeeClusterReply::ErrorNoError) {
qCWarning(m_dc) << "Failed to configure metering cluster attribute reporting" << reportingReply->error();
} else {
qCDebug(m_dc) << "Attribute reporting enabled successfully for metering cluster";
}
});

Expand Down Expand Up @@ -1142,6 +1148,7 @@ void ZigbeeIntegrationPlugin::connectToOtaOutputCluster(Thing *thing, ZigbeeNode
connect(otaCluster, &ZigbeeClusterOta::imageBlockRequestReceived, thing, [this, thing, otaCluster](quint8 transactionSequenceNumber, quint16 manufacturerCode, quint16 imageType, quint32 fileVersion, quint32 fileOffset, quint8 maximumDataSize, const ZigbeeAddress &requestNodeAddress, quint16 minimumBlockPeriod){
Q_UNUSED(requestNodeAddress)
Q_UNUSED(minimumBlockPeriod)
qCDebug(m_dc) << "Image block request received from" << thing->name() << "TSN:" << transactionSequenceNumber << "NamufacturerCode:" << manufacturerCode << "FileVersion:" << fileVersion << "Offset:" << fileOffset << "MaxSize:" << maximumDataSize;
if (!m_enabledFirmwareUpdates.contains(thing)) {
// If nymea restarted during the process, or the upgrade process has been cancelled in some other way, let's cancel the OTA.
qCDebug(m_dc) << "Device requested an image block but update is not enabled for" << thing->name();
Expand Down

0 comments on commit 144efd9

Please sign in to comment.