Virtual Thermostat: add a decimal places option for setpoints and temperature

The built-in Virtual Thermostat driver always stores heating setpoint, cooling setpoint and temperature with two decimals, whatever it's sent. Thermostat Scheduler sends 69.0 and my rules send one decimal, but the device shows 69.00 and 70.30.

Other devices on the same hub don't do this:

  • Thermostat Controller child devices: 75.0, 69.3
  • Google Nest (community driver): whole-degree setpoints, 69.4 temperature

Hundredths of a degree mean nothing for a thermostat. They clutter dashboards and logs, and they make a mixed setup look inconsistent.

Request: add a "Decimal places" preference with 0, 1 or 2, defaulting to 2 so existing setups don't change. Alternatively, round to one decimal to match Thermostat Controller.

I looked at writing a custom driver from the published example, but that sample has drifted from the built-in (it has no demo mode, for example). I'd rather not maintain a fork of a driver that controls my HVAC zones.

Hub: C-8 Pro, firmware 2.5.2.120. Four Virtual Thermostats drive zone heating through Rule Machine and sync with Nests via Thermostats Sync.

Actually, they can. The anticipating thermostat driver I wrote is very dependent on hundredths, because the anticipation feature relies on knowing if the the temp is rising, falling, or steady. It is not for accuracy, as no temp sensor is even accurate to tenths, but for response time. If I was waiting for tenths to change for rise/fall, my heat can run several minutes longer than I need it to and drive over setpoint. Same with fall, if I don't detect temp falling within my temp range using hundredths, the heat does not come on in time and I fall under setpoint.

I wrote this a few years ago myself, but you really should just have AI write you a virtual thermostat driver that does what you need.

Point taken. I still don't understand monitoring a thermostat for trending vs the temperature sensor inputs for a virtual thermostat, but there's lots of things I don't understand! :rofl: Thus, the request was for a preference, and a default that doesn't break existing thermostats.

I don't want to have AI write a thermostat controller from scratch, likely creating or introducing bugs or weird behaviors for a simple display issue. I considered it as a backup option.

No votes needed. A preference is being added.

I'm not sure how likely that is, honestly. If it isn't throwing exceptions in the logs, drivers are pretty simple in general to really cause issues with the hub. The sandbox that the user code runs in is pretty walled off and contained.

Not that you can't do things in the sandbox that will cripple hub performance. I'm sure we all have accidently created an infinite loop at least once accidently (well, I have), and that can make the hub totally unresponsive, but the sandbox shuts down infinite loops automatically within a fairly short time-out period. Things like excessive polling can be an issue as well, or complex calculations that run too often. But a virtual driver, I don't think there is much risk there from AI writing the code.