Merge pull request #16268 from s-hadinger/zigbee_zbload_more

Zigbee improve plugin format and add all ZCL attributes
This commit is contained in:
s-hadinger 2022-08-20 10:17:06 +02:00 committed by GitHub
commit 0444dfe35a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 1364 additions and 429 deletions

View File

@ -113,6 +113,7 @@ public:
uint8_t key_suffix; // append a suffix to key (default is 1, explicitly output if >1)
uint8_t attr_type; // [opt] type of the attribute, default to Zunk (0xFF)
uint8_t attr_multiplier; // [opt] multiplier for attribute, defaults to 0x01 (no change)
uint16_t manuf; // manufacturer id (0 if none)
// Constructor with all defaults
Z_attribute():
@ -124,7 +125,8 @@ public:
val_str_raw(false),
key_suffix(1),
attr_type(0xFF),
attr_multiplier(1)
attr_multiplier(1),
manuf(0)
{};
Z_attribute(const Z_attribute & rhs) {

File diff suppressed because it is too large Load Diff

View File

@ -188,7 +188,8 @@ enum Cx_cluster_short {
Cx0000, Cx0001, Cx0002, Cx0003, Cx0004, Cx0005, Cx0006, Cx0007,
Cx0008, Cx0009, Cx000A, Cx000B, Cx000C, Cx000D, Cx000E, Cx000F,
Cx0010, Cx0011, Cx0012, Cx0013, Cx0014, Cx001A, Cx0020, Cx0100,
Cx0101, Cx0102, Cx0201, Cx0300, Cx0400, Cx0401, Cx0402, Cx0403,
Cx0101, Cx0102, Cx0201, Cx0202, Cx0203, Cx0204,
Cx0300, Cx0301, Cx0400, Cx0401, Cx0402, Cx0403,
Cx0404, Cx0405, Cx0406, Cx0500, Cx0702, Cx0B01, Cx0B04, Cx0B05,
CxEF00, CxFC01, CxFC40, CxFCC0, CxFCCC,
};
@ -197,7 +198,8 @@ const uint16_t Cx_cluster[] PROGMEM = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x001A, 0x0020, 0x0100,
0x0101, 0x0102, 0x0201, 0x0300, 0x0400, 0x0401, 0x0402, 0x0403,
0x0101, 0x0102, 0x0201, 0x0202, 0x0203, 0x0204,
0x0300, 0x0301, 0x0400, 0x0401, 0x0402, 0x0403,
0x0404, 0x0405, 0x0406, 0x0500, 0x0702, 0x0B01, 0x0B04, 0x0B05,
0xEF00, 0xFC01, 0xFC40, 0xFCC0, 0xFCCC,
};
@ -271,7 +273,7 @@ class Z_plugin_attribute {
public:
Z_plugin_attribute(void) :
type(Zunk), multiplier(1), cluster(0xFFFF), attribute(0xFFFF)
type(Zunk), multiplier(1), cluster(0xFFFF), attribute(0xFFFF), manuf(0)
{};
void set(uint16_t cluster, uint16_t attribute, const char *name, uint8_t type = Zunk) {
@ -285,6 +287,7 @@ public:
int8_t multiplier; // multiplier, values 0, 1, 2, 5, 10, 100, -2, -5, -10, -100,
uint16_t cluster; // cluster number
uint16_t attribute; // attribute number
uint16_t manuf; // manufacturer code, 0 if none
String name; // name of attribute once converted
};
@ -456,6 +459,7 @@ public:
int8_t multiplier = 1;
uint8_t map_offset = 0;
Z_Data_Type map_type = Z_Data_Type::Z_Unknown;
uint16_t manuf = 0x0000; // manuf code (if any)
};
Z_attribute_match Z_plugin_matchAttributeById(const char *model, const char *manufacturer, uint16_t cluster, uint16_t attribute);
@ -472,14 +476,17 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint8, Cx0000, 0x0003, Z_(HWVersion), Cm1, 0 },
{ Zstring, Cx0000, 0x0004, Z_(Manufacturer), Cm1, 0 }, // record Manufacturer
{ Zstring, Cx0000, 0x0005, Z_(ModelId), Cm1, 0 }, // record Model
// { Zstring, Cx0000, 0x0004, Z_(Manufacturer), Cm1, Z_ManufKeep, 0 }, // record Manufacturer
// { Zstring, Cx0000, 0x0005, Z_(ModelId), Cm1, Z_ModelKeep, 0 }, // record Model
{ Zstring, Cx0000, 0x0006, Z_(DateCode), Cm1, 0 },
{ Zenum8, Cx0000, 0x0007, Z_(PowerSource), Cm1, 0 },
{ Zenum8, Cx0000, 0x0008, Z_(GenericDeviceClass), Cm1, 0 },
{ Zenum8, Cx0000, 0x0009, Z_(GenericDeviceType), Cm1, 0 },
{ Zoctstr, Cx0000, 0x000A, Z_(ProductCode), Cm1, 0 },
{ Zstring, Cx0000, 0x000B, Z_(ProductURL), Cm1, 0 },
{ Zstring, Cx0000, 0x0010, Z_(LocationDescription), Cm1, 0 },
{ Zenum8, Cx0000, 0x0011, Z_(PhysicalEnvironment), Cm1, 0 },
{ Zbool, Cx0000, 0x0012, Z_(DeviceEnabled), Cm1, 0 },
{ Zmap8, Cx0000, 0x0013, Z_(AlarmMask), Cm1, 0 },
{ Zmap8, Cx0000, 0x0014, Z_(DisableLocalConfig), Cm1, 0 },
{ Zstring, Cx0000, 0x4000, Z_(SWBuildID), Cm1, 0 },
{ Zuint8, Cx0000, 0x4005, Z_(MullerLightMode), Cm1, 0 },
// Cmd 0x0A - Cluster 0x0000, attribute 0xFF01 - proprietary
@ -491,16 +498,40 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
// Power Configuration cluster
{ Zuint16, Cx0001, 0x0000, Z_(MainsVoltage), Cm1, 0 },
{ Zuint8, Cx0001, 0x0001, Z_(MainsFrequency), Cm1, 0 },
{ Zmap8, Cx0001, 0x0010, Z_(MainsAlarmMask), Cm1, 0 },
{ Zuint16, Cx0001, 0x0011, Z_(MainsVoltageMinThreshold),Cm1, 0 },
{ Zuint16, Cx0001, 0x0012, Z_(MainsVoltageMaxThreshold),Cm1, 0 },
{ Zuint16, Cx0001, 0x0013, Z_(MainsVoltageDwellTripPoint),Cm1, 0 },
{ Zuint8, Cx0001, 0x0020, Z_(BatteryVoltage), Cm_10, 0 }, // divide by 10
{ Zuint8, Cx0001, 0x0021, Z_(BatteryPercentage), Cm_2, 0 }, // divide by 2
// { Zuint8, Cx0001, 0x0021, Z_(BatteryPercentage), Cm_2, Z_BatteryPercentage, 0 }, // divide by 2
{ Zstring, Cx0001, 0x0030, Z_(BatteryManufacturer), Cm1, 0 },
{ Zenum8, Cx0001, 0x0031, Z_(BatterySize), Cm1, 0 },
{ Zuint16, Cx0001, 0x0032, Z_(BatteryAHrRating), Cm1, 0 },
{ Zuint8, Cx0001, 0x0033, Z_(BatteryQuantity), Cm1, 0 },
{ Zuint8, Cx0001, 0x0034, Z_(BatteryRatedVoltage), Cm1, 0 },
{ Zmap8, Cx0001, 0x0035, Z_(BatteryAlarmMask), Cm1, 0 },
{ Zuint8, Cx0001, 0x0036, Z_(BatteryVoltageMinThreshold), Cm1, 0 },
{ Zuint8, Cx0001, 0x0037, Z_(BatteryVoltageThreshold1), Cm1, 0 },
{ Zuint8, Cx0001, 0x0038, Z_(BatteryVoltageThreshold2), Cm1, 0 },
{ Zuint8, Cx0001, 0x0039, Z_(BatteryVoltageThreshold3), Cm1, 0 },
{ Zuint8, Cx0001, 0x003A, Z_(BatteryPercentageMinThreshold), Cm1, 0 },
{ Zuint8, Cx0001, 0x003B, Z_(BatteryPercentageThreshold1), Cm1, 0 },
{ Zuint8, Cx0001, 0x003C, Z_(BatteryPercentageThreshold2), Cm1, 0 },
{ Zuint8, Cx0001, 0x003D, Z_(BatteryPercentageThreshold3), Cm1, 0 },
{ Zmap32, Cx0001, 0x003E, Z_(BatteryAlarmState), Cm1, 0 },
// { Zuint8, Cx0001, 0x0021, Z_(BatteryPercentage), Cm_2, Z_BatteryPercentage, 0 }, // divide by 2
// Device Temperature Configuration cluster
{ Zint16, Cx0002, 0x0000, Z_(CurrentTemperature), Cm1, 0 },
{ Zint16, Cx0002, 0x0001, Z_(MinTempExperienced), Cm1, 0 },
{ Zint16, Cx0002, 0x0002, Z_(MaxTempExperienced), Cm1, 0 },
{ Zuint16, Cx0002, 0x0003, Z_(OverTempTotalDwell), Cm1, 0 },
{ Zmap8, Cx0002, 0x0010, Z_(DeviceTempAlarmMask), Cm1, 0 },
{ Zint16, Cx0002, 0x0011, Z_(LowTempThreshold), Cm1, 0 },
{ Zint16, Cx0002, 0x0012, Z_(HighTempThreshold), Cm1, 0 },
{ Zuint24, Cx0002, 0x0013, Z_(LowTempDwellTripPoint), Cm1, 0 },
{ Zuint24, Cx0002, 0x0014, Z_(HighTempDwellTripPoint), Cm1, 0 },
// Identify cluster
{ Zuint16, Cx0003, 0x0000, Z_(IdentifyTime), Cm1, 0 },
@ -512,25 +543,31 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint8, Cx0005, 0x0001, Z_(CurrentScene), Cm1, 0 },
{ Zuint16, Cx0005, 0x0002, Z_(CurrentGroup), Cm1, 0 },
{ Zbool, Cx0005, 0x0003, Z_(SceneValid), Cm1, 0 },
{ Zmap8, Cx0005, 0x0004, Z_(SceneNameSupport), Cm1, 0 },
{ ZEUI64, Cx0005, 0x0005, Z_(LastConfiguredBy), Cm1, 0 },
//{ Zmap8, Cx0005, 0x0004, (NameSupport), Cm1, 0 },
// On/off cluster
{ Zbool, Cx0006, 0x0000, Z_(Power), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_OnOff, power) },
{ Zenum8, Cx0006, 0x4003, Z_(StartUpOnOff), Cm1, 0 },
{ Zbool, Cx0006, 0x8000, Z_(Power), Cm1, 0 }, // See 7280
{ Zbool, Cx0006, 0x0000, Z_(Power), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_OnOff, power) },
{ Zenum8, Cx0006, 0x4003, Z_(StartUpOnOff), Cm1, 0 },
{ Zbool, Cx0006, 0x8000, Z_(Power), Cm1, 0 }, // See 7280
{ Zbool, Cx0006, 0x4000, Z_(OnOff), Cm1, 0 },
{ Zuint16, Cx0006, 0x4001, Z_(OnTime), Cm1, 0 },
{ Zuint16, Cx0006, 0x4002, Z_(OffWaitTime), Cm1, 0 },
// On/Off Switch Configuration cluster
{ Zenum8, Cx0007, 0x0000, Z_(SwitchType), Cm1, 0 },
{ Zenum8, Cx0007, 0x0010, Z_(SwitchActions), Cm1, 0 },
// Level Control cluster
{ Zuint8, Cx0008, 0x0000, Z_(Dimmer), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Light, dimmer) },
{ Zmap8, Cx0008, 0x000F, Z_(DimmerOptions), Cm1, 0 },
{ Zuint16, Cx0008, 0x0001, Z_(DimmerRemainingTime), Cm1, 0 },
{ Zmap8, Cx0008, 0x000F, Z_(DimmerOptions), Cm1, 0 },
{ Zuint16, Cx0008, 0x0010, Z_(OnOffTransitionTime), Cm1, 0 },
// { Zuint8, Cx0008, 0x0011, (OnLevel), Cm1, 0 },
// { Zuint16, Cx0008, 0x0012, (OnTransitionTime), Cm1, 0 },
// { Zuint16, Cx0008, 0x0013, (OffTransitionTime), Cm1, 0 },
// { Zuint16, Cx0008, 0x0014, (DefaultMoveRate), Cm1, 0 },
{ Zuint8, Cx0008, 0x0011, Z_(OnLevel), Cm1, 0 },
{ Zuint16, Cx0008, 0x0012, Z_(OnTransitionTime), Cm1, 0 },
{ Zuint16, Cx0008, 0x0013, Z_(OffTransitionTime), Cm1, 0 },
{ Zuint16, Cx0008, 0x0014, Z_(DefaultMoveRate), Cm1, 0 },
// Alarms cluster
{ Zuint16, Cx0009, 0x0000, Z_(AlarmCount), Cm1, 0 },
@ -554,6 +591,14 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint16, Cx000B, 0x0002, Z_(LocationAge), Cm1, 0 },
{ Zuint8, Cx000B, 0x0003, Z_(QualityMeasure), Cm1, 0 },
{ Zuint8, Cx000B, 0x0004, Z_(NumberOfDevices), Cm1, 0 },
{ Zint16, Cx000B, 0x0010, Z_(Coordinate1), Cm1, 0 },
{ Zint16, Cx000B, 0x0011, Z_(Coordinate2), Cm1, 0 },
{ Zint16, Cx000B, 0x0012, Z_(Coordinate3), Cm1, 0 },
{ Zint16, Cx000B, 0x0013, Z_(LocationPower), Cm1, 0 },
{ Zuint16, Cx000B, 0x0014, Z_(PathLossExponent), Cm1, 0 },
{ Zuint16, Cx000B, 0x0015, Z_(ReportingPeriod), Cm1, 0 },
{ Zuint16, Cx000B, 0x0016, Z_(CalculationPeriod), Cm1, 0 },
{ Zuint8, Cx000B, 0x0016, Z_(NumberRSSIMeasurements), Cm1, 0 },
// Analog Input cluster
// { 0xFF, Cx000C, 0x0004, (AnalogInActiveText), Cm1, 0 },
@ -706,6 +751,38 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint32, Cx0101, 0x0005, Z_(DoorClosedEvents), Cm1, 0 },
{ Zuint16, Cx0101, 0x0006, Z_(OpenPeriod), Cm1, 0 },
// Door locks
{ Zuint16, Cx0101, 0x0010, Z_(NumberOfLogRecordsSupported), Cm1, 0 },
{ Zuint16, Cx0101, 0x0011, Z_(NumberOfTotalUsersSupported), Cm1, 0 },
{ Zuint16, Cx0101, 0x0012, Z_(NumberOfPINUsersSupported), Cm1, 0 },
{ Zuint16, Cx0101, 0x0013, Z_(NumberOfRFIDUsersSupported), Cm1, 0 },
{ Zuint8, Cx0101, 0x0014, Z_(NumberOfWeekDaySchedulesSupportedPerUser), Cm1, 0 },
{ Zuint8, Cx0101, 0x0015, Z_(NumberOfYearDaySchedulesSupportedPerUser), Cm1, 0 },
{ Zuint8, Cx0101, 0x0016, Z_(NumberOfHolidaySchedulesSupported), Cm1, 0 },
{ Zuint8, Cx0101, 0x0017, Z_(MaxPINCodeLength), Cm1, 0 },
{ Zuint8, Cx0101, 0x0018, Z_(MinPINCodeLength), Cm1, 0 },
{ Zuint8, Cx0101, 0x0019, Z_(MaxRFIDCodeLength), Cm1, 0 },
{ Zuint8, Cx0101, 0x0011, Z_(MinRFIDCodeLength), Cm1, 0 },
{ Zbool, Cx0101, 0x0020, Z_(LockEnableLogging), Cm1, 0 },
{ Zstring, Cx0101, 0x0021, Z_(LockLanguage), Cm1, 0 },
{ Zuint8, Cx0101, 0x0022, Z_(LockLEDSettings), Cm1, 0 },
{ Zuint32, Cx0101, 0x0023, Z_(AutoRelockTime), Cm1, 0 },
{ Zuint8, Cx0101, 0x0024, Z_(LockSoundVolume), Cm1, 0 },
{ Zenum8, Cx0101, 0x0025, Z_(LockOperatingMode), Cm1, 0 },
{ Zmap16, Cx0101, 0x0026, Z_(LockSupportedOperatingModes), Cm1, 0 },
{ Zmap16, Cx0101, 0x0027, Z_(LockDefaultConfigurationRegister), Cm1, 0 },
{ Zbool, Cx0101, 0x0028, Z_(LockEnableLocalProgramming), Cm1, 0 },
{ Zbool, Cx0101, 0x0029, Z_(LockEnableOneTouchLocking), Cm1, 0 },
{ Zbool, Cx0101, 0x002A, Z_(LockEnableInsideStatusLED), Cm1, 0 },
{ Zbool, Cx0101, 0x002B, Z_(LockEnablePrivacyModeButton), Cm1, 0 },
{ Zmap16, Cx0101, 0x0040, Z_(LockAlarmMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0041, Z_(LockKeypadOperationEventMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0042, Z_(LockRFOperationEventMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0043, Z_(LockManualOperationEventMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0044, Z_(LockRFIDOperationEventMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0045, Z_(LockKeypadProgrammingEventMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0046, Z_(LockRFProgrammingEventMask), Cm1, 0 },
{ Zmap16, Cx0101, 0x0047, Z_(LockRFIDProgrammingEventMask), Cm1, 0 },
// Aqara Lumi Vibration Sensor
{ Zuint16, Cx0101, 0x0055, Z_(AqaraVibrationMode), Cm1, 0 },
{ Zuint16, Cx0101, 0x0503, Z_(AqaraVibrationsOrAngle), Cm1, 0 },
@ -742,13 +819,26 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
// Thermostat
{ Zint16, Cx0201, 0x0000, Z_(LocalTemperature), Cm_100, Z_MAPPING(Z_Data_Thermo, temperature) },
{ Zint16, Cx0201, 0x0001, Z_(OutdoorTemperature),Cm_100, 0 },
{ Zmap8, Cx0201, 0x0002, Z_(ThermostatOccupancy), Cm1, 0 },
{ Zint16, Cx0201, 0x0003, Z_(AbsMinHeatSetpointLimit), Cm1, 0 },
{ Zint16, Cx0201, 0x0004, Z_(AbsMaxHeatSetpointLimit), Cm1, 0 },
{ Zint16, Cx0201, 0x0005, Z_(AbsMinCoolSetpointLimit), Cm1, 0 },
{ Zint16, Cx0201, 0x0006, Z_(AbsMaxCoolSetpointLimit), Cm1, 0 },
{ Zuint8, Cx0201, 0x0007, Z_(PICoolingDemand), Cm1, Z_MAPPING(Z_Data_Thermo, th_setpoint) },
{ Zuint8, Cx0201, 0x0008, Z_(PIHeatingDemand), Cm1, Z_MAPPING(Z_Data_Thermo, th_setpoint) },
{ Zmap8, Cx0201, 0x0009, Z_(HVACSystemTypeConfiguration), Cm1, 0 },
{ Zint8, Cx0201, 0x0010, Z_(LocalTemperatureCalibration), Cm_10, 0 },
{ Zint16, Cx0201, 0x0011, Z_(OccupiedCoolingSetpoint), Cm_100, Z_MAPPING(Z_Data_Thermo, temperature_target) },
{ Zint16, Cx0201, 0x0012, Z_(OccupiedHeatingSetpoint), Cm_100, Z_MAPPING(Z_Data_Thermo, temperature_target) },
{ Zint16, Cx0201, 0x0013, Z_(UnoccupiedCoolingSetpoint), Cm_100, 0 },
{ Zint16, Cx0201, 0x0014, Z_(UnoccupiedHeatingSetpoint), Cm_100, 0 },
{ Zint16, Cx0201, 0x0015, Z_(MinHeatSetpointLimit), Cm1, 0 },
{ Zint16, Cx0201, 0x0016, Z_(MaxHeatSetpointLimit), Cm1, 0 },
{ Zint16, Cx0201, 0x0017, Z_(MinCoolSetpointLimit), Cm1, 0 },
{ Zint16, Cx0201, 0x0018, Z_(MaxCoolSetpointLimit), Cm1, 0 },
{ Zint8, Cx0201, 0x0019, Z_(MinSetpointDeadBand), Cm1, 0 },
{ Zmap8, Cx0201, 0x001D, Z_(ThermostatAlarmMask), Cm1, 0 },
{ Zenum8, Cx0201, 0x001E, Z_(ThermostatRunningMode), Cm1, 0 },
{ Zmap8, Cx0201, 0x001A, Z_(RemoteSensing), Cm1, 0 },
{ Zenum8, Cx0201, 0x001B, Z_(ControlSequenceOfOperation), Cm1, 0 },
{ Zenum8, Cx0201, 0x001C, Z_(SystemMode), Cm1, 0 },
@ -768,6 +858,25 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint8, Cx0201, 0xFFF0, Z_(ThSetpoint), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Thermo, th_setpoint) },
{ Zint16, Cx0201, 0xFFF1, Z_(TempTarget), Cm_100 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Thermo, temperature_target) },
// Fan Control
{ Zenum8, Cx0202, 0x0000, Z_(FanMode), Cm1, 0 },
{ Zenum8, Cx0202, 0x0001, Z_(FanModeSequence), Cm1, 0 },
// Dehumidification Control
{ Zuint8, Cx0203, 0x0000, Z_(RelativeHumidity), Cm1, 0 },
{ Zuint8, Cx0203, 0x0001, Z_(DehumidificationCooling), Cm1, 0 },
{ Zuint8, Cx0203, 0x0010, Z_(RHDehumidificationSetpoint), Cm1, 0 },
{ Zenum8, Cx0203, 0x0011, Z_(RelativeHumidityMode), Cm1, 0 },
{ Zenum8, Cx0203, 0x0012, Z_(DehumidificationLockout), Cm1, 0 },
{ Zuint8, Cx0203, 0x0013, Z_(DehumidificationHysteresis), Cm1, 0 },
{ Zuint8, Cx0203, 0x0014, Z_(DehumidificationMaxCool), Cm1, 0 },
{ Zenum8, Cx0203, 0x0015, Z_(RelativeHumidityDisplay), Cm1, 0 },
// Thermostat User Interface Con- figuration
{ Zenum8, Cx0204, 0x0000, Z_(TemperatureDisplayMode), Cm1, 0 },
{ Zenum8, Cx0204, 0x0001, Z_(ThermostatKeypadLockout), Cm1, 0 },
{ Zenum8, Cx0204, 0x0002, Z_(ThermostatScheduleProgrammingVisibility), Cm1, 0 },
// Color Control cluster
{ Zuint8, Cx0300, 0x0000, Z_(Hue), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Light, hue) },
{ Zuint8, Cx0300, 0x0001, Z_(Sat), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Light, sat) },
@ -788,6 +897,15 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint16, Cx0300, 0x0019, Z_(Primary3X), Cm1, 0 },
{ Zuint16, Cx0300, 0x001A, Z_(Primary3Y), Cm1, 0 },
{ Zuint8, Cx0300, 0x001B, Z_(Primary3Intensity), Cm1, 0 },
{ Zuint16, Cx0300, 0x0020, Z_(Primary4X), Cm1, 0 },
{ Zuint16, Cx0300, 0x0021, Z_(Primary4Y), Cm1, 0 },
{ Zuint8, Cx0300, 0x0022, Z_(Primary4Intensity), Cm1, 0 },
{ Zuint16, Cx0300, 0x0024, Z_(Primary5X), Cm1, 0 },
{ Zuint16, Cx0300, 0x0025, Z_(Primary5Y), Cm1, 0 },
{ Zuint8, Cx0300, 0x0026, Z_(Primary5Intensity), Cm1, 0 },
{ Zuint16, Cx0300, 0x0028, Z_(Primary6X), Cm1, 0 },
{ Zuint16, Cx0300, 0x0029, Z_(Primary6Y), Cm1, 0 },
{ Zuint8, Cx0300, 0x002A, Z_(Primary6Intensity), Cm1, 0 },
{ Zuint16, Cx0300, 0x0030, Z_(WhitePointX), Cm1, 0 },
{ Zuint16, Cx0300, 0x0031, Z_(WhitePointY), Cm1, 0 },
{ Zuint16, Cx0300, 0x0032, Z_(ColorPointRX), Cm1, 0 },
@ -799,6 +917,34 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint16, Cx0300, 0x003A, Z_(ColorPointBX), Cm1, 0 },
{ Zuint16, Cx0300, 0x003B, Z_(ColorPointBY), Cm1, 0 },
{ Zuint8, Cx0300, 0x003C, Z_(ColorPointBIntensity), Cm1, 0 },
{ Zuint16, Cx0300, 0x4000, Z_(EnhancedCurrentHue), Cm1, 0 },
{ Zenum8, Cx0300, 0x4001, Z_(EnhancedColorMode), Cm1, 0 },
{ Zuint8, Cx0300, 0x4002, Z_(ColorLoopActive), Cm1, 0 },
{ Zuint8, Cx0300, 0x4003, Z_(ColorLoopDirection), Cm1, 0 },
{ Zuint16, Cx0300, 0x4004, Z_(ColorLoopTime), Cm1, 0 },
{ Zuint16, Cx0300, 0x4005, Z_(ColorLoopStartEnhancedHue), Cm1, 0 },
{ Zuint16, Cx0300, 0x4006, Z_(ColorLoopStoredEnhancedHue), Cm1, 0 },
{ Zmap16, Cx0300, 0x400A, Z_(ColorCapabilities), Cm1, 0 },
{ Zuint16, Cx0300, 0x400B, Z_(ColorTempPhysicalMinMireds), Cm1, 0 },
{ Zuint16, Cx0300, 0x400C, Z_(ColorTempPhysicalMaxMireds), Cm1, 0 },
// Ballast Configuration
{ Zuint8, Cx0301, 0x0000, Z_(BallastPhysicalMinLevel), Cm1, 0 },
{ Zuint8, Cx0301, 0x0001, Z_(BallastPhysicalMaxLevel), Cm1, 0 },
{ Zmap8, Cx0301, 0x0002, Z_(BallastStatus), Cm1, 0 },
{ Zuint8, Cx0301, 0x0010, Z_(BallastMinLevel), Cm1, 0 },
{ Zuint8, Cx0301, 0x0011, Z_(BallastMaxLevel), Cm1, 0 },
{ Zuint8, Cx0301, 0x0012, Z_(BallastPowerOnLevel), Cm1, 0 },
{ Zuint16, Cx0301, 0x0013, Z_(BallastPowerOnFadeTime), Cm1, 0 },
{ Zuint8, Cx0301, 0x0014, Z_(IntrinsicBallastFactor), Cm1, 0 },
{ Zuint8, Cx0301, 0x0015, Z_(BallastFactorAdjustment), Cm1, 0 },
{ Zuint8, Cx0301, 0x0020, Z_(BallastLampQuantity), Cm1, 0 },
{ Zstring, Cx0301, 0x0030, Z_(LampType), Cm1, 0 },
{ Zstring, Cx0301, 0x0031, Z_(LampManufacturer), Cm1, 0 },
{ Zuint24, Cx0301, 0x0032, Z_(LampRatedHours), Cm1, 0 },
{ Zuint24, Cx0301, 0x0033, Z_(LampBurnHours), Cm1, 0 },
{ Zmap8, Cx0301, 0x0034, Z_(LampAlarmMode), Cm1, 0 },
{ Zuint24, Cx0301, 0x0035, Z_(LampBurnHoursTripPoint), Cm1, 0 },
// Illuminance Measurement cluster
{ Zuint16, Cx0400, 0x0000, Z_(Illuminance), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_PIR, illuminance) }, // Illuminance (in Lux)
@ -851,12 +997,19 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
// Occupancy Sensing cluster
{ Zmap8, Cx0406, 0x0000, Z_(Occupancy), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_PIR, occupancy) }, // Occupancy (map8)
{ Zenum8, Cx0406, 0x0001, Z_(OccupancySensorType), Cm1, 0 }, // OccupancySensorType
{ Zuint16, Cx0406, 0x0010, Z_(PIROccupiedToUnoccupiedDelay), Cm1, 0 },
{ Zuint16, Cx0406, 0x0011, Z_(PIRUnoccupiedToOccupiedDelay), Cm1, 0 },
{ Zuint8, Cx0406, 0x0012, Z_(PIRUnoccupiedToOccupiedThreshold), Cm1, 0 },
// { Zunk, Cx0406, 0xFFFF, Z_(), Cm0, 0 }, // Remove all other values
// IAS Cluster (Intruder Alarm System)
{ Zenum8, Cx0500, 0x0000, Z_(ZoneState), Cm1, 0 }, // Occupancy (map8)
{ Zenum16, Cx0500, 0x0001, Z_(ZoneType), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Alarm, zone_type) }, // Zone type for sensor
{ Zmap16, Cx0500, 0x0002, Z_(ZoneStatus), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Alarm, zone_status) }, // Zone status for sensor
{ ZEUI64, Cx0500, 0x0010, Z_(IASCIEAddress), Cm1, 0 },
{ Zuint8, Cx0500, 0x0011, Z_(ZoneID), Cm1, 0 },
{ Zuint8, Cx0500, 0x0012, Z_(NumberOfZoneSensitivityLevelsSupported), Cm1, 0 },
{ Zuint8, Cx0500, 0x0013, Z_(CurrentZoneSensitivityLevel), Cm1, 0 },
{ Zuint8, Cx0500, 0xFFF0 + ZA_CIE, Z_(CIE), Cm1, 0 },
{ Zuint8, Cx0500, 0xFFF0 + ZA_PIR, Z_(Occupancy), Cm1, 0 }, // normally converted to the actual Occupancy 0406/0000
{ Zuint8, Cx0500, 0xFFF0 + ZA_Contact, Z_(Contact), Cm1, Z_MAPPING(Z_Data_Alarm, zone_status) }, // We fit the first bit in the LSB
@ -886,11 +1039,133 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zint24, Cx0B01, 0x000E, Z_(PowerThreshold), Cm1, 0 },
// Electrical Measurement cluster
{ Zmap32, Cx0B04, 0x0000, Z_(ElectricalMeasurementType), Cm1, 0 },
{ Zint16, Cx0B04, 0x0100, Z_(DCVoltage), Cm1, 0 },
{ Zint16, Cx0B04, 0x0101, Z_(DCVoltageMin), Cm1, 0 },
{ Zint16, Cx0B04, 0x0102, Z_(DCVoltageMax), Cm1, 0 },
{ Zint16, Cx0B04, 0x0103, Z_(DCCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0104, Z_(DCCurrentMin), Cm1, 0 },
{ Zint16, Cx0B04, 0x0105, Z_(DCCurrentMax), Cm1, 0 },
{ Zint16, Cx0B04, 0x0106, Z_(DCPower), Cm1, 0 },
{ Zint16, Cx0B04, 0x0107, Z_(DCPowerMin), Cm1, 0 },
{ Zint16, Cx0B04, 0x0108, Z_(DCPowerMax), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0200, Z_(DCVoltageMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0201, Z_(DCVoltageDivisor), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0202, Z_(DCCurrentMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0203, Z_(DCCurrentDivisor), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0204, Z_(DCPowerMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0205, Z_(DCPowerDivisor), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0300, Z_(ACFrequency), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0301, Z_(ACFrequencyMin), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0302, Z_(ACFrequencyMax), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0303, Z_(NeutralCurrent), Cm1, 0 },
{ Zint32, Cx0B04, 0x0304, Z_(TotalActivePower), Cm1, 0 },
{ Zint32, Cx0B04, 0x0305, Z_(TotalReactivePower), Cm1, 0 },
{ Zuint32, Cx0B04, 0x0306, Z_(TotalApparentPower), Cm1, 0 },
{ Zint16, Cx0B04, 0x0307, Z_(Measured1stHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0308, Z_(Measured3rdHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0309, Z_(Measured5thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x030A, Z_(Measured7thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x030B, Z_(Measured9thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x030C, Z_(Measured11thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x030D, Z_(MeasuredPhase1stHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x030E, Z_(MeasuredPhase3rdHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x030F, Z_(MeasuredPhase5thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0310, Z_(MeasuredPhase7thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0311, Z_(MeasuredPhase9thHarmonicCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0312, Z_(MeasuredPhase11thHarmonicCurrent), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0400, Z_(ACFrequencyMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0401, Z_(ACFrequencyDivisor), Cm1, 0 },
{ Zuint32, Cx0B04, 0x0402, Z_(PowerMultiplier), Cm1, 0 },
{ Zuint32, Cx0B04, 0x0403, Z_(PowerDivisor), Cm1, 0 },
{ Zint8, Cx0B04, 0x0404, Z_(HarmonicCurrentMultiplier), Cm1, 0 },
{ Zint8, Cx0B04, 0x0405, Z_(PhaseHarmonicCurrentMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0501, Z_(LineCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0502, Z_(ActiveCurrent), Cm1, 0 },
{ Zint16, Cx0B04, 0x0503, Z_(ReactiveCurrent), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0505, Z_(RMSVoltage), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Plug, mains_voltage) },
{ Zuint16, Cx0B04, 0x0506, Z_(RMSVoltageMin), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0507, Z_(RMSVoltageMax), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0508, Z_(RMSCurrent), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0509, Z_(RMSCurrentMin), Cm1, 0 },
{ Zuint16, Cx0B04, 0x050A, Z_(RMSCurrentMax), Cm1, 0 },
{ Zint16, Cx0B04, 0x050B, Z_(ActivePower), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_Plug, mains_power) },
{ Zuint16, Cx0B04, 0x050C, Z_(ActivePowerMin), Cm1, 0 },
{ Zuint16, Cx0B04, 0x050D, Z_(ActivePowerMax), Cm1, 0 },
{ Zint16, Cx0B04, 0x050E, Z_(ReactivePower), Cm1, 0 },
{ Zint16, Cx0B04, 0x050F, Z_(ApparentPower), Cm1, 0 },
{ Zint8, Cx0B04, 0x0510, Z_(PowerFactor), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0511, Z_(AverageRMSVoltageMeasurementPeriod), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0512, Z_(AverageRMSOverVoltageCounter), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0513, Z_(AverageRMSUnderVoltageCounter), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0514, Z_(RMSExtremeOverVoltagePeriod), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0515, Z_(RMSExtremeUnderVoltagePeriod), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0516, Z_(RMSVoltageSagPeriod), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0517, Z_(RMSVoltageSwellPeriod), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0600, Z_(ACVoltageMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0601, Z_(ACVoltageDivisor), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0602, Z_(ACCurrentMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0603, Z_(ACCurrentDivisor), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0604, Z_(ACPowerMultiplier), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0605, Z_(ACPowerDivisor), Cm1, 0 },
{ Zmap8, Cx0B04, 0x0700, Z_(DCOverloadAlarmsMask), Cm1, 0 },
{ Zint16, Cx0B04, 0x0701, Z_(DCVoltageOverload), Cm1, 0 },
{ Zint16, Cx0B04, 0x0702, Z_(DCCurrentOverload), Cm1, 0 },
{ Zmap16, Cx0B04, 0x0800, Z_(ACAlarmsMask), Cm1, 0 },
{ Zint16, Cx0B04, 0x0801, Z_(ACVoltageOverload), Cm1, 0 },
{ Zint16, Cx0B04, 0x0802, Z_(ACCurrentOverload), Cm1, 0 },
{ Zint16, Cx0B04, 0x0803, Z_(ACActivePowerOverload), Cm1, 0 },
{ Zint16, Cx0B04, 0x0804, Z_(ACReactivePowerOverload), Cm1, 0 },
{ Zint16, Cx0B04, 0x0805, Z_(AverageRMSOverVoltage), Cm1, 0 },
{ Zint16, Cx0B04, 0x0806, Z_(AverageRMSUnderVoltage), Cm1, 0 },
{ Zint16, Cx0B04, 0x0807, Z_(RMSExtremeOverVoltage), Cm1, 0 },
{ Zint16, Cx0B04, 0x0808, Z_(RMSExtremeUnderVoltage), Cm1, 0 },
{ Zint16, Cx0B04, 0x0809, Z_(RMSVoltageSag), Cm1, 0 },
{ Zint16, Cx0B04, 0x080A, Z_(RMSVoltageSwell), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0901, Z_(LineCurrentPhB), Cm1, 0 },
{ Zint16, Cx0B04, 0x0902, Z_(ActiveCurrentPhB), Cm1, 0 },
{ Zint16, Cx0B04, 0x0903, Z_(ReactiveCurrentPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0905, Z_(RMSVoltagePhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0906, Z_(RMSVoltageMinPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0907, Z_(RMSVoltageMaxPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0908, Z_(RMSCurrentPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0909, Z_(RMSCurrentMinPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x090A, Z_(RMSCurrentMaxPhB), Cm1, 0 },
{ Zint16, Cx0B04, 0x090B, Z_(ActivePowerPhB), Cm1, 0 },
{ Zint16, Cx0B04, 0x090C, Z_(ActivePowerMinPhB), Cm1, 0 },
{ Zint16, Cx0B04, 0x090D, Z_(ActivePowerMaxPhB), Cm1, 0 },
{ Zint16, Cx0B04, 0x090E, Z_(ReactivePowerPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x090F, Z_(ApparentPowerPhB), Cm1, 0 },
{ Zint8, Cx0B04, 0x0910, Z_(PowerFactorPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0911, Z_(AverageRMSVoltageMeasurementPeriodPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0912, Z_(AverageRMSOverVoltageCounterPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0913, Z_(AverageRMSUnderVoltageCounterPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0914, Z_(RMSExtremeOverVoltagePeriodPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0915, Z_(RMSExtremeUnderVoltagePeriodPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0916, Z_(RMSVoltageSagPeriodPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0917, Z_(RMSVoltageSwellPeriodPhB), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A01, Z_(LineCurrentPhC), Cm1, 0 },
{ Zint16, Cx0B04, 0x0A02, Z_(ActiveCurrentPhC), Cm1, 0 },
{ Zint16, Cx0B04, 0x0A03, Z_(ReactiveCurrentPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A05, Z_(RMSVoltagePhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A06, Z_(RMSVoltageMinPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A07, Z_(RMSVoltageMaxPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A08, Z_(RMSCurrentPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A09, Z_(RMSCurrentMinPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A0A, Z_(RMSCurrentMaxPhC), Cm1, 0 },
{ Zint16, Cx0B04, 0x0A0B, Z_(ActivePowerPhC), Cm1, 0 },
{ Zint16, Cx0B04, 0x0A0C, Z_(ActivePowerMinPhC), Cm1, 0 },
{ Zint16, Cx0B04, 0x0A0D, Z_(ActivePowerMaxPhC), Cm1, 0 },
{ Zint16, Cx0B04, 0x0A0E, Z_(ReactivePowerPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A0F, Z_(ApparentPowerPhC), Cm1, 0 },
{ Zint8, Cx0B04, 0x0A10, Z_(PowerFactorPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A11, Z_(AverageRMSVoltageMeasurementPeriodPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A12, Z_(AverageRMSOverVoltageCounterPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A13, Z_(AverageRMSUnderVoltageCounterPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A14, Z_(RMSExtremeOverVoltagePeriodPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A15, Z_(RMSExtremeUnderVoltagePeriodPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A16, Z_(RMSVoltageSagPeriodPhC), Cm1, 0 },
{ Zuint16, Cx0B04, 0x0A17, Z_(RMSVoltageSwellPeriodPhC), Cm1, 0 },
// Diagnostics cluster
{ Zuint16, Cx0B05, 0x0000, Z_(NumberOfResets), Cm1, 0 },

View File

@ -1509,6 +1509,7 @@ void Z_parseAttributeKey_inner(uint16_t shortaddr, class Z_attribute & attr, uin
attr.setKeyId(matched_attr.cluster, matched_attr.attribute);
attr.attr_type = matched_attr.zigbee_type;
attr.attr_multiplier = matched_attr.multiplier;
attr.manuf = matched_attr.manuf;
}
}
} else {
@ -1516,6 +1517,7 @@ void Z_parseAttributeKey_inner(uint16_t shortaddr, class Z_attribute & attr, uin
Z_attribute_match matched_attr = Z_findAttributeMatcherById(shortaddr, attr.key.id.cluster, attr.key.id.attr_id, false);
if (matched_attr.found()) {
attr.attr_type = matched_attr.zigbee_type;
attr.manuf = matched_attr.manuf;
}
}
}

View File

@ -19,6 +19,18 @@
#ifdef USE_ZIGBEE
const char Z_MUL[] PROGMEM = "mul:";
const char Z_DIV[] PROGMEM = "div:";
const char Z_MANUF[] PROGMEM = "manuf:";
char * Z_subtoken(char * token, const char * prefix) {
size_t prefix_len = strlen_P(prefix);
if (!strncmp_P(token, prefix, prefix_len)) {
return token + prefix_len;
}
return nullptr;
}
// global singleton
Z_plugin_templates g_plugin_templates;
@ -48,6 +60,7 @@ Z_attribute_match Z_plugin_matchAttributeById(const char *model, const char *man
attr.name = attr_tmpl->name.c_str();
attr.zigbee_type = attr_tmpl->type;
attr.multiplier = attr_tmpl->multiplier;
attr.manuf = attr_tmpl->manuf;
}
return attr;
}
@ -67,6 +80,7 @@ Z_attribute_match Z_plugin_matchAttributeByName(const char *model, const char *m
attr.name = attr_tmpl->name.c_str();
attr.zigbee_type = attr_tmpl->type;
attr.multiplier = attr_tmpl->multiplier;
attr.manuf = attr_tmpl->manuf;
}
}
return attr;
@ -205,6 +219,7 @@ bool ZbLoad(const char *filename_raw) {
char * delimiter_equal = strchr(token, '=');
if (delimiter_equal == nullptr) {
// NORMAL ATTRIBUTE
// token is of from '0000/0000' or '0000/0000%00'
char * delimiter_slash = strchr(token, '/');
char * delimiter_percent = strchr(token, '%');
@ -215,6 +230,9 @@ bool ZbLoad(const char *filename_raw) {
uint16_t attr_id = 0xFFFF;
uint16_t cluster_id = 0xFFFF;
uint8_t type_id = Zunk;
int8_t multiplier = 1;
char * name = nullptr;
uint16_t manuf = 0;
cluster_id = strtoul(token, &delimiter_slash, 16);
if (!delimiter_percent) {
@ -223,19 +241,44 @@ bool ZbLoad(const char *filename_raw) {
attr_id = strtoul(delimiter_slash+1, &delimiter_percent, 16);
type_id = Z_getTypeByName(delimiter_percent+1);
}
// name of the attribute
// NAME of the attribute
token = strtok_r(rest, ",", &rest);
if (token == nullptr) {
AddLog(LOG_LEVEL_INFO, "ZIG: ZbLoad '%s' ignore missing name '%s'", filename_raw, buf_line);
continue;
}
name = token;
// ADDITIONAL ELEMENTS?
// Ex: `manuf:1037`
while (token = strtok_r(rest, ",", &rest)) {
char * sub_token;
// look for multiplier
if (sub_token = Z_subtoken(token, Z_MUL)) {
multiplier = strtoul(sub_token, nullptr, 10);
}
// look for divider
else if (sub_token = Z_subtoken(token, Z_DIV)) {
multiplier = - strtoul(sub_token, nullptr, 10); // negative to indicate divider
}
// look for `manuf:HHHH`
else if (sub_token = Z_subtoken(token, Z_MANUF)) {
manuf = strtoul(sub_token, nullptr, 16);
}
else {
AddLog(LOG_LEVEL_DEBUG, "ZIG: ZbLoad unrecognized modifier '%s'", token);
}
}
// token contains the name of the attribute
Z_plugin_attribute & plugin_attr = tmpl->attributes.addToLast();
plugin_attr.cluster = cluster_id;
plugin_attr.attribute = attr_id;
plugin_attr.type = type_id;
plugin_attr.name = token;
plugin_attr.name = name;
plugin_attr.multiplier = multiplier;
plugin_attr.manuf = manuf;
} else {
// ATTRIBUTE SYNONYM
// token is of from '0000/0000=0000/0000,1'
char * rest2 = token;
char * tok2 = strtok_r(rest2, "=", &rest2);
@ -246,11 +289,22 @@ bool ZbLoad(const char *filename_raw) {
char * delimiter_slash2 = strchr(tok2, '/');
uint16_t new_cluster_id = strtoul(tok2, &delimiter_slash2, 16);
uint16_t new_attr_id = strtoul(delimiter_slash2+1, nullptr, 16);
// multiplier
token = strtok_r(rest, ",", &rest);
int8_t multiplier = 1;
if (token != nullptr) {
multiplier = strtol(token, nullptr, 10);
// ADDITIONAL ELEMENTS?
while (token = strtok_r(rest, ",", &rest)) {
char * sub_token;
// look for multiplier
if (sub_token = Z_subtoken(token, Z_MUL)) {
multiplier = strtoul(sub_token, nullptr, 10);
}
// look for divider
else if (sub_token = Z_subtoken(token, Z_DIV)) {
multiplier = - strtoul(sub_token, nullptr, 10); // negative to indicate divider
}
else {
AddLog(LOG_LEVEL_DEBUG, "ZIG: ZbLoad unrecognized modifier '%s'", token);
}
}
// create the synonym
Z_attribute_synonym & syn = tmpl->synonyms.addToLast();
@ -305,21 +359,35 @@ bool ZbUnload(const char *filename_raw) {
return false;
}
// append modifiers like mul/div/manuf
void Z_AppendModifiers(char * buf, size_t buf_len, int8_t multiplier, uint16_t manuf) {
if (multiplier != 0 && multiplier != 1) {
ext_snprintf_P(buf, buf_len, "%s,%s%i", buf, multiplier > 0 ? Z_MUL : Z_DIV, multiplier > 0 ? multiplier : -multiplier);
}
if (manuf) {
ext_snprintf_P(buf, buf_len, "%s,%s%04X", buf, Z_MANUF, manuf);
}
}
// Dump the ZbLoad structure in a format compatible with ZbLoad
void ZbLoadDump(void) {
char buf[96];
AddLog(LOG_LEVEL_INFO, "ZIG: ZbLoad dump all current information");
AddLog(LOG_LEVEL_INFO, "====> START");
for (const Z_plugin_template & tmpl : g_plugin_templates) {
if (tmpl.filename != nullptr) {
AddLog(LOG_LEVEL_INFO, "# imported from '%s'", tmpl.filename);
ext_snprintf_P(buf, sizeof(buf), "# imported from '%s'", tmpl.filename);
AddLog(LOG_LEVEL_INFO, PSTR("%s"), buf);
}
// marchers
if (tmpl.matchers.length() == 0) {
AddLog(LOG_LEVEL_INFO, ": # no matcher");
ext_snprintf_P(buf, sizeof(buf), ": # no matcher");
AddLog(LOG_LEVEL_INFO, PSTR("%s"), buf);
} else {
for (const Z_plugin_matcher & matcher : tmpl.matchers) {
AddLog(LOG_LEVEL_INFO, ":%s,%s", matcher.model.c_str(), matcher.manufacturer.c_str());
ext_snprintf_P(buf, sizeof(buf), ":%s,%s", matcher.model.c_str(), matcher.manufacturer.c_str());
AddLog(LOG_LEVEL_INFO, PSTR("%s"), buf);
}
}
// attributes
@ -328,16 +396,20 @@ void ZbLoadDump(void) {
AddLog(LOG_LEVEL_INFO, "");
} else {
for (const Z_plugin_attribute & attr : tmpl.attributes) {
if (attr.type == Zunk) {
AddLog(LOG_LEVEL_INFO, "%04X/%04X,%s", attr.cluster, attr.attribute, attr.name.c_str());
} else {
char type[16];
Z_getTypeByNumber(type, sizeof(type), attr.type);
AddLog(LOG_LEVEL_INFO, "%04X/%04X%%%s,%s", attr.cluster, attr.attribute, type, attr.name.c_str());
ext_snprintf_P(buf, sizeof(buf), "%04X/%04X", attr.cluster, attr.attribute);
// add type if known
if (attr.type != Zunk) {
char type_str[16];
Z_getTypeByNumber(type_str, sizeof(type_str), attr.type);
ext_snprintf_P(buf, sizeof(buf), "%s%%%s", buf, type_str);
}
Z_AppendModifiers(buf, sizeof(buf), attr.multiplier, attr.manuf);
AddLog(LOG_LEVEL_INFO, PSTR("%s"), buf);
}
for (const Z_attribute_synonym & syn : tmpl.synonyms) {
AddLog(LOG_LEVEL_INFO, "%04X/%04X=%04X/%04X,%i", syn.cluster, syn.attribute, syn.new_cluster, syn.new_attribute, syn.multiplier);
ext_snprintf_P(buf, sizeof(buf), "%04X/%04X=%04X/%04X", syn.cluster, syn.attribute, syn.new_cluster, syn.new_attribute);
Z_AppendModifiers(buf, sizeof(buf), syn.multiplier, 0);
AddLog(LOG_LEVEL_INFO, PSTR("%s"), buf);
}
}
}

View File

@ -352,6 +352,15 @@ void ZbSendReportWrite(class JsonParserToken val_pubwrite, class ZCLFrame & zcl)
return;
}
// check for manuf code
if (attr.manuf) {
if (zcl.manuf != 0 && zcl.manuf != attr.manuf) {
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "conflicting manuf code 0x%04X (was 0x%04X)"), attr.manuf, zcl.manuf);
} else {
zcl.manuf = attr.manuf;
}
}
} else {
if (attr.key_is_str) {
Response_P(PSTR("{\"%s\":\"%s'%s'\"}"), XdrvMailbox.command, PSTR(D_ZIGBEE_UNKNOWN_ATTRIBUTE " "), key.getStr());
@ -646,6 +655,14 @@ void ZbSendRead(JsonParserToken val_attr, ZCLFrame & zcl) {
if (attrs) { free(attrs); }
return;
}
// check for manuf code
if (matched_attr.manuf) {
if (zcl.manuf != 0 && zcl.manuf != matched_attr.manuf) {
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE "conflicting manuf code 0x%04X (was 0x%04X)"), matched_attr.manuf, zcl.manuf);
} else {
zcl.manuf = matched_attr.manuf;
}
}
}
if (!found) {
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_ZIGBEE D_ZIGBEE_UNKNWON_ATTRIBUTE), key.getStr());

View File

@ -9,6 +9,6 @@ EF00/0267,CycleIrrigationNumTimes # number of cycle irrigation times, set to 0
EF00/0268,IrrigationTarget # duration in minutes or capacity in Liters (depending on mode)
EF00/0269,CycleIrrigationInterval # cycle irrigation interval (minutes, max 1440)
EF00/026A,CurrentTemperature # (value ignored because isn't a valid tempurature reading. Misdocumented and usage unclear)
EF00/026C=0001/0021,2 # match to BatteryPercentage
EF00/026C=0001/0021,mul:2 # match to BatteryPercentage
EF00/026F,WaterConsumed # water consumed (Litres)
EF00/0372,LastIrrigationDuration # (string) Ex: "00:01:10,0"

View File

@ -0,0 +1,31 @@
#Z2Tv1
# DEPRECATED
# Legacy Tuya attributes from before Zigbee Device plugins
# Use only if you need to legacy behavior, prefer device specific
: # apply to all devices
EF00/0070,TuyaScheduleWorkdays
EF00/0071,TuyaScheduleHolidays
EF00/0101,Power
EF00/0102,Power2
EF00/0103,Power3
EF00/0104,Power4
EF00/0107,TuyaChildLock
EF00/0112,TuyaWindowDetection
EF00/0114,TuyaValveDetection
EF00/0174,TuyaAutoLock
EF00/0202,TuyaTempTarget
EF00/0202=0201/FFF1,mul:10 # TempTarget
EF00/0203=0402/0000,mul:10 # Temperature
EF00/0215,TuyaBattery
EF00/0266,TuyaMinTemp
EF00/0267,TuyaMaxTemp
EF00/0269,TuyaBoostTime
EF00/026B,TuyaComfortTemp
EF00/026C,TuyaEcoTemp
EF00/026D=0201/FFF0
EF00/0272,TuyaAwayTemp
EF00/0275,TuyaAwayDays
EF00/0404,TuyaPreset
EF00/0405,TuyaFanMode
EF00/046A,TuyaForceMode
EF00/046F,TuyaWeekSelect