Skip to content

Commit 17d5576

Browse files
Merge pull request #199 from upsuper-forks/fix-clear-endpoint-cache
Fix _clear_endpoint_cache to correctly reset last fetch
2 parents 57d83cf + 1f01b18 commit 17d5576

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

custom_components/enphase_envoy/envoy_reader.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ def register_url(
747747
return self.uri_registry[attr]
748748

749749
def _clear_endpoint_cache(self, attr):
750-
if attr not in self.uri_registry[attr]:
750+
if attr not in self.uri_registry:
751751
return
752752

753753
# Setting last_fetch to 0 ensures it will be fetched upon next run
@@ -1157,6 +1157,13 @@ async def update_endpoints(self, endpoints=None):
11571157
endpoint,
11581158
time.time() - endpoint_settings["last_fetch"],
11591159
)
1160+
else:
1161+
_LOGGER.info(
1162+
"Skipping update of %s: last fetch: %s, cache time: %s",
1163+
endpoint,
1164+
endpoint_settings["last_fetch"],
1165+
endpoint_settings["cache_time"],
1166+
)
11601167

11611168
if self.data:
11621169
self.data.set_endpoint_data(endpoint, getattr(self, endpoint))

0 commit comments

Comments
 (0)