vitormhenrique / OctoPrint-Enclosure

OctoPrint Enclosure Plugin
GNU General Public License v3.0
396 stars 201 forks source link

Low Target Temperature and Humidity "off" #410

Open wickedbeernut opened 3 years ago

wickedbeernut commented 3 years ago

The target temperature and humidity are displayed as "off" when less than 10oC and 10%, respectively.

Note: Despite the fact the target temperature and humidity are displayed as "off", the corresponding state and GPIO output are being maintained properly. In other words, the temperature / humidity controller is actively attempting to reach the target temperature / humidity. The controller is in fact on when the display says it's off.

10oC seems rather arbitrary as a temperature lower limit. I guess you could argue it doesn't make sense to cool an enclosure to less than 10oC. However, if this is the agreed upon lower limit, it should be enforced in entering the target temperature, rather than accepting the out-of-range value and displaying "off".

A target humidity less than 10% is perfectly valid. I'd argue 0% is a perfectly valid humidity lower limit.

At a minimum, you need a getCleanHumidity function to support different lower limits for temperature and humidity. And again, a lower limit should be enforced rather than simply displayed / masked as "off".

enclosure.js
    self.getCleanTemperature = function (temp) {
      if (temp === undefined || isNaN(parseFloat(temp))) return "-";
      if (temp < 10) return String("off");
      return temp;
    }