Skip to content

Round float values in OpenTherm Gateway MQTT commands - #186

Open
EndPositive wants to merge 1 commit into
Alexwijn:developfrom
EndPositive:fix/mqtt-command-precision
Open

EndPositive wants to merge 1 commit into
Alexwijn:developfrom
EndPositive:fix/mqtt-command-precision

Conversation

@EndPositive

@EndPositive EndPositive commented Oct 13, 2026 •

Copy link
Copy Markdown

Problem

SatOpenThermMqttCoordinator interpolates raw floats into OTGW commands (f"CS={value}"). When the dynamic minimum setpoint clamps the setpoint, the value can carry floating-point artifacts, e.g.:

OTGW/set/otgw-483FDA05587C/command CS=56.602000000000004

OTGW-firmware (seen on 1.7.7) silently drops queued commands longer than 14 characters (OT_cmd_t.cmd[15], addOTWGcmdtoqueue: "command too long"). The short PM=25 and CH=1 still arrive, but the control setpoint never reaches the boiler, so it does not heat.

It can also lock up. With the boiler idle, the return temperature stays put, so the dynamic minimum recalculates to the same 21-character value on every cycle. In our case that lasted more than 6 hours, with no heat at all.

Change

Format the float commands (CS, SW, TC, SH) with one decimal, matching the round(..., 1) already applied to the calculated setpoint in climate.py. MM and CH are integers and are unchanged.

Test plan

  • Sniffed MQTT before the fix: CS=56.602000000000004. The OTGW bus control setpoint never showed the value.
  • With setpoint 55.0 (dynamic minimum off), the boiler received CS=55.00 and fired within 30 s.
  • Running this branch on the same setup with the dynamic minimum setpoint back on.

Summary by CodeRabbit

  • Improvements
    • OpenTherm control, hot-water, thermostat, and maximum-setpoint commands are now published using a consistent one-decimal-place format. This makes values sent through MQTT more predictable and easier to read. The formatting change applies across all four command types, while command ordering and subsequent behavior remain unchanged.

Floating-point artifacts such as 56.602000000000004 were sent as
CS=56.602000000000004. OTGW-firmware drops queued commands longer than
14 characters, so the boiler never received the control setpoint.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ceed85ee-a242-4541-afad-e8b17e403f6f
📥 Commits

Reviewing files that changed from the base of the PR and between 7d43560 and abd24af.

📒 Files selected for processing (1)
  • custom_components/sat/mqtt/opentherm.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The OpenTherm MQTT coordinator now formats four setpoint command values to one decimal place before publishing. Command ordering and superclass calls remain unchanged.

Changes

OpenTherm setpoint formatting

Layer / File(s) Summary
Format setpoint commands
custom_components/sat/mqtt/opentherm.py
The CS, SW, TC, and SH commands now publish values formatted to one decimal place.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to abd24

No actionable remaining failure is established in the changed setpoint commands; mergeability risk is minimal.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: rounding float values in OpenTherm Gateway MQTT commands.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant