Firmware version gets incorrectly set to "4.0", resulting in reported temperature being +40°C off
I'm using the gree integration in HA, which works flawlessly most of the time. However, sometimes the temperature is reported 40°C too high. A reload of the integration normally solves the issue and fixes the temperature.
I have a theory of why that is;
I have an automation which sets the HVAC to 8°C heating mode (Pow -> 1, Mod -> 4, StHt -> 1) if the temperature drops to 3°C. The current firmware on the HVAC, will subtract 3°C from the reported measured temperature (TemSen), whenever the HVAC is in heating mode, thus resulting in the reported temperature being 0 (TemSen: 40).
Currently, the version get set to "4.0", if the reported temperature is lower than or equal to TEMP_OFFSET. This results in the reported temperature of 0 (TemSen: 40) triggering the update of the saved version string.
https://github.com/cmroche/greeclimate/blob/0e2a0846a2dd4ed5221c5861f5e5cd857a2dca2b/greeclimate/device.py#L275
I believe that changing the check to be strictly lower then TEMP_OFFSET, would resolve this edge case.
I don't know what the HVAC would report, if it "measured" -1°C (eg. if it measures 2°C and I change it to heat mode, which would subtract 3 from the reported temperature). If relevant, I'll happily test it out.
Here is a packet containing the HID:
{"t": "pack", "i": 1, "uid": 0, "cid": "f4911e6224ff", "tcid": "", "pack": {"t": "dev", "cid": "f4911e6224ff", "bc": "000000000000000000000000000000", "brand": "gree", "catalog": "gree", "mac": "f4911e6224ff", "mid": "10001", "model": "gree", "name": "1e6224ff", "series": "gree", "vender": "1", "ver": "V1.2.1", "lock": 0, "hid": "362001000748+U-CS532Z(LT)V3.75.bin"}}