Zigbee support for Thermostat cluster

This commit is contained in:
Stephan Hadinger 2020-09-27 15:26:06 +02:00
parent b95a193711
commit d48f4b938b
2 changed files with 238 additions and 178 deletions

View File

@ -259,6 +259,25 @@ const char Z_strings[] PROGMEM =
"DecelerationTimeLift" "\x00"
"IntermediateSetpointsLift" "\x00"
"IntermediateSetpointsTilt" "\x00"
"LocalTemperature" "\x00"
"OutdoorTemperature" "\x00"
"PICoolingDemand" "\x00"
"PIHeatingDemand" "\x00"
"LocalTemperatureCalibration" "\x00"
"OccupiedCoolingSetpoint" "\x00"
"OccupiedHeatingSetpoint" "\x00"
"UnoccupiedCoolingSetpoint" "\x00"
"UnoccupiedHeatingSetpoint" "\x00"
"MinHeatSetpointLimit" "\x00"
"MaxHeatSetpointLimit" "\x00"
"MinCoolSetpointLimit" "\x00"
"MaxCoolSetpointLimit" "\x00"
"ControlSequenceOfOperation" "\x00"
"SystemMode" "\x00"
"TRVMode" "\x00"
"SetValvePosition" "\x00"
"ThErrors" "\x00"
"CurrentTemperatureSetPoint" "\x00"
"Hue" "\x00"
"Sat" "\x00"
"RemainingTime" "\x00"
@ -300,7 +319,6 @@ const char Z_strings[] PROGMEM =
"TemperatureMinMeasuredValue" "\x00"
"TemperatureMaxMeasuredValue" "\x00"
"TemperatureTolerance" "\x00"
"PressureUnit" "\x00"
"Pressure" "\x00"
"PressureMinMeasuredValue" "\x00"
"PressureMaxMeasuredValue" "\x00"
@ -620,179 +638,197 @@ enum Z_offsets {
Zo_DecelerationTimeLift = 3144,
Zo_IntermediateSetpointsLift = 3165,
Zo_IntermediateSetpointsTilt = 3191,
Zo_Hue = 3217,
Zo_Sat = 3221,
Zo_RemainingTime = 3225,
Zo_X = 3239,
Zo_Y = 3241,
Zo_DriftCompensation = 3243,
Zo_CompensationText = 3261,
Zo_CT = 3278,
Zo_ColorMode = 3281,
Zo_NumberOfPrimaries = 3291,
Zo_Primary1X = 3309,
Zo_Primary1Y = 3319,
Zo_Primary1Intensity = 3329,
Zo_Primary2X = 3347,
Zo_Primary2Y = 3357,
Zo_Primary2Intensity = 3367,
Zo_Primary3X = 3385,
Zo_Primary3Y = 3395,
Zo_Primary3Intensity = 3405,
Zo_WhitePointX = 3423,
Zo_WhitePointY = 3435,
Zo_ColorPointRX = 3447,
Zo_ColorPointRY = 3460,
Zo_ColorPointRIntensity = 3473,
Zo_ColorPointGX = 3494,
Zo_ColorPointGY = 3507,
Zo_ColorPointGIntensity = 3520,
Zo_ColorPointBX = 3541,
Zo_ColorPointBY = 3554,
Zo_ColorPointBIntensity = 3567,
Zo_Illuminance = 3588,
Zo_IlluminanceMinMeasuredValue = 3600,
Zo_IlluminanceMaxMeasuredValue = 3628,
Zo_IlluminanceTolerance = 3656,
Zo_IlluminanceLightSensorType = 3677,
Zo_IlluminanceLevelStatus = 3704,
Zo_IlluminanceTargetLevel = 3727,
Zo_Temperature = 3750,
Zo_TemperatureMinMeasuredValue = 3762,
Zo_TemperatureMaxMeasuredValue = 3790,
Zo_TemperatureTolerance = 3818,
Zo_PressureUnit = 3839,
Zo_Pressure = 3852,
Zo_PressureMinMeasuredValue = 3861,
Zo_PressureMaxMeasuredValue = 3886,
Zo_PressureTolerance = 3911,
Zo_PressureScaledValue = 3929,
Zo_PressureMinScaledValue = 3949,
Zo_PressureMaxScaledValue = 3972,
Zo_PressureScaledTolerance = 3995,
Zo_PressureScale = 4019,
Zo_FlowRate = 4033,
Zo_FlowMinMeasuredValue = 4042,
Zo_FlowMaxMeasuredValue = 4063,
Zo_FlowTolerance = 4084,
Zo_Humidity = 4098,
Zo_HumidityMinMeasuredValue = 4107,
Zo_HumidityMaxMeasuredValue = 4132,
Zo_HumidityTolerance = 4157,
Zo_Occupancy = 4175,
Zo_OccupancySensorType = 4185,
Zo_ZoneState = 4205,
Zo_ZoneType = 4215,
Zo_ZoneStatus = 4224,
Zo_CurrentSummDelivered = 4235,
Zo_CompanyName = 4256,
Zo_MeterTypeID = 4268,
Zo_DataQualityID = 4280,
Zo_CustomerName = 4294,
Zo_Model = 4307,
Zo_PartNumber = 4313,
Zo_ProductRevision = 4324,
Zo_SoftwareRevision = 4340,
Zo_UtilityName = 4357,
Zo_POD = 4369,
Zo_AvailablePower = 4373,
Zo_PowerThreshold = 4388,
Zo_RMSVoltage = 4403,
Zo_RMSCurrent = 4414,
Zo_ActivePower = 4425,
Zo_NumberOfResets = 4437,
Zo_PersistentMemoryWrites = 4452,
Zo_LastMessageLQI = 4475,
Zo_LastMessageRSSI = 4490,
Zo_Identify = 4506,
Zo_xxxx = 4515,
Zo_IdentifyQuery = 4520,
Zo_AddGroup = 4534,
Zo_xxxx00 = 4543,
Zo_ViewGroup = 4550,
Zo_GetGroup = 4560,
Zo_01xxxx = 4569,
Zo_GetAllGroups = 4576,
Zo_00 = 4589,
Zo_RemoveGroup = 4592,
Zo_RemoveAllGroups = 4604,
Zo_ViewScene = 4620,
Zo_xxxxyy = 4630,
Zo_RemoveScene = 4637,
Zo_RemoveAllScenes = 4649,
Zo_RecallScene = 4665,
Zo_GetSceneMembership = 4677,
Zo_PowerOffEffect = 4696,
Zo_xxyy = 4711,
Zo_PowerOnRecall = 4716,
Zo_PowerOnTimer = 4730,
Zo_xxyyyyzzzz = 4743,
Zo_xx0A00 = 4754,
Zo_DimmerUp = 4761,
Zo_00190200 = 4770,
Zo_DimmerDown = 4779,
Zo_01190200 = 4790,
Zo_DimmerStop = 4799,
Zo_ResetAlarm = 4810,
Zo_xxyyyy = 4821,
Zo_ResetAllAlarms = 4828,
Zo_xx000A00 = 4843,
Zo_HueSat = 4852,
Zo_xxyy0A00 = 4859,
Zo_Color = 4868,
Zo_xxxxyyyy0A00 = 4874,
Zo_xxxx0A00 = 4887,
Zo_ShutterOpen = 4896,
Zo_ShutterClose = 4908,
Zo_ShutterStop = 4921,
Zo_ShutterLift = 4933,
Zo_xx = 4945,
Zo_ShutterTilt = 4948,
Zo_Shutter = 4960,
Zo_DimmerMove = 4968,
Zo_xx0A = 4979,
Zo_DimmerStepUp = 4984,
Zo_00xx0A00 = 4997,
Zo_DimmerStepDown = 5006,
Zo_01xx0A00 = 5021,
Zo_DimmerStep = 5030,
Zo_xx190A00 = 5041,
Zo_01 = 5050,
Zo_HueMove = 5053,
Zo_xx19 = 5061,
Zo_HueStepUp = 5066,
Zo_HueStepDown = 5076,
Zo_03xx0A00 = 5088,
Zo_HueStep = 5097,
Zo_SatMove = 5105,
Zo_SatStep = 5113,
Zo_xx190A = 5121,
Zo_ColorMove = 5128,
Zo_xxxxyyyy = 5138,
Zo_ColorStep = 5147,
Zo_ColorTempMoveUp = 5157,
Zo_01xxxx000000000000 = 5173,
Zo_ColorTempMoveDown = 5192,
Zo_03xxxx000000000000 = 5210,
Zo_ColorTempMoveStop = 5229,
Zo_00xxxx000000000000 = 5247,
Zo_ColorTempMove = 5266,
Zo_xxyyyy000000000000 = 5280,
Zo_ColorTempStepUp = 5299,
Zo_01xxxx0A0000000000 = 5315,
Zo_ColorTempStepDown = 5334,
Zo_03xxxx0A0000000000 = 5352,
Zo_ColorTempStep = 5371,
Zo_xxyyyy0A0000000000 = 5385,
Zo_ArrowClick = 5404,
Zo_ArrowHold = 5415,
Zo_ArrowRelease = 5425,
Zo_ZoneStatusChange = 5438,
Zo_xxxxyyzz = 5455,
Zo_xxyyzzzz = 5464,
Zo_AddScene = 5473,
Zo_xxyyyyzz = 5482,
Zo_StoreScene = 5491,
Zo_LocalTemperature = 3217,
Zo_OutdoorTemperature = 3234,
Zo_PICoolingDemand = 3253,
Zo_PIHeatingDemand = 3269,
Zo_LocalTemperatureCalibration = 3285,
Zo_OccupiedCoolingSetpoint = 3313,
Zo_OccupiedHeatingSetpoint = 3337,
Zo_UnoccupiedCoolingSetpoint = 3361,
Zo_UnoccupiedHeatingSetpoint = 3387,
Zo_MinHeatSetpointLimit = 3413,
Zo_MaxHeatSetpointLimit = 3434,
Zo_MinCoolSetpointLimit = 3455,
Zo_MaxCoolSetpointLimit = 3476,
Zo_ControlSequenceOfOperation = 3497,
Zo_SystemMode = 3524,
Zo_TRVMode = 3535,
Zo_SetValvePosition = 3543,
Zo_ThErrors = 3560,
Zo_CurrentTemperatureSetPoint = 3569,
Zo_Hue = 3596,
Zo_Sat = 3600,
Zo_RemainingTime = 3604,
Zo_X = 3618,
Zo_Y = 3620,
Zo_DriftCompensation = 3622,
Zo_CompensationText = 3640,
Zo_CT = 3657,
Zo_ColorMode = 3660,
Zo_NumberOfPrimaries = 3670,
Zo_Primary1X = 3688,
Zo_Primary1Y = 3698,
Zo_Primary1Intensity = 3708,
Zo_Primary2X = 3726,
Zo_Primary2Y = 3736,
Zo_Primary2Intensity = 3746,
Zo_Primary3X = 3764,
Zo_Primary3Y = 3774,
Zo_Primary3Intensity = 3784,
Zo_WhitePointX = 3802,
Zo_WhitePointY = 3814,
Zo_ColorPointRX = 3826,
Zo_ColorPointRY = 3839,
Zo_ColorPointRIntensity = 3852,
Zo_ColorPointGX = 3873,
Zo_ColorPointGY = 3886,
Zo_ColorPointGIntensity = 3899,
Zo_ColorPointBX = 3920,
Zo_ColorPointBY = 3933,
Zo_ColorPointBIntensity = 3946,
Zo_Illuminance = 3967,
Zo_IlluminanceMinMeasuredValue = 3979,
Zo_IlluminanceMaxMeasuredValue = 4007,
Zo_IlluminanceTolerance = 4035,
Zo_IlluminanceLightSensorType = 4056,
Zo_IlluminanceLevelStatus = 4083,
Zo_IlluminanceTargetLevel = 4106,
Zo_Temperature = 4129,
Zo_TemperatureMinMeasuredValue = 4141,
Zo_TemperatureMaxMeasuredValue = 4169,
Zo_TemperatureTolerance = 4197,
Zo_Pressure = 4218,
Zo_PressureMinMeasuredValue = 4227,
Zo_PressureMaxMeasuredValue = 4252,
Zo_PressureTolerance = 4277,
Zo_PressureScaledValue = 4295,
Zo_PressureMinScaledValue = 4315,
Zo_PressureMaxScaledValue = 4338,
Zo_PressureScaledTolerance = 4361,
Zo_PressureScale = 4385,
Zo_FlowRate = 4399,
Zo_FlowMinMeasuredValue = 4408,
Zo_FlowMaxMeasuredValue = 4429,
Zo_FlowTolerance = 4450,
Zo_Humidity = 4464,
Zo_HumidityMinMeasuredValue = 4473,
Zo_HumidityMaxMeasuredValue = 4498,
Zo_HumidityTolerance = 4523,
Zo_Occupancy = 4541,
Zo_OccupancySensorType = 4551,
Zo_ZoneState = 4571,
Zo_ZoneType = 4581,
Zo_ZoneStatus = 4590,
Zo_CurrentSummDelivered = 4601,
Zo_CompanyName = 4622,
Zo_MeterTypeID = 4634,
Zo_DataQualityID = 4646,
Zo_CustomerName = 4660,
Zo_Model = 4673,
Zo_PartNumber = 4679,
Zo_ProductRevision = 4690,
Zo_SoftwareRevision = 4706,
Zo_UtilityName = 4723,
Zo_POD = 4735,
Zo_AvailablePower = 4739,
Zo_PowerThreshold = 4754,
Zo_RMSVoltage = 4769,
Zo_RMSCurrent = 4780,
Zo_ActivePower = 4791,
Zo_NumberOfResets = 4803,
Zo_PersistentMemoryWrites = 4818,
Zo_LastMessageLQI = 4841,
Zo_LastMessageRSSI = 4856,
Zo_Identify = 4872,
Zo_xxxx = 4881,
Zo_IdentifyQuery = 4886,
Zo_AddGroup = 4900,
Zo_xxxx00 = 4909,
Zo_ViewGroup = 4916,
Zo_GetGroup = 4926,
Zo_01xxxx = 4935,
Zo_GetAllGroups = 4942,
Zo_00 = 4955,
Zo_RemoveGroup = 4958,
Zo_RemoveAllGroups = 4970,
Zo_ViewScene = 4986,
Zo_xxxxyy = 4996,
Zo_RemoveScene = 5003,
Zo_RemoveAllScenes = 5015,
Zo_RecallScene = 5031,
Zo_GetSceneMembership = 5043,
Zo_PowerOffEffect = 5062,
Zo_xxyy = 5077,
Zo_PowerOnRecall = 5082,
Zo_PowerOnTimer = 5096,
Zo_xxyyyyzzzz = 5109,
Zo_xx0A00 = 5120,
Zo_DimmerUp = 5127,
Zo_00190200 = 5136,
Zo_DimmerDown = 5145,
Zo_01190200 = 5156,
Zo_DimmerStop = 5165,
Zo_ResetAlarm = 5176,
Zo_xxyyyy = 5187,
Zo_ResetAllAlarms = 5194,
Zo_xx000A00 = 5209,
Zo_HueSat = 5218,
Zo_xxyy0A00 = 5225,
Zo_Color = 5234,
Zo_xxxxyyyy0A00 = 5240,
Zo_xxxx0A00 = 5253,
Zo_ShutterOpen = 5262,
Zo_ShutterClose = 5274,
Zo_ShutterStop = 5287,
Zo_ShutterLift = 5299,
Zo_xx = 5311,
Zo_ShutterTilt = 5314,
Zo_Shutter = 5326,
Zo_DimmerMove = 5334,
Zo_xx0A = 5345,
Zo_DimmerStepUp = 5350,
Zo_00xx0A00 = 5363,
Zo_DimmerStepDown = 5372,
Zo_01xx0A00 = 5387,
Zo_DimmerStep = 5396,
Zo_xx190A00 = 5407,
Zo_01 = 5416,
Zo_HueMove = 5419,
Zo_xx19 = 5427,
Zo_HueStepUp = 5432,
Zo_HueStepDown = 5442,
Zo_03xx0A00 = 5454,
Zo_HueStep = 5463,
Zo_SatMove = 5471,
Zo_SatStep = 5479,
Zo_xx190A = 5487,
Zo_ColorMove = 5494,
Zo_xxxxyyyy = 5504,
Zo_ColorStep = 5513,
Zo_ColorTempMoveUp = 5523,
Zo_01xxxx000000000000 = 5539,
Zo_ColorTempMoveDown = 5558,
Zo_03xxxx000000000000 = 5576,
Zo_ColorTempMoveStop = 5595,
Zo_00xxxx000000000000 = 5613,
Zo_ColorTempMove = 5632,
Zo_xxyyyy000000000000 = 5646,
Zo_ColorTempStepUp = 5665,
Zo_01xxxx0A0000000000 = 5681,
Zo_ColorTempStepDown = 5700,
Zo_03xxxx0A0000000000 = 5718,
Zo_ColorTempStep = 5737,
Zo_xxyyyy0A0000000000 = 5751,
Zo_ArrowClick = 5770,
Zo_ArrowHold = 5781,
Zo_ArrowRelease = 5791,
Zo_ZoneStatusChange = 5804,
Zo_xxxxyyzz = 5821,
Zo_xxyyzzzz = 5830,
Zo_AddScene = 5839,
Zo_xxyyyyzz = 5848,
Zo_StoreScene = 5857,
};

