Fetch solar conditions from HamQSL #92

This commit is contained in:
Ian Renton
2026-03-28 10:04:29 +00:00
parent ce99bbc6cf
commit 1173af6a9d
20 changed files with 526 additions and 29 deletions

View File

@@ -14,7 +14,7 @@ class StatusReporter:
"""Provides a timed update of the application's status data."""
def __init__(self, status_data, run_interval, web_server, cleanup_timer, spots, spot_providers, alerts,
alert_providers):
alert_providers, solar_condition_providers):
"""Constructor"""
self._status_data = status_data
@@ -25,6 +25,7 @@ class StatusReporter:
self._spot_providers = spot_providers
self._alerts = alerts
self._alert_providers = alert_providers
self._solar_condition_providers = solar_condition_providers
self._thread = None
self._stop_event = Event()
self._startup_time = datetime.now(pytz.UTC)
@@ -70,6 +71,11 @@ class StatusReporter:
"last_updated": p.last_update_time.replace(
tzinfo=pytz.UTC).timestamp() if p.last_update_time.year > 2000 else 0},
self._alert_providers))
self._status_data["solar_condition_providers"] = list(
map(lambda p: {"name": p.name, "enabled": p.enabled, "status": p.status,
"last_updated": p.last_update_time.replace(
tzinfo=pytz.UTC).timestamp() if p.last_update_time.year > 2000 else 0},
self._solar_condition_providers))
self._status_data["cleanup"] = {"status": self._cleanup_timer.status,
"last_ran": self._cleanup_timer.last_cleanup_time.replace(
tzinfo=pytz.UTC).timestamp() if self._cleanup_timer.last_cleanup_time else 0}