Merge pull request #10146 from s-hadinger/zigbee_trv_host

Zigbee support for Eurotronic TRV HostFlags
This commit is contained in:
Theo Arends 2020-12-15 21:09:34 +01:00 committed by GitHub
commit c10322562f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 257 additions and 217 deletions

View File

@ -275,6 +275,11 @@ const char Z_strings[] PROGMEM =
"ValvePosition" "\x00"
"EurotronicErrors" "\x00"
"CurrentTemperatureSetPoint" "\x00"
"EurotronicHostFlags" "\x00"
"TRVMirrorDisplay" "\x00"
"TRVBoost" "\x00"
"TRVWindowOpen" "\x00"
"TRVChildProtection" "\x00"
"ThSetpoint" "\x00"
"TempTarget" "\x00"
"Hue" "\x00"
@ -691,218 +696,223 @@ enum Z_offsets {
Zo_ValvePosition = 3473,
Zo_EurotronicErrors = 3487,
Zo_CurrentTemperatureSetPoint = 3504,
Zo_ThSetpoint = 3531,
Zo_TempTarget = 3542,
Zo_Hue = 3553,
Zo_Sat = 3557,
Zo_RemainingTime = 3561,
Zo_X = 3575,
Zo_Y = 3577,
Zo_DriftCompensation = 3579,
Zo_CompensationText = 3597,
Zo_CT = 3614,
Zo_ColorMode = 3617,
Zo_NumberOfPrimaries = 3627,
Zo_Primary1X = 3645,
Zo_Primary1Y = 3655,
Zo_Primary1Intensity = 3665,
Zo_Primary2X = 3683,
Zo_Primary2Y = 3693,
Zo_Primary2Intensity = 3703,
Zo_Primary3X = 3721,
Zo_Primary3Y = 3731,
Zo_Primary3Intensity = 3741,
Zo_WhitePointX = 3759,
Zo_WhitePointY = 3771,
Zo_ColorPointRX = 3783,
Zo_ColorPointRY = 3796,
Zo_ColorPointRIntensity = 3809,
Zo_ColorPointGX = 3830,
Zo_ColorPointGY = 3843,
Zo_ColorPointGIntensity = 3856,
Zo_ColorPointBX = 3877,
Zo_ColorPointBY = 3890,
Zo_ColorPointBIntensity = 3903,
Zo_Illuminance = 3924,
Zo_IlluminanceMinMeasuredValue = 3936,
Zo_IlluminanceMaxMeasuredValue = 3964,
Zo_IlluminanceTolerance = 3992,
Zo_IlluminanceLightSensorType = 4013,
Zo_IlluminanceLevelStatus = 4040,
Zo_IlluminanceTargetLevel = 4063,
Zo_Temperature = 4086,
Zo_TemperatureMinMeasuredValue = 4098,
Zo_TemperatureMaxMeasuredValue = 4126,
Zo_TemperatureTolerance = 4154,
Zo_Pressure = 4175,
Zo_PressureMinMeasuredValue = 4184,
Zo_PressureMaxMeasuredValue = 4209,
Zo_PressureTolerance = 4234,
Zo_PressureScaledValue = 4252,
Zo_PressureMinScaledValue = 4272,
Zo_PressureMaxScaledValue = 4295,
Zo_PressureScaledTolerance = 4318,
Zo_PressureScale = 4342,
Zo_SeaPressure = 4356,
Zo_FlowRate = 4368,
Zo_FlowMinMeasuredValue = 4377,
Zo_FlowMaxMeasuredValue = 4398,
Zo_FlowTolerance = 4419,
Zo_Humidity = 4433,
Zo_HumidityMinMeasuredValue = 4442,
Zo_HumidityMaxMeasuredValue = 4467,
Zo_HumidityTolerance = 4492,
Zo_Occupancy = 4510,
Zo_OccupancySensorType = 4520,
Zo_ZoneState = 4540,
Zo_ZoneType = 4550,
Zo_ZoneStatus = 4559,
Zo_CIE = 4570,
Zo_Contact = 4574,
Zo_Fire = 4582,
Zo_Water = 4587,
Zo_CO = 4593,
Zo_PersonalAlarm = 4596,
Zo_Movement = 4610,
Zo_Panic = 4619,
Zo_GlassBreak = 4625,
Zo_EnergyTotal = 4636,
Zo_CompanyName = 4648,
Zo_MeterTypeID = 4660,
Zo_DataQualityID = 4672,
Zo_CustomerName = 4686,
Zo_Model = 4699,
Zo_PartNumber = 4705,
Zo_ProductRevision = 4716,
Zo_SoftwareRevision = 4732,
Zo_UtilityName = 4749,
Zo_POD = 4761,
Zo_AvailablePower = 4765,
Zo_PowerThreshold = 4780,
Zo_RMSVoltage = 4795,
Zo_RMSCurrent = 4806,
Zo_ActivePower = 4817,
Zo_ReactivePower = 4829,
Zo_ApparentPower = 4843,
Zo_NumberOfResets = 4857,
Zo_PersistentMemoryWrites = 4872,
Zo_LastMessageLQI = 4895,
Zo_LastMessageRSSI = 4910,
Zo_TuyaScheduleWorkdays = 4926,
Zo_TuyaScheduleHolidays = 4947,
Zo_Power2 = 4968,
Zo_Power3 = 4975,
Zo_Power4 = 4982,
Zo_TuyaChildLock = 4989,
Zo_TuyaWindowDetection = 5003,
Zo_TuyaValveDetection = 5023,
Zo_TuyaAutoLock = 5042,
Zo_TuyaTempTarget = 5055,
Zo_TuyaBattery = 5070,
Zo_TuyaMinTemp = 5082,
Zo_TuyaMaxTemp = 5094,
Zo_TuyaBoostTime = 5106,
Zo_TuyaComfortTemp = 5120,
Zo_TuyaEcoTemp = 5136,
Zo_TuyaValvePosition = 5148,
Zo_TuyaAwayTemp = 5166,
Zo_TuyaAwayDays = 5179,
Zo_TuyaPreset = 5192,
Zo_TuyaFanMode = 5203,
Zo_TuyaForceMode = 5215,
Zo_TuyaWeekSelect = 5229,
Zo_OppleMode = 5244,
Zo_TerncyDuration = 5254,
Zo_TerncyRotate = 5269,
Zo_Identify = 5282,
Zo_xxxx = 5291,
Zo_IdentifyQuery = 5296,
Zo_AddGroup = 5310,
Zo_xxxx00 = 5319,
Zo_ViewGroup = 5326,
Zo_GetGroup = 5336,
Zo_01xxxx = 5345,
Zo_GetAllGroups = 5352,
Zo_00 = 5365,
Zo_RemoveGroup = 5368,
Zo_RemoveAllGroups = 5380,
Zo_ViewScene = 5396,
Zo_xxxxyy = 5406,
Zo_RemoveScene = 5413,
Zo_RemoveAllScenes = 5425,
Zo_RecallScene = 5441,
Zo_GetSceneMembership = 5453,
Zo_PowerOffEffect = 5472,
Zo_xxyy = 5487,
Zo_PowerOnRecall = 5492,
Zo_PowerOnTimer = 5506,
Zo_xxyyyyzzzz = 5519,
Zo_xx0A00 = 5530,
Zo_DimmerUp = 5537,
Zo_00190200 = 5546,
Zo_DimmerDown = 5555,
Zo_01190200 = 5566,
Zo_DimmerStop = 5575,
Zo_ResetAlarm = 5586,
Zo_xxyyyy = 5597,
Zo_ResetAllAlarms = 5604,
Zo_xx000A00 = 5619,
Zo_HueSat = 5628,
Zo_xxyy0A00 = 5635,
Zo_Color = 5644,
Zo_xxxxyyyy0A00 = 5650,
Zo_xxxx0A00 = 5663,
Zo_ShutterOpen = 5672,
Zo_ShutterClose = 5684,
Zo_ShutterStop = 5697,
Zo_ShutterLift = 5709,
Zo_xx = 5721,
Zo_ShutterTilt = 5724,
Zo_Shutter = 5736,
Zo_DimmerMove = 5744,
Zo_xx0A = 5755,
Zo_DimmerStepUp = 5760,
Zo_00xx0A00 = 5773,
Zo_DimmerStepDown = 5782,
Zo_01xx0A00 = 5797,
Zo_DimmerStep = 5806,
Zo_xx190A00 = 5817,
Zo_01 = 5826,
Zo_HueMove = 5829,
Zo_xx19 = 5837,
Zo_HueStepUp = 5842,
Zo_HueStepDown = 5852,
Zo_03xx0A00 = 5864,
Zo_HueStep = 5873,
Zo_SatMove = 5881,
Zo_SatStep = 5889,
Zo_xx190A = 5897,
Zo_ColorMove = 5904,
Zo_xxxxyyyy = 5914,
Zo_ColorStep = 5923,
Zo_ColorTempMoveUp = 5933,
Zo_01xxxx000000000000 = 5949,
Zo_ColorTempMoveDown = 5968,
Zo_03xxxx000000000000 = 5986,
Zo_ColorTempMoveStop = 6005,
Zo_00xxxx000000000000 = 6023,
Zo_ColorTempMove = 6042,
Zo_xxyyyy000000000000 = 6056,
Zo_ColorTempStepUp = 6075,
Zo_01xxxx0A0000000000 = 6091,
Zo_ColorTempStepDown = 6110,
Zo_03xxxx0A0000000000 = 6128,
Zo_ColorTempStep = 6147,
Zo_xxyyyy0A0000000000 = 6161,
Zo_ArrowClick = 6180,
Zo_ArrowHold = 6191,
Zo_ArrowRelease = 6201,
Zo_ZoneStatusChange = 6214,
Zo_xxxxyyzz = 6231,
Zo_xxyyzzzz = 6240,
Zo_AddScene = 6249,
Zo_xxyyyyzz = 6258,
Zo_StoreScene = 6267,
Zo_EurotronicHostFlags = 3531,
Zo_TRVMirrorDisplay = 3551,
Zo_TRVBoost = 3568,
Zo_TRVWindowOpen = 3577,
Zo_TRVChildProtection = 3591,
Zo_ThSetpoint = 3610,
Zo_TempTarget = 3621,
Zo_Hue = 3632,
Zo_Sat = 3636,
Zo_RemainingTime = 3640,
Zo_X = 3654,
Zo_Y = 3656,
Zo_DriftCompensation = 3658,
Zo_CompensationText = 3676,
Zo_CT = 3693,
Zo_ColorMode = 3696,
Zo_NumberOfPrimaries = 3706,
Zo_Primary1X = 3724,
Zo_Primary1Y = 3734,
Zo_Primary1Intensity = 3744,
Zo_Primary2X = 3762,
Zo_Primary2Y = 3772,
Zo_Primary2Intensity = 3782,
Zo_Primary3X = 3800,
Zo_Primary3Y = 3810,
Zo_Primary3Intensity = 3820,
Zo_WhitePointX = 3838,
Zo_WhitePointY = 3850,
Zo_ColorPointRX = 3862,
Zo_ColorPointRY = 3875,
Zo_ColorPointRIntensity = 3888,
Zo_ColorPointGX = 3909,
Zo_ColorPointGY = 3922,
Zo_ColorPointGIntensity = 3935,
Zo_ColorPointBX = 3956,
Zo_ColorPointBY = 3969,
Zo_ColorPointBIntensity = 3982,
Zo_Illuminance = 4003,
Zo_IlluminanceMinMeasuredValue = 4015,
Zo_IlluminanceMaxMeasuredValue = 4043,
Zo_IlluminanceTolerance = 4071,
Zo_IlluminanceLightSensorType = 4092,
Zo_IlluminanceLevelStatus = 4119,
Zo_IlluminanceTargetLevel = 4142,
Zo_Temperature = 4165,
Zo_TemperatureMinMeasuredValue = 4177,
Zo_TemperatureMaxMeasuredValue = 4205,
Zo_TemperatureTolerance = 4233,
Zo_Pressure = 4254,
Zo_PressureMinMeasuredValue = 4263,
Zo_PressureMaxMeasuredValue = 4288,
Zo_PressureTolerance = 4313,
Zo_PressureScaledValue = 4331,
Zo_PressureMinScaledValue = 4351,
Zo_PressureMaxScaledValue = 4374,
Zo_PressureScaledTolerance = 4397,
Zo_PressureScale = 4421,
Zo_SeaPressure = 4435,
Zo_FlowRate = 4447,
Zo_FlowMinMeasuredValue = 4456,
Zo_FlowMaxMeasuredValue = 4477,
Zo_FlowTolerance = 4498,
Zo_Humidity = 4512,
Zo_HumidityMinMeasuredValue = 4521,
Zo_HumidityMaxMeasuredValue = 4546,
Zo_HumidityTolerance = 4571,
Zo_Occupancy = 4589,
Zo_OccupancySensorType = 4599,
Zo_ZoneState = 4619,
Zo_ZoneType = 4629,
Zo_ZoneStatus = 4638,
Zo_CIE = 4649,
Zo_Contact = 4653,
Zo_Fire = 4661,
Zo_Water = 4666,
Zo_CO = 4672,
Zo_PersonalAlarm = 4675,
Zo_Movement = 4689,
Zo_Panic = 4698,
Zo_GlassBreak = 4704,
Zo_EnergyTotal = 4715,
Zo_CompanyName = 4727,
Zo_MeterTypeID = 4739,
Zo_DataQualityID = 4751,
Zo_CustomerName = 4765,
Zo_Model = 4778,
Zo_PartNumber = 4784,
Zo_ProductRevision = 4795,
Zo_SoftwareRevision = 4811,
Zo_UtilityName = 4828,
Zo_POD = 4840,
Zo_AvailablePower = 4844,
Zo_PowerThreshold = 4859,
Zo_RMSVoltage = 4874,
Zo_RMSCurrent = 4885,
Zo_ActivePower = 4896,
Zo_ReactivePower = 4908,
Zo_ApparentPower = 4922,
Zo_NumberOfResets = 4936,
Zo_PersistentMemoryWrites = 4951,
Zo_LastMessageLQI = 4974,
Zo_LastMessageRSSI = 4989,
Zo_TuyaScheduleWorkdays = 5005,
Zo_TuyaScheduleHolidays = 5026,
Zo_Power2 = 5047,
Zo_Power3 = 5054,
Zo_Power4 = 5061,
Zo_TuyaChildLock = 5068,
Zo_TuyaWindowDetection = 5082,
Zo_TuyaValveDetection = 5102,
Zo_TuyaAutoLock = 5121,
Zo_TuyaTempTarget = 5134,
Zo_TuyaBattery = 5149,
Zo_TuyaMinTemp = 5161,
Zo_TuyaMaxTemp = 5173,
Zo_TuyaBoostTime = 5185,
Zo_TuyaComfortTemp = 5199,
Zo_TuyaEcoTemp = 5215,
Zo_TuyaValvePosition = 5227,
Zo_TuyaAwayTemp = 5245,
Zo_TuyaAwayDays = 5258,
Zo_TuyaPreset = 5271,
Zo_TuyaFanMode = 5282,
Zo_TuyaForceMode = 5294,
Zo_TuyaWeekSelect = 5308,
Zo_OppleMode = 5323,
Zo_TerncyDuration = 5333,
Zo_TerncyRotate = 5348,
Zo_Identify = 5361,
Zo_xxxx = 5370,
Zo_IdentifyQuery = 5375,
Zo_AddGroup = 5389,
Zo_xxxx00 = 5398,
Zo_ViewGroup = 5405,
Zo_GetGroup = 5415,
Zo_01xxxx = 5424,
Zo_GetAllGroups = 5431,
Zo_00 = 5444,
Zo_RemoveGroup = 5447,
Zo_RemoveAllGroups = 5459,
Zo_ViewScene = 5475,
Zo_xxxxyy = 5485,
Zo_RemoveScene = 5492,
Zo_RemoveAllScenes = 5504,
Zo_RecallScene = 5520,
Zo_GetSceneMembership = 5532,
Zo_PowerOffEffect = 5551,
Zo_xxyy = 5566,
Zo_PowerOnRecall = 5571,
Zo_PowerOnTimer = 5585,
Zo_xxyyyyzzzz = 5598,
Zo_xx0A00 = 5609,
Zo_DimmerUp = 5616,
Zo_00190200 = 5625,
Zo_DimmerDown = 5634,
Zo_01190200 = 5645,
Zo_DimmerStop = 5654,
Zo_ResetAlarm = 5665,
Zo_xxyyyy = 5676,
Zo_ResetAllAlarms = 5683,
Zo_xx000A00 = 5698,
Zo_HueSat = 5707,
Zo_xxyy0A00 = 5714,
Zo_Color = 5723,
Zo_xxxxyyyy0A00 = 5729,
Zo_xxxx0A00 = 5742,
Zo_ShutterOpen = 5751,
Zo_ShutterClose = 5763,
Zo_ShutterStop = 5776,
Zo_ShutterLift = 5788,
Zo_xx = 5800,
Zo_ShutterTilt = 5803,
Zo_Shutter = 5815,
Zo_DimmerMove = 5823,
Zo_xx0A = 5834,
Zo_DimmerStepUp = 5839,
Zo_00xx0A00 = 5852,
Zo_DimmerStepDown = 5861,
Zo_01xx0A00 = 5876,
Zo_DimmerStep = 5885,
Zo_xx190A00 = 5896,
Zo_01 = 5905,
Zo_HueMove = 5908,
Zo_xx19 = 5916,
Zo_HueStepUp = 5921,
Zo_HueStepDown = 5931,
Zo_03xx0A00 = 5943,
Zo_HueStep = 5952,
Zo_SatMove = 5960,
Zo_SatStep = 5968,
Zo_xx190A = 5976,
Zo_ColorMove = 5983,
Zo_xxxxyyyy = 5993,
Zo_ColorStep = 6002,
Zo_ColorTempMoveUp = 6012,
Zo_01xxxx000000000000 = 6028,
Zo_ColorTempMoveDown = 6047,
Zo_03xxxx000000000000 = 6065,
Zo_ColorTempMoveStop = 6084,
Zo_00xxxx000000000000 = 6102,
Zo_ColorTempMove = 6121,
Zo_xxyyyy000000000000 = 6135,
Zo_ColorTempStepUp = 6154,
Zo_01xxxx0A0000000000 = 6170,
Zo_ColorTempStepDown = 6189,
Zo_03xxxx0A0000000000 = 6207,
Zo_ColorTempStep = 6226,
Zo_xxyyyy0A0000000000 = 6240,
Zo_ArrowClick = 6259,
Zo_ArrowHold = 6270,
Zo_ArrowRelease = 6280,
Zo_ZoneStatusChange = 6293,
Zo_xxxxyyzz = 6310,
Zo_xxyyzzzz = 6319,
Zo_AddScene = 6328,
Zo_xxyyyyzz = 6337,
Zo_StoreScene = 6346,
};

