Heating: fix temp limit (#10994)

This commit is contained in:
Michael Geers 2023-12-04 17:09:24 +01:00 • committed by GitHub
parent 93efec2521
commit 755af25d6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -65,8 +65,7 @@ export default {
return null;
},
formatSoc: function (value) {
// todo: add fahrenheit support
return this.heating ? this.fmtNumber(value, 1, "celsius") : `${Math.round(value)}%`;
return this.heating ? this.fmtTemperature(value) : `${Math.round(value)}%`;
},
formatKm: function (value) {
return `${this.fmtNumber(value, 0)} ${distanceUnit()}`;

View file

@ -155,8 +155,7 @@ export default {
return "--";
}
if (this.heating) {
// todo: add celsius/fahrenheit option to ui
return this.fmtNumber(this.vehicleSoc, 1, "celsius");
return this.fmtTemperature(this.vehicleSoc);
}
return `${Math.round(this.vehicleSoc)}%`;
},

View file

@ -238,12 +238,16 @@ export default {
return rtf.format(Math.round(elapsed / units[u]), u);
},
fmtSocOption: function (soc, rangePerSoc, distanceUnit, heating) {
let result = heating ? this.fmtNumber(soc, 1, "celcius") : `${this.fmtNumber(soc, 0)}%`;
let result = heating ? this.fmtTemperature(soc) : `${this.fmtNumber(soc, 0)}%`;
if (rangePerSoc && distanceUnit) {
const range = soc * rangePerSoc;
result += ` (${this.fmtNumber(range, 0)} ${distanceUnit})`;
}
return result;
},
fmtTemperature: function (value) {
// TODO: handle fahrenheit
return this.fmtNumber(value, 1, "celsius");
},
},
};