Add descriptions for solar conditions #92

This commit is contained in:
Ian Renton
2026-03-28 10:39:26 +00:00
parent 1173af6a9d
commit 2a5e0db5bc
14 changed files with 203 additions and 49 deletions

View File

@@ -21,7 +21,8 @@ class HTTPSolarConditionsProvider(SolarConditionsProvider):
self._stop_event = Event()
def start(self):
logging.info("Set up query of " + self.name + " solar conditions API every " + str(self._poll_interval) + " seconds.")
logging.info(
"Set up query of " + self.name + " solar conditions API every " + str(self._poll_interval) + " seconds.")
self._thread = Thread(target=self._run, daemon=True)
self._thread.start()
@@ -39,10 +40,7 @@ class HTTPSolarConditionsProvider(SolarConditionsProvider):
logging.debug("Polling " + self.name + " solar conditions API...")
http_response = requests.get(self._url, headers=HTTP_HEADERS)
new_data = self._http_response_to_solar_conditions(http_response)
if new_data:
for key, value in new_data.items():
if hasattr(self._solar_conditions, key):
setattr(self._solar_conditions, key, value)
self.update_data(new_data)
self.status = "OK"
self.last_update_time = datetime.now(pytz.UTC)