Fixing runaway setpoint value

It’s not really a fix. It’s better to speak of a workaround to correct the setpoint of the household thermostat which slowly shifts over time (see the graph above). I lack knowledge to fix the source, which is most probably the OTGW software. So I have created a rule in openHAB to check and fix the setpoint every time it gets updated.

If someone else experience this behavior, the rule below works for me!

rule "Correct setpoint"
  Item ot_setpoint received update
  var float CurrentSetpoint = (ot_setpoint.state as DecimalType).floatValue
  logInfo("home.rules", "ot_setpoint before: " + CurrentSetpoint)

  var float CorrectSetpoint = Math::round(CurrentSetpoint.floatValue*2)/2.0f
  logInfo("home.rules", "ot_setpoint after: " + CorrectSetpoint)

  if (CorrectSetpoint != CurrentSetpoint) {
    postUpdate(ot_setpoint, CorrectSetpoint)
    logInfo("home.rules", "ot_setpoint correction performed")