-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External Sensor updates are not processed in a timely manner #1474
Comments
Yeah something is rly off, will try to look into this, like this can and sure does cause a lot of trouble for some 😐 |
BT ignores and discards any sensor update within 60s after the last change:
better_thermostat/custom_components/better_thermostat/events/temperature.py Lines 67 to 78 in 6385a79
Actually this used to be 5s before v1.7.0: Same for updates from the TRV, although it's just 5s of discarding updates: better_thermostat/custom_components/better_thermostat/events/trv.py Lines 75 to 93 in 6385a79
Also here we discard TRV updates, if the controller is processing TRV commands:
Overall we would wanna delay triggering re-iteration of the control loop and commanding a new target to the TRV too frequently, if triggered by sensors, but not totally discard them. Especially we don't wanna discard a sensor update. ProposalTherefore the existing limits probably should be removed, and reimplemented on control loop side for example, limiting the number of updates / re-iterations. For the control queue, it would probably even be enough to have a simple, binary "control update pending" flag. Special care must be taken, to avoid an infinite loop of sensor update -> calculating now command from control loop -> triggering new sensor update again (like mainly a risk in "local calibration" mode). HomematicIPWay lower rate-limits need to be ensured ofc, where currently one update per sensor source is processed every 10min at max. When properly limiting on the control queue:
|
Yeah I remember @KartoffelToby and I were talking bout this issue in the first place. Some TRVs will "flicker" between two temperatures. Mine does this sometimes for up to a minute. I think the better logic would be to process the first update always instantly, and if another one comes in within say 30 seconds, we set a callback for the end of 30 seconds being completed before processing the latest update at that time. This will effectively pace updates to 30 seconds, while always processing with the latest values, while processing single updates without delay, as they should. And if the last values happen to have the same values as the last calculation input, we just skip it. This way we ignore if the flickering flipped back to the last value we used before. @folfy does this approach sound reasonable? |
Yeah, essentially how I'd do it for the basic rate-limiting. Just we also have to consider an issue in the calculation or TRV behaviour (for example I'm still not 100% sure all TRVs are actually reflecting the calibration value in the reported temperature, as assumed in the control loop atm), which can still lead to constantly changing sensor values and calculated setpoint values -> In the given example we could detect this after lets say 8 TRV induced updates/changes within 5min, and simply start discarding self-induced TRV updates for a bit, to at least get out of the loop, while also throwing a repair indication for the user (prompting to create an issue with proper logs here). |
That's a seperate issue which needs investigation. As I don't use calibration this is no factor here. Please open a dedicated issue for this and let's keep on topic here :) |
Well, it will be part of this, because if we rework the existing function as described without considering such side-effect, we would throw this up as yet another major regression, like happening waaaay more often 😅 Also can happen with target temp calibration in certain scenarios just as well, it was just an example. The "bad" code that is causing this bug here, is at the same time the existing safeguard against such problems happening more often than in a few edge-cases. |
Description
I've noticed that the sensor updates by my external sensor are not processed in a timely manner, but instead very delayed in some instances, some updates are also skipped completely. This leads to changes in temperature not being correctly processed and thus the TRV not correctly adjusted for long durations.
The external sensor sees:
18.6 °C before
18.7 °C at 19:23:03
19.4 °C at 19:30:58
20.0 °C at 19:41:24
Screenshots
And here is what Better Thermostat does as state changes:
Steps to Reproduce
unknown
Expected behavior:
Better Thermostat should process the temperature as soon as there are updates and should process all incoming values.
Actual behavior:
Better Thermostat delays processing for 18 minutes and 21 seconds delay and skips values completely.
Versions
HA: 2024.11.1
BT: 1.6.1 with PR #1472 and #1473 applied - otherwise unusable.
Additional Information
The text was updated successfully, but these errors were encountered: