mirror of https://github.com/arendst/Tasmota.git
Merge pull request #10597 from s-hadinger/zigbee_report_rgb
Zigbee report colors as RGB
This commit is contained in:
commit
840f4c3bc2
|
@ -73,7 +73,7 @@ def strings_to_pmem(arg):
|
|||
DO NOT EDIT
|
||||
*/
|
||||
|
||||
const char Z_strings[] PROGMEM =
|
||||
const char Z_strings[] PROGMEM =
|
||||
"\x00"
|
||||
"00" "\x00"
|
||||
"00190200" "\x00"
|
||||
|
@ -380,6 +380,7 @@ const char Z_strings[] PROGMEM =
|
|||
"ProductRevision" "\x00"
|
||||
"ProductURL" "\x00"
|
||||
"QualityMeasure" "\x00"
|
||||
"RGB" "\x00"
|
||||
"RMSCurrent" "\x00"
|
||||
"RMSVoltage" "\x00"
|
||||
"ReactivePower" "\x00"
|
||||
|
@ -802,120 +803,121 @@ enum Z_offsets {
|
|||
Zo_ProductRevision = 4940,
|
||||
Zo_ProductURL = 4956,
|
||||
Zo_QualityMeasure = 4967,
|
||||
Zo_RMSCurrent = 4982,
|
||||
Zo_RMSVoltage = 4993,
|
||||
Zo_ReactivePower = 5004,
|
||||
Zo_RecallScene = 5018,
|
||||
Zo_RemainingTime = 5030,
|
||||
Zo_RemoteSensing = 5044,
|
||||
Zo_RemoveAllGroups = 5058,
|
||||
Zo_RemoveAllScenes = 5074,
|
||||
Zo_RemoveGroup = 5090,
|
||||
Zo_RemoveScene = 5102,
|
||||
Zo_ResetAlarm = 5114,
|
||||
Zo_ResetAllAlarms = 5125,
|
||||
Zo_SWBuildID = 5140,
|
||||
Zo_Sat = 5150,
|
||||
Zo_SatMove = 5154,
|
||||
Zo_SatStep = 5162,
|
||||
Zo_SceneCount = 5170,
|
||||
Zo_SceneValid = 5181,
|
||||
Zo_ScheduleMode = 5192,
|
||||
Zo_SeaPressure = 5205,
|
||||
Zo_ShortPollInterval = 5217,
|
||||
Zo_Shutter = 5235,
|
||||
Zo_ShutterClose = 5243,
|
||||
Zo_ShutterLift = 5256,
|
||||
Zo_ShutterOpen = 5268,
|
||||
Zo_ShutterStop = 5280,
|
||||
Zo_ShutterTilt = 5292,
|
||||
Zo_SoftwareRevision = 5304,
|
||||
Zo_StackVersion = 5321,
|
||||
Zo_StandardTime = 5334,
|
||||
Zo_StartUpOnOff = 5347,
|
||||
Zo_Status = 5360,
|
||||
Zo_StoreScene = 5367,
|
||||
Zo_SwitchType = 5378,
|
||||
Zo_SystemMode = 5389,
|
||||
Zo_TRVBoost = 5400,
|
||||
Zo_TRVChildProtection = 5409,
|
||||
Zo_TRVMirrorDisplay = 5428,
|
||||
Zo_TRVMode = 5445,
|
||||
Zo_TRVWindowOpen = 5453,
|
||||
Zo_TempTarget = 5467,
|
||||
Zo_Temperature = 5478,
|
||||
Zo_TemperatureMaxMeasuredValue = 5490,
|
||||
Zo_TemperatureMinMeasuredValue = 5518,
|
||||
Zo_TemperatureTolerance = 5546,
|
||||
Zo_TerncyDuration = 5567,
|
||||
Zo_TerncyRotate = 5582,
|
||||
Zo_ThSetpoint = 5595,
|
||||
Zo_Time = 5606,
|
||||
Zo_TimeEpoch = 5611,
|
||||
Zo_TimeStatus = 5621,
|
||||
Zo_TimeZone = 5632,
|
||||
Zo_TotalProfileNum = 5641,
|
||||
Zo_TuyaAutoLock = 5657,
|
||||
Zo_TuyaAwayDays = 5670,
|
||||
Zo_TuyaAwayTemp = 5683,
|
||||
Zo_TuyaBattery = 5696,
|
||||
Zo_TuyaBoostTime = 5708,
|
||||
Zo_TuyaChildLock = 5722,
|
||||
Zo_TuyaComfortTemp = 5736,
|
||||
Zo_TuyaEcoTemp = 5752,
|
||||
Zo_TuyaFanMode = 5764,
|
||||
Zo_TuyaForceMode = 5776,
|
||||
Zo_TuyaMaxTemp = 5790,
|
||||
Zo_TuyaMinTemp = 5802,
|
||||
Zo_TuyaPreset = 5814,
|
||||
Zo_TuyaScheduleHolidays = 5825,
|
||||
Zo_TuyaScheduleWorkdays = 5846,
|
||||
Zo_TuyaTempTarget = 5867,
|
||||
Zo_TuyaValveDetection = 5882,
|
||||
Zo_TuyaValvePosition = 5901,
|
||||
Zo_TuyaWeekSelect = 5919,
|
||||
Zo_TuyaWindowDetection = 5934,
|
||||
Zo_UnoccupiedCoolingSetpoint = 5954,
|
||||
Zo_UnoccupiedHeatingSetpoint = 5980,
|
||||
Zo_UtilityName = 6006,
|
||||
Zo_ValidUntilTime = 6018,
|
||||
Zo_ValvePosition = 6033,
|
||||
Zo_VelocityLift = 6047,
|
||||
Zo_ViewGroup = 6060,
|
||||
Zo_ViewScene = 6070,
|
||||
Zo_Water = 6080,
|
||||
Zo_WhitePointX = 6086,
|
||||
Zo_WhitePointY = 6098,
|
||||
Zo_WindowCoveringType = 6110,
|
||||
Zo_X = 6129,
|
||||
Zo_Y = 6131,
|
||||
Zo_ZCLVersion = 6133,
|
||||
Zo_ZoneState = 6144,
|
||||
Zo_ZoneStatus = 6154,
|
||||
Zo_ZoneStatusChange = 6165,
|
||||
Zo_ZoneType = 6182,
|
||||
Zo_xx = 6191,
|
||||
Zo_xx000A00 = 6194,
|
||||
Zo_xx0A = 6203,
|
||||
Zo_xx0A00 = 6208,
|
||||
Zo_xx19 = 6215,
|
||||
Zo_xx190A = 6220,
|
||||
Zo_xx190A00 = 6227,
|
||||
Zo_xxxx = 6236,
|
||||
Zo_xxxx00 = 6241,
|
||||
Zo_xxxx0A00 = 6248,
|
||||
Zo_xxxxyy = 6257,
|
||||
Zo_xxxxyyyy = 6264,
|
||||
Zo_xxxxyyyy0A00 = 6273,
|
||||
Zo_xxxxyyzz = 6286,
|
||||
Zo_xxyy = 6295,
|
||||
Zo_xxyy0A00 = 6300,
|
||||
Zo_xxyyyy = 6309,
|
||||
Zo_xxyyyy000000000000 = 6316,
|
||||
Zo_xxyyyy0A0000000000 = 6335,
|
||||
Zo_xxyyyyzz = 6354,
|
||||
Zo_xxyyyyzzzz = 6363,
|
||||
Zo_xxyyzzzz = 6374,
|
||||
Zo_RGB = 4982,
|
||||
Zo_RMSCurrent = 4986,
|
||||
Zo_RMSVoltage = 4997,
|
||||
Zo_ReactivePower = 5008,
|
||||
Zo_RecallScene = 5022,
|
||||
Zo_RemainingTime = 5034,
|
||||
Zo_RemoteSensing = 5048,
|
||||
Zo_RemoveAllGroups = 5062,
|
||||
Zo_RemoveAllScenes = 5078,
|
||||
Zo_RemoveGroup = 5094,
|
||||
Zo_RemoveScene = 5106,
|
||||
Zo_ResetAlarm = 5118,
|
||||
Zo_ResetAllAlarms = 5129,
|
||||
Zo_SWBuildID = 5144,
|
||||
Zo_Sat = 5154,
|
||||
Zo_SatMove = 5158,
|
||||
Zo_SatStep = 5166,
|
||||
Zo_SceneCount = 5174,
|
||||
Zo_SceneValid = 5185,
|
||||
Zo_ScheduleMode = 5196,
|
||||
Zo_SeaPressure = 5209,
|
||||
Zo_ShortPollInterval = 5221,
|
||||
Zo_Shutter = 5239,
|
||||
Zo_ShutterClose = 5247,
|
||||
Zo_ShutterLift = 5260,
|
||||
Zo_ShutterOpen = 5272,
|
||||
Zo_ShutterStop = 5284,
|
||||
Zo_ShutterTilt = 5296,
|
||||
Zo_SoftwareRevision = 5308,
|
||||
Zo_StackVersion = 5325,
|
||||
Zo_StandardTime = 5338,
|
||||
Zo_StartUpOnOff = 5351,
|
||||
Zo_Status = 5364,
|
||||
Zo_StoreScene = 5371,
|
||||
Zo_SwitchType = 5382,
|
||||
Zo_SystemMode = 5393,
|
||||
Zo_TRVBoost = 5404,
|
||||
Zo_TRVChildProtection = 5413,
|
||||
Zo_TRVMirrorDisplay = 5432,
|
||||
Zo_TRVMode = 5449,
|
||||
Zo_TRVWindowOpen = 5457,
|
||||
Zo_TempTarget = 5471,
|
||||
Zo_Temperature = 5482,
|
||||
Zo_TemperatureMaxMeasuredValue = 5494,
|
||||
Zo_TemperatureMinMeasuredValue = 5522,
|
||||
Zo_TemperatureTolerance = 5550,
|
||||
Zo_TerncyDuration = 5571,
|
||||
Zo_TerncyRotate = 5586,
|
||||
Zo_ThSetpoint = 5599,
|
||||
Zo_Time = 5610,
|
||||
Zo_TimeEpoch = 5615,
|
||||
Zo_TimeStatus = 5625,
|
||||
Zo_TimeZone = 5636,
|
||||
Zo_TotalProfileNum = 5645,
|
||||
Zo_TuyaAutoLock = 5661,
|
||||
Zo_TuyaAwayDays = 5674,
|
||||
Zo_TuyaAwayTemp = 5687,
|
||||
Zo_TuyaBattery = 5700,
|
||||
Zo_TuyaBoostTime = 5712,
|
||||
Zo_TuyaChildLock = 5726,
|
||||
Zo_TuyaComfortTemp = 5740,
|
||||
Zo_TuyaEcoTemp = 5756,
|
||||
Zo_TuyaFanMode = 5768,
|
||||
Zo_TuyaForceMode = 5780,
|
||||
Zo_TuyaMaxTemp = 5794,
|
||||
Zo_TuyaMinTemp = 5806,
|
||||
Zo_TuyaPreset = 5818,
|
||||
Zo_TuyaScheduleHolidays = 5829,
|
||||
Zo_TuyaScheduleWorkdays = 5850,
|
||||
Zo_TuyaTempTarget = 5871,
|
||||
Zo_TuyaValveDetection = 5886,
|
||||
Zo_TuyaValvePosition = 5905,
|
||||
Zo_TuyaWeekSelect = 5923,
|
||||
Zo_TuyaWindowDetection = 5938,
|
||||
Zo_UnoccupiedCoolingSetpoint = 5958,
|
||||
Zo_UnoccupiedHeatingSetpoint = 5984,
|
||||
Zo_UtilityName = 6010,
|
||||
Zo_ValidUntilTime = 6022,
|
||||
Zo_ValvePosition = 6037,
|
||||
Zo_VelocityLift = 6051,
|
||||
Zo_ViewGroup = 6064,
|
||||
Zo_ViewScene = 6074,
|
||||
Zo_Water = 6084,
|
||||
Zo_WhitePointX = 6090,
|
||||
Zo_WhitePointY = 6102,
|
||||
Zo_WindowCoveringType = 6114,
|
||||
Zo_X = 6133,
|
||||
Zo_Y = 6135,
|
||||
Zo_ZCLVersion = 6137,
|
||||
Zo_ZoneState = 6148,
|
||||
Zo_ZoneStatus = 6158,
|
||||
Zo_ZoneStatusChange = 6169,
|
||||
Zo_ZoneType = 6186,
|
||||
Zo_xx = 6195,
|
||||
Zo_xx000A00 = 6198,
|
||||
Zo_xx0A = 6207,
|
||||
Zo_xx0A00 = 6212,
|
||||
Zo_xx19 = 6219,
|
||||
Zo_xx190A = 6224,
|
||||
Zo_xx190A00 = 6231,
|
||||
Zo_xxxx = 6240,
|
||||
Zo_xxxx00 = 6245,
|
||||
Zo_xxxx0A00 = 6252,
|
||||
Zo_xxxxyy = 6261,
|
||||
Zo_xxxxyyyy = 6268,
|
||||
Zo_xxxxyyyy0A00 = 6277,
|
||||
Zo_xxxxyyzz = 6290,
|
||||
Zo_xxyy = 6299,
|
||||
Zo_xxyy0A00 = 6304,
|
||||
Zo_xxyyyy = 6313,
|
||||
Zo_xxyyyy000000000000 = 6320,
|
||||
Zo_xxyyyy0A0000000000 = 6339,
|
||||
Zo_xxyyyyzz = 6358,
|
||||
Zo_xxyyyyzzzz = 6367,
|
||||
Zo_xxyyzzzz = 6378,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -509,6 +509,7 @@ 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 },
|
||||
{ Zoctstr, Cx0300, 0xFFF0, Z_(RGB), Cm1, 0 }, // synthetic argument to show color as RGB (converted from HueSat or XY)
|
||||
|
||||
// Illuminance Measurement cluster
|
||||
{ Zuint16, Cx0400, 0x0000, Z_(Illuminance), Cm1 + Z_EXPORT_DATA, Z_MAPPING(Z_Data_PIR, illuminance) }, // Illuminance (in Lux)
|
||||
|
@ -1332,7 +1333,38 @@ void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 0x04030000: // Pressure
|
||||
case 0x03000000: // Hue
|
||||
case 0x03000001: // Sat
|
||||
case 0x03000003: // X
|
||||
case 0x03000004: // Y
|
||||
{ // generate synthetic RGB
|
||||
const Z_attribute * attr_rgb = attr_list.findAttribute(0x0300, 0xFFF0);
|
||||
if (attr_rgb == nullptr) { // make sure we didn't already computed it
|
||||
uint8_t r,g,b;
|
||||
bool is_rgb = false;
|
||||
const Z_attribute * attr_hue = attr_list.findAttribute(0x0300, 0x0000);
|
||||
const Z_attribute * attr_sat = attr_list.findAttribute(0x0300, 0x0001);
|
||||
const Z_attribute * attr_x = attr_list.findAttribute(0x0300, 0x0003);
|
||||
const Z_attribute * attr_y = attr_list.findAttribute(0x0300, 0x0004);
|
||||
if (attr_hue && attr_sat) {
|
||||
uint8_t sat = changeUIntScale(attr_sat->getUInt(), 0, 254, 0, 255);
|
||||
HsToRgb(attr_hue->getUInt(), sat, &r, &g, &b);
|
||||
is_rgb = true;
|
||||
} else if (attr_x && attr_y) {
|
||||
XyToRgb(attr_x->getUInt() / 65535.0f, attr_y->getUInt() / 65535.0f, &r, &g, &b);
|
||||
is_rgb = true;
|
||||
}
|
||||
if (is_rgb) {
|
||||
SBuffer rgb(3);
|
||||
rgb.add8(r);
|
||||
rgb.add8(g);
|
||||
rgb.add8(b);
|
||||
attr_list.addAttribute(0x0300, 0xFFF0).setBuf(rgb, 0, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x04030000: // SeaPressure
|
||||
{
|
||||
int16_t pressure = attr.getInt();
|
||||
int16_t pressure_sealevel = (pressure / FastPrecisePow(1.0 - ((float)Settings.altitude / 44330.0f), 5.255f)) - 21.6f;
|
||||
|
|
Loading…
Reference in New Issue