Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fahrenheit showing up as Celcius #74

Open
shawnmolnar opened this issue Jan 15, 2024 · 2 comments
Open

Fahrenheit showing up as Celcius #74

shawnmolnar opened this issue Jan 15, 2024 · 2 comments

Comments

@shawnmolnar
Copy link

shawnmolnar commented Jan 15, 2024

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
Copy link
Owner

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
Copy link

Weom85 commented Jan 21, 2024

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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants