Zigbee improved Aqara plug support and completed cluster 0x0702

This commit is contained in:
Stephan Hadinger 2022-11-14 22:46:08 +01:00
parent 2398fd8714
commit d2d384dc72
5 changed files with 653 additions and 563 deletions

View File

@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
- ESP32 Framework (Core) from v2.0.5.2 to v2.0.5.3 (#17034)
- TuyaMcu rewrite by btsimonh (#17051)
- WS2812 sends signal to only ``Pixels`` leds instead of sending to 512 leds (#17055)
- Zigbee improved Aqara plug support and completed cluster 0x0702
### Fixed
- SenseAir S8 module detection (#17033)

File diff suppressed because it is too large Load Diff

View File

@ -1129,7 +1129,35 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint8, Cx0500, 0xFFF0 + ZA_GlassBreak, Z_(GlassBreak),Cm1, 0 },
// Metering (Smart Energy) cluster
{ Zuint48, Cx0702, 0x0000, Z_(EnergyTotal), Cm1, 0 },
{ Zuint48, Cx0702, 0x0000, Z_(CurrentSummationDelivered),Cm1, 0 },
{ Zuint48, Cx0702, 0x0001, Z_(CurrentSummationReceived),Cm1, 0 },
{ Zuint48, Cx0702, 0x0002, Z_(CurrentMaxDemandDelivered),Cm1, 0 },
{ Zuint48, Cx0702, 0x0003, Z_(CurrentMaxDemandReceived),Cm1, 0 },
{ Zuint48, Cx0702, 0x0004, Z_(DFTSummation), Cm1, 0 },
{ Zuint16, Cx0702, 0x0005, Z_(DailyFreezeTime), Cm1, 0 },
{ Zint8, Cx0702, 0x0006, Z_(PowerFactor), Cm1, 0 },
{ ZUTC, Cx0702, 0x0007, Z_(ReadingSnapShotTime), Cm1, 0 },
{ ZUTC, Cx0702, 0x0008, Z_(CurrentMaxDemandDeliveredTime),Cm1, 0 },
{ ZUTC, Cx0702, 0x0009, Z_(CurrentMaxDemandReceivedTime),Cm1, 0 },
{ Zuint8, Cx0702, 0x000A, Z_(DefaultUpdatePeriod), Cm1, 0 },
{ Zuint8, Cx0702, 0x000B, Z_(FastPollUpdatePeriod), Cm1, 0 },
{ Zuint48, Cx0702, 0x000C, Z_(CurrentBlockPeriodConsumptionDelivered),Cm1, 0 },
{ Zuint24, Cx0702, 0x000D, Z_(DailyConsumptionTarget),Cm1, 0 },
{ Zenum8, Cx0702, 0x000E, Z_(CurrentBlock), Cm1, 0 },
{ Zenum8, Cx0702, 0x000F, Z_(ProfileIntervalPeriod),Cm1, 0 },
{ Zuint16, Cx0702, 0x0010, Z_(IntervalReadReportingPeriod),Cm1, 0 },
{ Zuint16, Cx0702, 0x0011, Z_(PresetReadingTime), Cm1, 0 },
{ Zuint16, Cx0702, 0x0012, Z_(VolumePerReport), Cm1, 0 },
{ Zuint8, Cx0702, 0x0013, Z_(FlowRestriction), Cm1, 0 },
{ Zenum8, Cx0702, 0x0014, Z_(SupplyStatus), Cm1, 0 },
{ Zuint48, Cx0702, 0x0015, Z_(CurrentInletEnergyCarrierSummation),Cm1, 0 },
{ Zuint48, Cx0702, 0x0016, Z_(CurrentOutletEnergyCarrierSummation),Cm1, 0 },
{ Zint24, Cx0702, 0x0017, Z_(InletTemperature), Cm1, 0 },
{ Zint24, Cx0702, 0x0018, Z_(OutletTemperature), Cm1, 0 },
{ Zint24, Cx0702, 0x0019, Z_(ControlTemperature), Cm1, 0 },
{ Zint24, Cx0702, 0x001A, Z_(CurrentInletEnergyCarrierDemand),Cm1, 0 },
{ Zint24, Cx0702, 0x001B, Z_(CurrentOutletEnergyCarrierDemand),Cm1, 0 },
{ Zuint48, Cx0702, 0x001C, Z_(PreviousBlockPeriodConsumptionDelivered),Cm1, 0 },
// Meter Identification cluster
{ Zstring, Cx0B01, 0x0000, Z_(CompanyName), Cm1, 0 },

View File

@ -717,20 +717,24 @@ void ZCLFrame::applySynonymAttributes(Z_attribute_list& attr_list) {
Z_attribute_synonym syn = Z_plugin_matchAttributeSynonym(device.modelId, device.manufacturerId,
attr.cluster, attr.attr_id);
if (syn.found()) {
attr.setKeyId(syn.new_cluster, syn.new_attribute);
if ((syn.multiplier != 1 && syn.multiplier != 0) || (syn.divider != 1 && syn.divider != 0) || (syn.base != 0)) {
// we need to change the value
float fval = attr.getFloat();
if (syn.multiplier != 1 && syn.multiplier != 0) {
fval = fval * syn.multiplier;
if (syn.new_attribute == 0xFFFF) { // if attr is 0xFFFF, remove attribute
attr_list.removeAttribute(&attr);
} else {
attr.setKeyId(syn.new_cluster, syn.new_attribute);
if ((syn.multiplier != 1 && syn.multiplier != 0) || (syn.divider != 1 && syn.divider != 0) || (syn.base != 0)) {
// we need to change the value
float fval = attr.getFloat();
if (syn.multiplier != 1 && syn.multiplier != 0) {
fval = fval * syn.multiplier;
}
if (syn.divider != 1 && syn.divider != 0) {
fval = fval / syn.divider;
}
if (syn.base != 0) {
fval = fval + syn.base;
}
attr.setFloat(fval);
}
if (syn.divider != 1 && syn.divider != 0) {
fval = fval / syn.divider;
}
if (syn.base != 0) {
fval = fval + syn.base;
}
attr.setFloat(fval);
}
}
}
@ -1189,9 +1193,6 @@ void ZCLFrame::syntheticAnalogValue(Z_attribute_list &attr_list, class Z_attribu
if (modelId.startsWith(F("lumi.sensor_cube"))) {
attr.setKeyId(0x000C, 0xFF55); // change to AqaraRotate
}
if (modelId.startsWith(F("lumi.plug"))) {
attr.setKeyId(0x0702, 0x0000); // change to EnergyTotal
}
if (modelId.startsWith(F("lumi.ctrl"))) {
attr.setKeyId(0x0B04, 0x050B); // change to ActivePower
}

View File

@ -0,0 +1,6 @@
#Z2Tv1
# Aqara Smart Plug EU
# https://zigbee.blakadder.com/Aqara_SP-EUC01.html
:lumi.plug.*,LUMI
0B04/050B=0B04/FFFF # ignore the original ActivePower since it returns always zero
000C/0055=0B04/050B