We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37d900b commit 2437e37Copy full SHA for 2437e37
simvue/eco/emissions_monitor.py
@@ -187,10 +187,13 @@ def check_refresh(self) -> bool:
187
with self._data_file_path.open("r") as in_f:
188
self._local_data = json.load(in_f)
189
190
+ if not self._client or not self._local_data:
191
+ return False
192
+
193
if (
- self._client
- and not self._local_data.setdefault(self._client.country_code, {})
- ) or self.outdated:
194
+ not self._local_data.setdefault(self._client.country_code, {})
195
+ or self.outdated
196
+ ):
197
self._logger.info("🌍 CO2 emission outdated, calling API.")
198
_data: CO2SignalResponse = self._client.get()
199
self._local_data[self._client.country_code] = _data.model_dump(mode="json")
0 commit comments