View File

@ -106,16 +106,16 @@ 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, Cx0300, Cx0400, Cx0401, Cx0402, Cx0403, Cx0404,
Cx0405, Cx0406, Cx0500, Cx0702, Cx0B01, Cx0B04, Cx0B05,
Cx0101, Cx0102, Cx0201, Cx0300, Cx0400, Cx0401, Cx0402, Cx0403,
Cx0404, Cx0405, Cx0406, Cx0500, Cx0702, Cx0B01, Cx0B04, Cx0B05,
};
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, 0x0300, 0x0400, 0x0401, 0x0402, 0x0403, 0x0404,
0x0405, 0x0406, 0x0500, 0x0702, 0x0B01, 0x0B04, 0x0B05,
0x0101, 0x0102, 0x0201, 0x0300, 0x0400, 0x0401, 0x0402, 0x0403,
0x0404, 0x0405, 0x0406, 0x0500, 0x0702, 0x0B01, 0x0B04, 0x0B05,
};
uint16_t CxToCluster(uint8_t cx) {
@ -403,6 +403,29 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zoctstr, Cx0102, 0x0018, Z_(IntermediateSetpointsLift),1 },
{ Zoctstr, Cx0102, 0x0019, Z_(IntermediateSetpointsTilt),1 },
// Thermostat
{ Zint16, Cx0201, 0x0000, Z_(LocalTemperature), -100 },
{ Zint16, Cx0201, 0x0001, Z_(OutdoorTemperature),-100 },
{ Zuint8, Cx0201, 0x0007, Z_(PICoolingDemand), 1 },
{ Zuint8, Cx0201, 0x0008, Z_(PIHeatingDemand), 1 },
{ Zint8, Cx0201, 0x0010, Z_(LocalTemperatureCalibration), -10 },
{ Zint16, Cx0201, 0x0011, Z_(OccupiedCoolingSetpoint), -100 },
{ Zint16, Cx0201, 0x0012, Z_(OccupiedHeatingSetpoint), -100 },
{ Zint16, Cx0201, 0x0013, Z_(UnoccupiedCoolingSetpoint), -100 },
{ Zint16, Cx0201, 0x0014, Z_(UnoccupiedHeatingSetpoint), -100 },
{ Zint16, Cx0201, 0x0015, Z_(MinHeatSetpointLimit), -100 },
{ Zint16, Cx0201, 0x0016, Z_(MaxHeatSetpointLimit), -100 },
{ Zint16, Cx0201, 0x0017, Z_(MinCoolSetpointLimit), -100 },
{ Zint16, Cx0201, 0x0018, Z_(MaxCoolSetpointLimit), -100 },
{ Zmap8, Cx0201, 0x001A, Z_(MaxCoolSetpointLimit), 1 },
{ Zenum8, Cx0201, 0x001B, Z_(ControlSequenceOfOperation), 1 },
{ Zenum8, Cx0201, 0x001C, Z_(SystemMode), 1 },
// below is Eurotronic specific
{ Zenum8, Cx0201, 0x4000, Z_(TRVMode), 1 },
{ Zuint8, Cx0201, 0x4001, Z_(SetValvePosition), 1 },
{ Zuint8, Cx0201, 0x4002, Z_(ThErrors), 1 },
{ Zint16, Cx0201, 0x4003, Z_(CurrentTemperatureSetPoint), -100 },
// Color Control cluster
{ Zuint8, Cx0300, 0x0000, Z_(Hue), 1 },
{ Zuint8, Cx0300, 0x0001, Z_(Sat), 1 },
@ -1641,6 +1664,7 @@ void ZCLFrame::postProcessAttributes(uint16_t shortaddr, Z_attribute_list& attr_
case 0x00060000:
case 0x00068000: device.setPower(attr.getBool()); break;
case 0x00080000: device.dimmer = uval16; break;
case 0x02010000: device.temperature = fval * 10 + 0.5f; break;
case 0x03000000: device.hue = changeUIntScale(uval16, 0, 254, 0, 360); break;
case 0x03000001: device.sat = uval16; break;
case 0x03000003: device.x = uval16; break;