diff --git a/src/api/energyAssistant.api.ts b/src/api/energyAssistant.api.ts index e111876..0f8a894 100644 --- a/src/api/energyAssistant.api.ts +++ b/src/api/energyAssistant.api.ts @@ -222,10 +222,10 @@ export class EnergyAssistantApi { return (await this.axiosInstance.get('forecast')).data; } - public async createModel() { + public async createModel(daysToRetreive: number) { if (!this.axiosInstance) throw 'not initialized'; return await this.axiosInstance.post( - 'forecast/create_model', + 'forecast/create_model?days_to_retrieve=' + daysToRetreive, ); } diff --git a/src/translations/de.json b/src/translations/de.json index 06c3486..edcfb39 100644 --- a/src/translations/de.json +++ b/src/translations/de.json @@ -70,12 +70,15 @@ "forecast": "Vorhersage", "core": "Energy Assistant", "forecast_create_model": "Vorhersagemodell erzeugen", - "forecast_create_model_text": "Erzuege das Vorhersagemodell für den Energieverbrauch basierend auf den historischen Daten aus Homeassistant.", + "forecast_create_model_text": "Erzeuge das Vorhersagemodell für den Energieverbrauch basierend auf den historischen Daten aus Homeassistant.", "forecast_create": "Erzeugen", "forecast_tune_model": "Vorhersagemodell optimieren", "forecast_tune_model_text": "Optimiere das Vorhersagemodell. Dieser Vorgang kann einige Zeit dauern.", "forecast_tune": "Optimieren", "forecast_r2score": "Der R2 Wert des Modells ist", - "delete_action": "Löschen" + "delete_action": "Löschen", + "forecast_create_model_error": "Das Model konnte nicht erstellt werden. Homeassistant hat wahrscheinlich nicht genügend Daten.", + "forecast_value_too_small": "Der Wert ist zu klein.", + "forecast_field_required": "Bitte einen Wert eingeben." } } diff --git a/src/translations/en.json b/src/translations/en.json index b1c1a6a..a14fde7 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -73,9 +73,12 @@ "forecast_create_model_text": "Create the load forcast model based on historical data.", "forecast_create": "Create", "forecast_tune_model": "Tune forecast model", - "forecast_tune_model_text": " Tune the load forcast model in order to optimize the forecast quality. This might take some time.", + "forecast_tune_model_text": "Tune the load forcast model in order to optimize the forecast quality. This might take some time.", "forecast_tune": "Tune", "forecast_r2score": "Model R2 score is", - "delete_action": "Delete" + "delete_action": "Delete", + "forecast_create_model_error": "Failed to create the model. Homeassistant might not have enough data.", + "forecast_value_too_small": "The value is too small.", + "forecast_field_required": "Field is required" } } diff --git a/src/views/settings/Forecast.vue b/src/views/settings/Forecast.vue index 4301363..7e90200 100644 --- a/src/views/settings/Forecast.vue +++ b/src/views/settings/Forecast.vue @@ -2,7 +2,16 @@ {{ $t('settings.forecast_create_model') }} - {{ $t('settings.forecast_create_model_text') }} +
+ {{ $t('settings.forecast_create_model_text') }} +
+ !!value || t("settings.forecast_field_required"), + (value) => (!!value && value > 2) || t("settings.forecast_value_too_small"), +]; + +const TuneModel = async () => { isTuning.value = true; await api.tuneModel(); isTuning.value = false;