From c77f0a267b0c28e65e57f30d5fbfa9cdb1f3562f Mon Sep 17 00:00:00 2001 From: Stephan Hadinger Date: Sun, 27 Sep 2020 18:42:19 +0200 Subject: [PATCH] Zigbee Thermostat Eurotronic fixes --- tasmota/xdrv_23_zigbee_2_devices.ino | 12 +- tasmota/xdrv_23_zigbee_5__constants.ino | 370 ++++++++++++------------ tasmota/xdrv_23_zigbee_5_converters.ino | 35 ++- 3 files changed, 217 insertions(+), 200 deletions(-) diff --git a/tasmota/xdrv_23_zigbee_2_devices.ino b/tasmota/xdrv_23_zigbee_2_devices.ino index 0067744d3..4e16ea11f 100644 --- a/tasmota/xdrv_23_zigbee_2_devices.ino +++ b/tasmota/xdrv_23_zigbee_2_devices.ino @@ -72,10 +72,13 @@ public: int16_t temperature; // temperature in 1/10th of Celsius, 0x8000 if unknown uint16_t pressure; // air pressure in hPa, 0xFFFF if unknown uint8_t humidity; // humidity in percent, 0..100, 0xFF if unknown - // powe plug data + // power plug data uint16_t mains_voltage; // AC voltage int16_t mains_power; // Active power uint32_t last_seen; // Last seen time (epoch) + // thermostat + int16_t temperature_target; // settings for the temparature + uint8_t th_setpoint; // percentage of heat/cool in percent // Constructor with all defaults Z_Device(uint16_t _shortaddr = BAD_SHORTADDR, uint64_t _longaddr = 0x00): @@ -105,7 +108,9 @@ public: humidity(0xFF), mains_voltage(0xFFFF), mains_power(-0x8000), - last_seen(0) + last_seen(0), + temperature_target(-0x8000), + th_setpoint(0xFF) { }; inline bool valid(void) const { return BAD_SHORTADDR != shortaddr; } // is the device known, valid and found? @@ -132,6 +137,9 @@ public: inline bool validHumidity(void) const { return 0xFF != humidity; } inline bool validLastSeen(void) const { return 0x0 != last_seen; } + inline bool validTemperatureTarget(void) const { return -0x8000 != temperature_target; } + inline bool validThSetpoint(void) const { return 0xFF != th_setpoint; } + inline bool validMainsVoltage(void) const { return 0xFFFF != mains_voltage; } inline bool validMainsPower(void) const { return -0x8000 != mains_power; } diff --git a/tasmota/xdrv_23_zigbee_5__constants.ino b/tasmota/xdrv_23_zigbee_5__constants.ino index 43182c90d..7d35d7862 100644 --- a/tasmota/xdrv_23_zigbee_5__constants.ino +++ b/tasmota/xdrv_23_zigbee_5__constants.ino @@ -268,15 +268,12 @@ const char Z_strings[] PROGMEM = "OccupiedHeatingSetpoint" "\x00" "UnoccupiedCoolingSetpoint" "\x00" "UnoccupiedHeatingSetpoint" "\x00" - "MinHeatSetpointLimit" "\x00" - "MaxHeatSetpointLimit" "\x00" - "MinCoolSetpointLimit" "\x00" - "MaxCoolSetpointLimit" "\x00" + "RemoteSensing" "\x00" "ControlSequenceOfOperation" "\x00" "SystemMode" "\x00" "TRVMode" "\x00" "SetValvePosition" "\x00" - "ThErrors" "\x00" + "EurotronicErrors" "\x00" "CurrentTemperatureSetPoint" "\x00" "Hue" "\x00" "Sat" "\x00" @@ -648,189 +645,186 @@ enum Z_offsets { 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_SeaPressure = 4399, - Zo_FlowRate = 4411, - Zo_FlowMinMeasuredValue = 4420, - Zo_FlowMaxMeasuredValue = 4441, - Zo_FlowTolerance = 4462, - Zo_Humidity = 4476, - Zo_HumidityMinMeasuredValue = 4485, - Zo_HumidityMaxMeasuredValue = 4510, - Zo_HumidityTolerance = 4535, - Zo_Occupancy = 4553, - Zo_OccupancySensorType = 4563, - Zo_ZoneState = 4583, - Zo_ZoneType = 4593, - Zo_ZoneStatus = 4602, - Zo_CurrentSummDelivered = 4613, - Zo_CompanyName = 4634, - Zo_MeterTypeID = 4646, - Zo_DataQualityID = 4658, - Zo_CustomerName = 4672, - Zo_Model = 4685, - Zo_PartNumber = 4691, - Zo_ProductRevision = 4702, - Zo_SoftwareRevision = 4718, - Zo_UtilityName = 4735, - Zo_POD = 4747, - Zo_AvailablePower = 4751, - Zo_PowerThreshold = 4766, - Zo_RMSVoltage = 4781, - Zo_RMSCurrent = 4792, - Zo_ActivePower = 4803, - Zo_NumberOfResets = 4815, - Zo_PersistentMemoryWrites = 4830, - Zo_LastMessageLQI = 4853, - Zo_LastMessageRSSI = 4868, - Zo_Identify = 4884, - Zo_xxxx = 4893, - Zo_IdentifyQuery = 4898, - Zo_AddGroup = 4912, - Zo_xxxx00 = 4921, - Zo_ViewGroup = 4928, - Zo_GetGroup = 4938, - Zo_01xxxx = 4947, - Zo_GetAllGroups = 4954, - Zo_00 = 4967, - Zo_RemoveGroup = 4970, - Zo_RemoveAllGroups = 4982, - Zo_ViewScene = 4998, - Zo_xxxxyy = 5008, - Zo_RemoveScene = 5015, - Zo_RemoveAllScenes = 5027, - Zo_RecallScene = 5043, - Zo_GetSceneMembership = 5055, - Zo_PowerOffEffect = 5074, - Zo_xxyy = 5089, - Zo_PowerOnRecall = 5094, - Zo_PowerOnTimer = 5108, - Zo_xxyyyyzzzz = 5121, - Zo_xx0A00 = 5132, - Zo_DimmerUp = 5139, - Zo_00190200 = 5148, - Zo_DimmerDown = 5157, - Zo_01190200 = 5168, - Zo_DimmerStop = 5177, - Zo_ResetAlarm = 5188, - Zo_xxyyyy = 5199, - Zo_ResetAllAlarms = 5206, - Zo_xx000A00 = 5221, - Zo_HueSat = 5230, - Zo_xxyy0A00 = 5237, - Zo_Color = 5246, - Zo_xxxxyyyy0A00 = 5252, - Zo_xxxx0A00 = 5265, - Zo_ShutterOpen = 5274, - Zo_ShutterClose = 5286, - Zo_ShutterStop = 5299, - Zo_ShutterLift = 5311, - Zo_xx = 5323, - Zo_ShutterTilt = 5326, - Zo_Shutter = 5338, - Zo_DimmerMove = 5346, - Zo_xx0A = 5357, - Zo_DimmerStepUp = 5362, - Zo_00xx0A00 = 5375, - Zo_DimmerStepDown = 5384, - Zo_01xx0A00 = 5399, - Zo_DimmerStep = 5408, - Zo_xx190A00 = 5419, - Zo_01 = 5428, - Zo_HueMove = 5431, - Zo_xx19 = 5439, - Zo_HueStepUp = 5444, - Zo_HueStepDown = 5454, - Zo_03xx0A00 = 5466, - Zo_HueStep = 5475, - Zo_SatMove = 5483, - Zo_SatStep = 5491, - Zo_xx190A = 5499, - Zo_ColorMove = 5506, - Zo_xxxxyyyy = 5516, - Zo_ColorStep = 5525, - Zo_ColorTempMoveUp = 5535, - Zo_01xxxx000000000000 = 5551, - Zo_ColorTempMoveDown = 5570, - Zo_03xxxx000000000000 = 5588, - Zo_ColorTempMoveStop = 5607, - Zo_00xxxx000000000000 = 5625, - Zo_ColorTempMove = 5644, - Zo_xxyyyy000000000000 = 5658, - Zo_ColorTempStepUp = 5677, - Zo_01xxxx0A0000000000 = 5693, - Zo_ColorTempStepDown = 5712, - Zo_03xxxx0A0000000000 = 5730, - Zo_ColorTempStep = 5749, - Zo_xxyyyy0A0000000000 = 5763, - Zo_ArrowClick = 5782, - Zo_ArrowHold = 5793, - Zo_ArrowRelease = 5803, - Zo_ZoneStatusChange = 5816, - Zo_xxxxyyzz = 5833, - Zo_xxyyzzzz = 5842, - Zo_AddScene = 5851, - Zo_xxyyyyzz = 5860, - Zo_StoreScene = 5869, + Zo_RemoteSensing = 3413, + Zo_ControlSequenceOfOperation = 3427, + Zo_SystemMode = 3454, + Zo_TRVMode = 3465, + Zo_SetValvePosition = 3473, + Zo_EurotronicErrors = 3490, + Zo_CurrentTemperatureSetPoint = 3507, + Zo_Hue = 3534, + Zo_Sat = 3538, + Zo_RemainingTime = 3542, + Zo_X = 3556, + Zo_Y = 3558, + Zo_DriftCompensation = 3560, + Zo_CompensationText = 3578, + Zo_CT = 3595, + Zo_ColorMode = 3598, + Zo_NumberOfPrimaries = 3608, + Zo_Primary1X = 3626, + Zo_Primary1Y = 3636, + Zo_Primary1Intensity = 3646, + Zo_Primary2X = 3664, + Zo_Primary2Y = 3674, + Zo_Primary2Intensity = 3684, + Zo_Primary3X = 3702, + Zo_Primary3Y = 3712, + Zo_Primary3Intensity = 3722, + Zo_WhitePointX = 3740, + Zo_WhitePointY = 3752, + Zo_ColorPointRX = 3764, + Zo_ColorPointRY = 3777, + Zo_ColorPointRIntensity = 3790, + Zo_ColorPointGX = 3811, + Zo_ColorPointGY = 3824, + Zo_ColorPointGIntensity = 3837, + Zo_ColorPointBX = 3858, + Zo_ColorPointBY = 3871, + Zo_ColorPointBIntensity = 3884, + Zo_Illuminance = 3905, + Zo_IlluminanceMinMeasuredValue = 3917, + Zo_IlluminanceMaxMeasuredValue = 3945, + Zo_IlluminanceTolerance = 3973, + Zo_IlluminanceLightSensorType = 3994, + Zo_IlluminanceLevelStatus = 4021, + Zo_IlluminanceTargetLevel = 4044, + Zo_Temperature = 4067, + Zo_TemperatureMinMeasuredValue = 4079, + Zo_TemperatureMaxMeasuredValue = 4107, + Zo_TemperatureTolerance = 4135, + Zo_Pressure = 4156, + Zo_PressureMinMeasuredValue = 4165, + Zo_PressureMaxMeasuredValue = 4190, + Zo_PressureTolerance = 4215, + Zo_PressureScaledValue = 4233, + Zo_PressureMinScaledValue = 4253, + Zo_PressureMaxScaledValue = 4276, + Zo_PressureScaledTolerance = 4299, + Zo_PressureScale = 4323, + Zo_SeaPressure = 4337, + Zo_FlowRate = 4349, + Zo_FlowMinMeasuredValue = 4358, + Zo_FlowMaxMeasuredValue = 4379, + Zo_FlowTolerance = 4400, + Zo_Humidity = 4414, + Zo_HumidityMinMeasuredValue = 4423, + Zo_HumidityMaxMeasuredValue = 4448, + Zo_HumidityTolerance = 4473, + Zo_Occupancy = 4491, + Zo_OccupancySensorType = 4501, + Zo_ZoneState = 4521, + Zo_ZoneType = 4531, + Zo_ZoneStatus = 4540, + Zo_CurrentSummDelivered = 4551, + Zo_CompanyName = 4572, + Zo_MeterTypeID = 4584, + Zo_DataQualityID = 4596, + Zo_CustomerName = 4610, + Zo_Model = 4623, + Zo_PartNumber = 4629, + Zo_ProductRevision = 4640, + Zo_SoftwareRevision = 4656, + Zo_UtilityName = 4673, + Zo_POD = 4685, + Zo_AvailablePower = 4689, + Zo_PowerThreshold = 4704, + Zo_RMSVoltage = 4719, + Zo_RMSCurrent = 4730, + Zo_ActivePower = 4741, + Zo_NumberOfResets = 4753, + Zo_PersistentMemoryWrites = 4768, + Zo_LastMessageLQI = 4791, + Zo_LastMessageRSSI = 4806, + Zo_Identify = 4822, + Zo_xxxx = 4831, + Zo_IdentifyQuery = 4836, + Zo_AddGroup = 4850, + Zo_xxxx00 = 4859, + Zo_ViewGroup = 4866, + Zo_GetGroup = 4876, + Zo_01xxxx = 4885, + Zo_GetAllGroups = 4892, + Zo_00 = 4905, + Zo_RemoveGroup = 4908, + Zo_RemoveAllGroups = 4920, + Zo_ViewScene = 4936, + Zo_xxxxyy = 4946, + Zo_RemoveScene = 4953, + Zo_RemoveAllScenes = 4965, + Zo_RecallScene = 4981, + Zo_GetSceneMembership = 4993, + Zo_PowerOffEffect = 5012, + Zo_xxyy = 5027, + Zo_PowerOnRecall = 5032, + Zo_PowerOnTimer = 5046, + Zo_xxyyyyzzzz = 5059, + Zo_xx0A00 = 5070, + Zo_DimmerUp = 5077, + Zo_00190200 = 5086, + Zo_DimmerDown = 5095, + Zo_01190200 = 5106, + Zo_DimmerStop = 5115, + Zo_ResetAlarm = 5126, + Zo_xxyyyy = 5137, + Zo_ResetAllAlarms = 5144, + Zo_xx000A00 = 5159, + Zo_HueSat = 5168, + Zo_xxyy0A00 = 5175, + Zo_Color = 5184, + Zo_xxxxyyyy0A00 = 5190, + Zo_xxxx0A00 = 5203, + Zo_ShutterOpen = 5212, + Zo_ShutterClose = 5224, + Zo_ShutterStop = 5237, + Zo_ShutterLift = 5249, + Zo_xx = 5261, + Zo_ShutterTilt = 5264, + Zo_Shutter = 5276, + Zo_DimmerMove = 5284, + Zo_xx0A = 5295, + Zo_DimmerStepUp = 5300, + Zo_00xx0A00 = 5313, + Zo_DimmerStepDown = 5322, + Zo_01xx0A00 = 5337, + Zo_DimmerStep = 5346, + Zo_xx190A00 = 5357, + Zo_01 = 5366, + Zo_HueMove = 5369, + Zo_xx19 = 5377, + Zo_HueStepUp = 5382, + Zo_HueStepDown = 5392, + Zo_03xx0A00 = 5404, + Zo_HueStep = 5413, + Zo_SatMove = 5421, + Zo_SatStep = 5429, + Zo_xx190A = 5437, + Zo_ColorMove = 5444, + Zo_xxxxyyyy = 5454, + Zo_ColorStep = 5463, + Zo_ColorTempMoveUp = 5473, + Zo_01xxxx000000000000 = 5489, + Zo_ColorTempMoveDown = 5508, + Zo_03xxxx000000000000 = 5526, + Zo_ColorTempMoveStop = 5545, + Zo_00xxxx000000000000 = 5563, + Zo_ColorTempMove = 5582, + Zo_xxyyyy000000000000 = 5596, + Zo_ColorTempStepUp = 5615, + Zo_01xxxx0A0000000000 = 5631, + Zo_ColorTempStepDown = 5650, + Zo_03xxxx0A0000000000 = 5668, + Zo_ColorTempStep = 5687, + Zo_xxyyyy0A0000000000 = 5701, + Zo_ArrowClick = 5720, + Zo_ArrowHold = 5731, + Zo_ArrowRelease = 5741, + Zo_ZoneStatusChange = 5754, + Zo_xxxxyyzz = 5771, + Zo_xxyyzzzz = 5780, + Zo_AddScene = 5789, + Zo_xxyyyyzz = 5798, + Zo_StoreScene = 5807, }; diff --git a/tasmota/xdrv_23_zigbee_5_converters.ino b/tasmota/xdrv_23_zigbee_5_converters.ino index 780ef979c..217a003c4 100644 --- a/tasmota/xdrv_23_zigbee_5_converters.ino +++ b/tasmota/xdrv_23_zigbee_5_converters.ino @@ -413,17 +413,13 @@ const Z_AttributeConverter Z_PostProcess[] PROGMEM = { { 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 }, + { Zmap8, Cx0201, 0x001A, Z_(RemoteSensing), 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 }, + { Zuint8, Cx0201, 0x4002, Z_(EurotronicErrors), 1 }, { Zint16, Cx0201, 0x4003, Z_(CurrentTemperatureSetPoint), -100 }, // Color Control cluster @@ -1142,11 +1138,26 @@ void ZCLFrame::computeSyntheticAttributes(Z_attribute_list& attr_list) { attr_list.addAttribute(0x0001, 0x0021).setUInt(toPercentageCR2032(mv) * 2); } break; + case 0x02010008: // Pi Heating Demand - solve Eutotronic bug + { + 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); + } + } + break; case 0x04030000: // Pressure - int16_t pressure = attr.getInt(); - int16_t pressure_sealevel = (pressure / FastPrecisePow(1.0 - ((float)Settings.altitude / 44330.0f), 5.255f)) - 21.6f; - attr_list.addAttribute(0x0403, 0xFF00).setInt(pressure_sealevel); - // We create a synthetic attribute 0403/FF00 to indicate sea level + { + int16_t pressure = attr.getInt(); + int16_t pressure_sealevel = (pressure / FastPrecisePow(1.0 - ((float)Settings.altitude / 44330.0f), 5.255f)) - 21.6f; + attr_list.addAttribute(0x0403, 0xFF00).setInt(pressure_sealevel); + // We create a synthetic attribute 0403/FF00 to indicate sea level + } break; } } @@ -1692,6 +1703,10 @@ void ZCLFrame::postProcessAttributes(uint16_t shortaddr, Z_attribute_list& attr_ case 0x00068000: device.setPower(attr.getBool()); break; case 0x00080000: device.dimmer = uval16; break; case 0x02010000: device.temperature = fval * 10 + 0.5f; break; + case 0x02010008: device.th_setpoint = uval16; break; + case 0x02010012: device.temperature_target = fval * 10 + 0.5f; break; + case 0x02010007: device.th_setpoint = uval16; break; + case 0x02010011: device.temperature_target = 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;