Simply remote temperature calculation - #234
Conversation
|
I just noticed that with this formula, when the temperature is 6.8 degree celsius, the heatpump reports the temperature to be 38 degree celsius. So it appears that packet[7] is not ignored when packet[8] is set for my heatpump. With a temperature of 6.8 degree packet[7] underruns (7*2 - 16 = -2 wrapping around since a byte is an 8-bit unsigned int). It appears that the minimum temperature that can be set is 8 degrees celsius. Since it wraps around with -2 to 38C. I believe the temperature range is between 8C and 40C. |
|
You are correct about the overflow, but the same overflow also happens with the old calculation. The value should probably be clamped to the correct range before calculating the byte values. About byte[7] being ignored: This is true for my heatpump, apparently there are different models with different behaviour. |
This PR simplifies and corrects calculation of temperature values in setRemoteTemperature(float setting):
The original values calculated are:
which can be simplified to:
The heat pump ignores the value in packet[7] when packet[8] is set. Leaving packet[8] unset shows an error of 0.5°C between reported room temperature and sent remote temperature. Therefore the correct value should be: