Skip to content

fix: Update source timestamp in echo to prevent component timeout#34

Closed
dbl-0 wants to merge 3 commits intomuart-group:devfrom
dbl-0:fix-temperature-source-timeout
Closed

fix: Update source timestamp in echo to prevent component timeout#34
dbl-0 wants to merge 3 commits intomuart-group:devfrom
dbl-0:fix-temperature-source-timeout

Conversation

@dbl-0
Copy link
Copy Markdown
Contributor

@dbl-0 dbl-0 commented Dec 31, 2025

When echo_interval is configured, the echo mechanism now updates the temperature source timestamp to prevent the component's timeout logic from triggering while valid data is being echoed.

The echo was correctly sending temperature to the heat pump but not updating temperature_reports_[].timestamp, causing the component to timeout after ~8 minutes even when actively echoing valid temperature data. This resulted in oscillation between internal and remote temperature sensing.

Also fixes isnan() check that was incorrectly applied to uint32_t timestamp instead of the float temperature value.

Dan Lastname and others added 2 commits December 31, 2025 08:03
When echo_interval is configured, the echo mechanism now updates
the temperature source timestamp to prevent the component's timeout
logic from triggering while valid data is being echoed.

The echo was correctly sending temperature to the heat pump but not
updating temperature_reports_[].timestamp, causing the component to
timeout after ~8 minutes even when actively echoing valid temperature
data. This resulted in oscillation between internal and remote
temperature sensing.

Also fixes isnan() check that was incorrectly applied to uint32_t
timestamp instead of the float temperature value.
@samphonic
Copy link
Copy Markdown
Contributor

The echo was correctly sending temperature to the heat pump but not updating temperature_reports_[].timestamp, causing the component to timeout after ~8 minutes even when actively echoing valid temperature data. This resulted in oscillation between internal and remote temperature sensing.

Good catch, that's definitely not supposed to behave that way. Rather than update the last reported timestamp though (since that would hide the actual last report from that sensor), I've rearranged the logic a bit so we shouldn't get to the timeout/switch-to-internal code until after the echo has completed.

I'm unfortunately not in a position to test this at the moment though, so if you're able to confirm this change also resolves the issue you're seeing that would be great.

Also fixes isnan() check that was incorrectly applied to uint32_t timestamp instead of the float temperature value.

Doh! 🤦‍♂️

@dbl-0
Copy link
Copy Markdown
Contributor Author

dbl-0 commented Jan 1, 2026

I did test your version and I do not think it addressed the issue in the same way, and I still saw the behaviour. I've rolled back to my branch for the moment.

@samphonic
Copy link
Copy Markdown
Contributor

samphonic commented Jan 1, 2026

What do you have the timeout set to in your config, and ~ how long is it taking before it times out.

We do need to fix this, I just don't want to break the last-received value in doing so.

Edit: (hopefully I might get some time to test locally and figure things out before too long too)

 fix: Prevent temperature flicker by using cached remote temperature
@dbl-0
Copy link
Copy Markdown
Contributor Author

dbl-0 commented Jan 2, 2026

Thanks for the fix attempt! After testing, the timeout toggling actually is resolved (internal_sensor stays stable... or seems to), but I discovered a second related issue: brief temperature flickers.

Problem: When the echo sends the remote temperature, there's a timing window before the heat pump processes it. If update() queries get_current_temp during this window, the heat pump reports its internal sensor (~18-20°C) instead of the remote temp (~23°C). This causes 6-12 second flickers visible in Home Assistant climate object. This kicks in heat, when the room doesnt need it.

Evidence:

  • Drops occurred exactly 60s apart (matching echo_interval)
  • internal_sensor stayed OFF (not a timeout issue)
  • Drop values (18.5-20.5°C) matched internal sensor, not HA sensor (23°C)

Fix: In process_packet(CurrentTempGetResponsePacket), prefer the cached remote temperature when in remote mode with valid data, rather than trusting the heat pump's response during the timing gap:

if (selected_temperature_source_ != TEMPERATURE_SOURCE_INTERNAL &&
!temperature_source_timeout_ &&
!isnan(temperature_reports_[selected_temperature_source_].temperature)) {
current_temperature = temperature_reports_[selected_temperature_source_].temperature;
} else {
current_temperature = packet.get_current_temp();
}

This is separate from the timestamp fix - it addresses the race condition in how current_temperature is populated.

@samphonic
Copy link
Copy Markdown
Contributor

After testing, the timeout toggling actually is resolved

Oh good! 🎉

brief temperature flickers [...]
This causes 6-12 second flickers visible in Home Assistant climate object. This kicks in heat, when the room doesnt need it.

We've seen this behavior before, but that isn't quite an accurate representation of the cause. The heat pump itself determines whether or not to turn on the heat based on its current temperature. The flicker you are seeing is not an artifact of the MITP update logic, the heat pump actually thinks it's that temperature (probably because it has timed out).

What's likely happening is that the heat pump is timing out slightly before the 60s echo arrives (either because there's packet congestion causing a delay or because it has a timeout of less than 60s). "Current temperature" reflects this, but then after the next echo the great pump's temperature is updated and then "current temperature" matches the external sensor.

Rather than the last commit, the solution is to lower the echo interval (maybe to ~50s) so the echo arrives before the timeout.

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.

2 participants