Skip to content

Commit

Permalink
Raise issue when future forecasts are missing #238
Browse files Browse the repository at this point in the history
  • Loading branch information
autoSteve committed Jan 31, 2025
1 parent a4959ba commit 430e40c
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 0 deletions.
15 changes: 15 additions & 0 deletions custom_components/solcast_solar/solcastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from homeassistant.const import CONF_API_KEY
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers import issue_registry as ir

from .const import (
BRK_ESTIMATE,
Expand Down Expand Up @@ -3058,3 +3059,17 @@ def set_assessment(forecasts_date, expected_intervals, intervals, is_correct: bo
assessment["expected_intervals"],
", which may be expected" if contiguous == 7 else ", so is missing forecast data",
)
if contiguous < 7:
_LOGGER.warning("Raise issue for missing forecast data")
ir.async_create_issue(
self.hass,
DOMAIN,
"records_missing",
is_fixable=False,
is_persistent=True,
severity=ir.IssueSeverity.WARNING,
translation_key="records_missing",
learn_more_url="",
)
else:
ir.async_delete_issue(self.hass, DOMAIN, "records_missing")
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "Integration not loaded, not performing action."},
"remove_cache_failed": {"message": "Clear all Solcast data failed."}
},
"issues": {
"records_missing": {
"title": "Future forecasts missing",
"description": "Future forecast data is missing, check that your update automation is running."
}
},
"options": {
"abort": {
"reconfigured": "New configuration applied successfully"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "Integration nicht geladen, keine Aktion ausgeführt."},
"remove_cache_failed": {"message": "Das Löschen aller Solcast-Daten ist fehlgeschlagen."}
},
"issues": {
"records_missing": {
"title": "Zukunftsprognosen fehlen",
"description": "Zukünftige Prognosedaten fehlen. Überprüfen Sie, ob Ihre Update-Automatisierung ausgeführt wird."
}
},
"options": {
"abort": {
"reconfigured": "Neue Konfiguration angewendet"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "Integration not loaded, not performing action."},
"remove_cache_failed": {"message": "Clear all Solcast data failed."}
},
"issues": {
"records_missing": {
"title": "Future forecasts missing",
"description": "Future forecast data is missing, check that your update automation is running."
}
},
"options": {
"abort": {
"reconfigured": "New configuration applied successfully"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "L'intégration n'est pas chargée, n'effectue aucune action."},
"remove_cache_failed": {"message": "Échec de l'effacement de toutes les données Solcast."}
},
"issues": {
"records_missing": {
"title": "Prévisions manquantes",
"description": "Les données de prévisions futures sont manquantes, vérifiez que votre automatisation des mises à jour est en cours d'exécution."
}
},
"options": {
"abort": {
"reconfigured": "Nouvelle configuration appliquée"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "Integracja nie została załadowana, nie wykonuje akcji."},
"remove_cache_failed": {"message": "Wyczyść wszystkie dane Solcast nie powiodło się."}
},
"issues": {
"records_missing": {
"title": "Brak prognoz na przyszłość",
"description": "Brak danych prognozy na przyszłość. Sprawdź, czy działa automatyzacja aktualizacji."
}
},
"options": {
"abort": {
"reconfigured": "Zastosowano nową konfigurację"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "Integrácia nie je načítaná, nevykonáva akciu."},
"remove_cache_failed": {"message": "Vymazanie všetkých údajov Solcast zlyhalo."}
},
"issues": {
"records_missing": {
"title": "Predpovede do budúcnosti chýbajú",
"description": "Údaje budúcej prognózy chýbajú. Skontrolujte, či je spustená automatizácia aktualizácií."
}
},
"options": {
"abort": {
"reconfigured": "Použila sa nová konfigurácia"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solcast_solar/translations/ur.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
"integration_not_loaded": {"message": "انضمام لوڈ نہیں ہوا، عمل نہیں کر رہا ہے۔"},
"remove_cache_failed": {"message": "تمام سولکاسٹ ڈیٹا کو صاف کرنا ناکام ہوگیا۔"}
},
"issues": {
"records_missing": {
"title": "مستقبل کی پیشن گوئیاں غائب ہیں۔",
"description": "مستقبل کی پیشن گوئی کا ڈیٹا غائب ہے، چیک کریں کہ آپ کا اپ ڈیٹ آٹومیشن چل رہا ہے۔"
}
},
"options": {
"abort": {
"reconfigured": "نئی کنفیگریشن لاگو کر دی گئی۔"
Expand Down

0 comments on commit 430e40c

Please sign in to comment.