gysmo38 / mitsubishi2MQTT

Mitsubishi to MQTT with ESP8266 module
GNU Lesser General Public License v2.1
371 stars 133 forks source link

Dropping decimal places when setting Celsius temperature setting. #175

Open mminehanNZ opened 1 year ago

mminehanNZ commented 1 year ago

When using the html page (or post using http) the half degrees (i.e. 0.5) are being ignored. So if you try and set it to 22.5 degrees it sets to 22 degrees. Using MQTT to set the set point works fine. It's just the html bit that doesn't.

Seth on the Heat-Pump gitter lobby isolated the issue to line 1207 in mitsubishi2mqtt.ino (or there abouts). There's a toInt function that is truncating the decimal places:

if (server.hasArg("TEMP")) {
      settings.temperature = convertLocalUnitToCelsius(server.arg("TEMP").toInt(), useFahrenheit);
      update = true;

So I changed it to a toFloat function:

if (server.hasArg("TEMP")) {
      settings.temperature = convertLocalUnitToCelsius(server.arg("TEMP").toFloat(), useFahrenheit);
      update = true;

I'm not very adept at Github so not sure how to make this a fork or pull request etc.

Cheers, Marty.

robgru commented 1 year ago

I have the same problem with the "toInt()". I changed in this file all three in "toFloat()".

prashker commented 1 year ago

Put in a pull request for this - compiled a local BIN to test, and validated as working on my PVA (@0.5 Celsius increments)