netmindz / balboa_GL_ML_spa_control

Control protocol between GL2000 controller and ML series compatibile top panel
16 stars 8 forks source link

Fahrenheit showing up as Celcius #74

Open shawnmolnar opened 5 months ago

shawnmolnar commented 5 months ago

Now that I've got my issues sorted out with the M5 Atom Lite, now I'm running in to another issue where the hot tub is reporting in Fahrenheit, but it's showing up as celcius.

I'm using the latest main branch, and turned on the USE_FAHRENHEIT flag, but in home assistant I'm still reporting as 10.1C when it should be 101F. Drop that flag, change hot tub to Celcius, and it works fine, but wife's preference is Fahrenheit. Looks like there needs to be some additional handling in the tub temp side of things for F vs C.

I'm no developer, but I may take a stab at it if I have some time coming up. For now I'm in Celsius until I can get this side figured out.

    hvac.setMinTemp(26);
    hvac.setMaxTemp(40);
    hvac.setTempStep(0.5);

                    double tmp = (HexString2ASCIIString(result.substring(4, 10)).toDouble() / 10);
                    if (menu == "46") {
                        tubTargetTemp = tmp;
                        targetTemp.setValue((float)tubTargetTemp);
                        if (sendBuffer.isEmpty()) {  // supress setting the target while we are changing the target
                            hvac.setTargetTemperature((float)tubTargetTemp);
                        }
                        Serial.printf("Sent target temp data %f\n", tubTargetTemp);
                    } else {
                        if (tubTemp != tmp) {
                            tubTemp = tmp;
                            temp.setValue((float)tubTemp);
                            hvac.setCurrentCurrentTemperature((float)tubTemp);
                            Serial.printf("Sent temp data %f\n", tubTemp);
                        }
                        if (heaterState && (tubTemp < tubTargetTemp)) {
                            double tempDiff = (tubTargetTemp - tubTemp);
                            float timeToTempValue = (tempDiff * MINUTES_PER_DEGC);
                            timeToTemp.setValue(timeToTempValue);
                        } else {
                            timeToTemp.setValue((float) 0);
                        }
                    }```
netmindz commented 5 months ago

I've never tried swapping the unit of measurement after it was created in Home Assistant.

You might need to delete the device and add it again or maybe just the two entities

Weom85 commented 5 months ago

on that line : double tmp = (HexString2ASCIIString(result.substring(4, 10)).toDouble() / 10);

just remove the divided by 10 it will fix the 10.1 and in Home assistant you can change the unit for F

Like that double tmp = (HexString2ASCIIString(result.substring(4, 10)).toDouble());