View File

@ -466,6 +466,13 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = {
{ Zuint8, Cx0201, 0x4001, Z_(ValvePosition), Cm1, 0 },
{ Zuint8, Cx0201, 0x4002, Z_(EurotronicErrors), Cm1, 0 },
{ Zint16, Cx0201, 0x4003, Z_(CurrentTemperatureSetPoint), Cm_100, 0 },
{ Zuint24, Cx0201, 0x4008, Z_(EurotronicHostFlags), Cm1, 0 },
// below are synthetic virtual attributes used to decode EurotronicHostFlags
// Last byte acts as a field mask for the lowest byte value
{ Zbool, Cx0201, 0xF002, Z_(TRVMirrorDisplay), Cm1, 0 },
{ Zbool, Cx0201, 0xF004, Z_(TRVBoost), Cm1, 0 },
{ Zbool, Cx0201, 0xF010, Z_(TRVWindowOpen), Cm1, 0 },
{ Zbool, Cx0201, 0xF080, Z_(TRVChildProtection), Cm1, 0 },
// below are virtual attributes to simplify ZbData import/export
{ 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) },
@ -879,6 +886,11 @@ int32_t encodeSingleAttribute(class SBuffer &buf, double val_d, const char *val_
buf.add16(u32);
break;
// unisgned 32
case Zuint24:
buf.add16(u32);
buf.add8(u32 >> 16);
break;
// unisgned 24
case Zuint32: // uint32
case Zdata32: // data32
case Zmap32: // map32
@ -974,6 +986,15 @@ uint32_t parseSingleAttribute(Z_attribute & attr, const SBuffer &buf,
}
}
break;
case Zuint24:
{
uint32_t uint24_val = buf.get16(i) + (buf.get8(i+2) >> 16);
// i += 3;
if (0xFFFFFF != uint24_val) {
attr.setUInt(uint24_val);
}
}
break;
case Zuint32: // uint32
case ZUTC: // UTC
{
@ -1280,15 +1301,24 @@ void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) {
}
break;
case 0x02010008: // Pi Heating Demand - solve Eutotronic bug
case 0x02014008: // Eurotronic Host Flags decoding
{
const char * manufacturer_c = zigbee_devices.getManufacturerId(_srcaddr); // null if unknown
String manufacturerId((char*) manufacturer_c);
if (manufacturerId.equals(F("Eurotronic"))) {
// Eurotronic does not report 0..100 but 0..255, including 255 which is normally an ivalid value
uint8_t valve = attr.getUInt();
if (attr.isNone()) { valve = 255; }
uint8_t valve_100 = changeUIntScale(valve, 0, 255, 0, 100);
attr.setUInt(valve_100);
if (ccccaaaa == 0x02010008) {
// Eurotronic does not report 0..100 but 0..255, including 255 which is normally an ivalid value
uint8_t valve = attr.getUInt();
if (attr.isNone()) { valve = 255; }
uint8_t valve_100 = changeUIntScale(valve, 0, 255, 0, 100);
attr.setUInt(valve_100);
} else if (ccccaaaa == 0x02014008) {
uint32_t mode = attr.getUInt();
if (mode & 0x02) { attr_list.addAttribute(0x0201, 0xF002).setUInt(1); }
if (mode & 0x04) { attr_list.addAttribute(0x0201, 0xF004).setUInt(1); }
if (mode & 0x10) { attr_list.addAttribute(0x0201, 0xF010).setUInt(1); }
if (mode & 0x80) { attr_list.addAttribute(0x0201, 0xF080).setUInt(1); }
}
}
}
break;