The MQTT HVAC component has a default temperature step-size of 1 degree. That’s fine for Fahrenheit but too coarse for Celsius (effectively an increment of ~2 °F). Ideally, it ought to be 0.5 degrees (for Celsius).
I scanned through the MQTT HVAC component’s source code and saw that in addition to max_temp and min_temp it handles temp_step (although only the first two are documented). I added it to configuration.yaml, but step-size continues to be handled as 1 and not 0.5.
climate:
- platform: mqtt
name: "Thermostat"
optimistic: false
min_temp: 17
max_temp: 28
# temp_step appears to be ignored
temp_step: 0.5
# etc, other parameters not shown
So how are other people, with thermostats set to Celsius, handling this? Just conceding to a life of 1 °C increments?
Every thermostat I’ve ever used in the past 25 years permits 0.5 °C increments. The current crop of so-called ‘smart thermostats’ allow for 0.5 °C increments as does my 8-year-old HAI Omnistat/2. Other home automation software I’ve used allows for 0.5 °C steps.
A one degree increment is historically tied to the Fahrenheit scale and its equivalent in Celsius is a half-degree.
I’m happy for you but it doesn’t address the core issue of how to get MQTT HVAC to allow for 0.5 °C increments (an industry standard for many years).
I noticed the KNX Climate component has this:
setpoint_shift_step : ( Optional ) Defines for step size in Kelvin for each step of setpoint_shift. Default is 0.5 K.
OpenTherm Gateway has this:
precision
(float)(Optional)The desired precision for this device. Can be used to match your actual thermostat’s precision. Supported values are 0.1 , 0.5 and 1.0 .
Default value: 0.5 for Celsius and 1.0 for Fahrenheit.
Guess I’ll study MQTT HVAC’s code and try to determine how it uses (or doesn’t use) “temp_step”.
I agree it does seem odd that it appears to ignore temp_step. There is not some integer setting mucking it up is there? I assume not from looking at the code, but I am no expert.
Seems odd to enter a float value as a string (max and min_temp aren’t strings) but I just tried it and … it doesn’t work. Nevertheless, thanks for the suggestion.
After studying OpenTherm Gateway’s code, I borrowed its approach to handling step-size and used it to modify MQTT HVAC’s code.
It took several revisions before Home Assistant loaded the modified version without complaint. That’s not surprising since this is first time I’ve ever touched Python code let alone an HA component. Long story short, it now steps the setpoint temperature in half-degree increments.
The solution doesn’t even involve “temp_step”. The approach is to check the unit-system currently in effect. If Home Assistant is configured to use metric then it sets the step-size to a constant called PRECISION_HALVES. If it’s imperial then the step-size is set to PRECISION_WHOLE. If the user enters a value for “precision” in configuration.yaml, then that value is used instead.
So now I have a modified version of MQTT HVAC. If anyone wants it, just ask. If I find the time I might learn how to put it on GitHub and make a pull request.
I had the same problem but the solution is easy and doesn’t need to create custom components or alter any code.
As the MQTT HVAC component inherits climate settings, you can override this in the settings menu. Go to Configuration -> Customization -> Select your created climate (mqtt) entity and override the target_temp_step variable to 0.5
Thanks! That’s definitely the easier solution! Just for fun, I set target_temp_step to 2 and it made it step in increments of 2 degrees. Works as advertised.
I’ll tag your answer as the solution. However, despite following a steeper path, I like where I ended up. I now have a version of MQTT HVAC that auto-configures the step-size based on the unit-system. I feel that’s the way it should operate out-of-the-box.
Now on to the next challenge and that’s making MQTT HVAC understand that the operating modes are received as integers (0,1,2,4) yet I want to list them as strings in the UI (auto, heat, cool, off). Whichever string is selected by the user must be published as an integer (i.e. heat=1). I don’t suppose anyone has an ideas?
Yes, I received assistance to create an appropriate template in this thread:
Ultimately, I created a custom component for MQTT HVAC that also supports a command_template so it can publish the correct messages to control my physical thermostat.
Obviously this is resolved, but I feel 1 degree C increments would be fine for 99% standard HVAC applications.
Most Split System air-con remotes (IR style) are 1 degree celsius jumps.
When you include the hysteresis at the target temp and the fact most domestic sensors are not that accurate, then you likely will find having 0.5 degree steps is just a personal want, rather than actually affecting the way a HVAC system performs.
Just my two cents worth. Glad you found a solution for your issue though
All thermostats using the imperial system offer 1 degree increments. The functional equivalent in metric is 0.5 degrees.
Many people, including my wife and I, can sense the difference of a 0.5 C temperature increment/decrement (one of the ‘gifts’ of aging, it makes you into a better temperature sensor).
Most Split System air-con remotes (IR style) are 1 degree celsius jumps.
I know two relatives who own split heat-pump systems that provide 0.5 C increments.
most domestic sensors are not that accurate, then you likely will find having 0.5 degree steps is just a personal want
Where I live, electricity is inexpensive and most homes are heated using electric baseboard heaters. The thermostats controlling these heaters offer 0.5 C increments … and are capable of maintaining air temperature in a 0.5 C range. They behave like dimmers (and not on/off switches) and can provide a constant, low-level of heating to avoid excessive temperature fluctuation.
I’ve used a thermostat, offering 0.5 C increments, for over 15 years and can sense the difference in comfort of 0.5 C steps (definitely 1 C steps). As for the thermostat I’m currently using (for over 8 years) it also provides 0.5 C increments. I’ve compared its readings to two other temperature sensors and they all agree to within 0.25 C. In fact, you can calibrate the thermostat’s temperature sensor in 0.1 C increments.