Fix TemperatureAPI making API calls and showing unhealthy when disabled#3839
Draft
Fix TemperatureAPI making API calls and showing unhealthy when disabled#3839
Conversation
Agent-Logs-Url: https://github.com/springfall2008/batpred/sessions/1fe42cbb-3fc0-4288-8f4d-955796e16cbb Co-authored-by: springfall2008 <48591903+springfall2008@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TemperatureAPI data fetch error when component is disabled
Fix TemperatureAPI making API calls and showing unhealthy when disabled
Apr 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TemperatureAPIcontinued polling the Open-Meteo endpoint even after togglingtemperature_enableoff via the UI, and the component incorrectly reported as unhealthy in the dashboard.Two bugs:
run()readself.temperature_enablecached at init time (fromapps.yaml). A UI toggle writes to an HA entity state, notapps.yaml, so the cached value was never updated and polling continued regardless.temperature_enable=False,run()returned early without callingupdate_success_timestamp(). The health check considers any component with no success update in 60+ minutes as dead, triggering the "Demand (unhealthy)" banner.Fixes (
temperature.py):temperature_enablelive on everyrun()call viaget_arg(), so UI toggle changes take effect without a restart:Test updates (
tests/test_temperature.py):get_arg()toMockTemperatureAPIto satisfy the dynamic lookup._test_run_disabledto assert thatupdate_success_timestamp()is called when the component is disabled.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.octopus.energy/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick(dns block)gitlab.com/usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED(dns block)https://api.github.com/repos/springfall2008/batpred/contents/apps/predbat/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --test temperature(http block)/home/REDACTED/work/batpred/batpred/coverage/venv/bin/python3 python3 ../apps/predbat/unit_test.py --quick(http block)If you need me to access, download, or install something from one of these locations, you can either: