Skip to content
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

Fix evohome high_precision temps not retreived consistently #107366

Merged
merged 7 commits into from
Jan 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion homeassistant/components/evohome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ def get_session_id(client_v1: ev1.EvohomeClient) -> str | None:

session_id = get_session_id(self.client_v1)

self.temps = {} # these are now stale, will fall back to v2 temps
try:
temps = await self.client_v1.get_temperatures()

Expand All @@ -523,6 +522,11 @@ def get_session_id(client_v1: ev1.EvohomeClient) -> str | None:
),
err,
)
self.temps = {} # high-precision temps now considered stale

except Exception:
self.temps = {} # high-precision temps now considered stale
raise

else:
if str(self.client_v1.location_id) != self._location.locationId:
Expand Down Expand Up @@ -654,6 +658,7 @@ def current_temperature(self) -> float | None:
assert isinstance(self._evo_device, evo.HotWater | evo.Zone) # mypy check

if self._evo_broker.temps.get(self._evo_id) is not None:
Copy link
Member

Choose a reason for hiding this comment

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

Side note: If we store the value in a walrus variable we don't need to look it up twice.

# use high-precision temps if available
return self._evo_broker.temps[self._evo_id]
return self._evo_device.temperature

Expand Down