Skip to content

Commit 9c5317e

Browse files
committed
Fix Co2 client logic, do not get from CO2 signal if value provided
1 parent 1626f17 commit 9c5317e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

simvue/eco/emissions_monitor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ def check_refresh(self) -> bool:
156156
whether a refresh of the CO2 intensity was requested
157157
from the CO2 Signal API.
158158
"""
159-
if (
160-
not self.co2_intensity
161-
and not self._local_data.setdefault(self._client.country_code, {})
162-
) or self.outdated:
159+
if not self.co2_intensity and (
160+
not self._local_data.setdefault(self._client.country_code, {})
161+
or self.outdated
162+
):
163163
self._logger.info("🌍 CO2 emission outdated, calling API.")
164164
_data: CO2SignalResponse = self._client.get()
165165
self._local_data[self._client.country_code] = _data.model_dump(mode="json")

0 commit comments

Comments
 (0)