Skip to content

Fix set_target_temperature() when called with 126.5#130

Open
rotdrop wants to merge 1 commit intohthiery:masterfrom
rotdrop:bugfix/do-no-swith-to-boost-if-preset-modes-are-off
Open

Fix set_target_temperature() when called with 126.5#130
rotdrop wants to merge 1 commit intohthiery:masterfrom
rotdrop:bugfix/do-no-swith-to-boost-if-preset-modes-are-off

Conversation

@rotdrop
Copy link

@rotdrop rotdrop commented Jan 31, 2026

This happens if any of the preset modes eco or comfort are set to off in the Fritzbox UI for a thermostat, e.g. the 302.

Fixes #129.

Luckily 126.5 has an exact binary representation as floating point number ...

This happens if any of the preset modes eco or comfort are set to off in
the Fritzbox UI for a thermostat, e.g. the 302.

Fixes hthiery#129.
@rotdrop rotdrop force-pushed the bugfix/do-no-swith-to-boost-if-preset-modes-are-off branch from b010982 to c54f814 Compare February 2, 2026 08:42
Copy link
Collaborator

@mib1185 mib1185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rotdrop
nice catch 👍 I would think having an explizit "if" instead of an "if not" looks somehow better (but this is a bit opinionated).
But it would be good if we could have a test for this.
thx 👍

@@ -306,7 +306,7 @@ def set_target_temperature(self, ain, temperature, wait=False):

if temp < 16:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if temp < 16:
if temp < 16 or temp == 253:

if temp < 16:
temp = 253
elif temp > 56:
elif temp > 56 and not temp == 253:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif temp > 56 and not temp == 253:
elif temp > 56:

@rotdrop
Copy link
Author

rotdrop commented Feb 2, 2026

Hi @rotdrop nice catch 👍 I would think having an explizit "if" instead of an "if not" looks somehow better (but this is a bit opinionated). But it would be good if we could have a test for this. thx 👍

I actually had the or temp == 253: first but the following line would then re-assign the same value to temp instead of just doing nothing. This is why I came up with the if not which simply skips an unnecessary re-assignment of just the same value. But, hey, it really just does not matter.

Can you change it to your liking (then just go ahead!) or is my interaction required?

@mib1185
Copy link
Collaborator

mib1185 commented Feb 2, 2026

The part about "if" or "if not" was more an opinionated one (not crucial) but that we need a test is a necessary one, so we proof that the bug is fixed and avoid possible regressions in the future

@coveralls
Copy link

Coverage Status

coverage: 96.906%. remained the same
when pulling c54f814 on rotdrop:bugfix/do-no-swith-to-boost-if-preset-modes-are-off
into 6d2653a on hthiery:master.

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.

set_hkr_state() sets boost if any of eco or comfort are configured as "off" in the fritzbox.

3 participants

Comments