Repository navigation
Major Update for AI & EAI
Full Change Log 42.0.0 SFML, STATS, EAI and Hubble-AI Stack + Kepler AI Stack
The new version contains numerous stability improvements and bug fixes. A special focus has been placed on the quality, traceability, and secure further development of the AI models and the Smart features.
Many thanks to the users in the Simon42 forum for their diligent testing and reporting!
I have once again placed special emphasis on the unique feature of "Smart Battery Charging." STATS can now reliably and cost-effectively charge batteries without automation.
If you like this project and or you want to support / keep this project running pls support with a cup of coffee!
SFML – Single Source of Truth (SOT)
After some users experienced problems with the new HA 18.2, I have now decoupled EAI processes from HA as well and moved them into the code. This required a major restructuring effort.
- SFML remains the central data source for astronomy, weather, and energy data.
- Database access has been improved to prevent timeouts and mutual lockups.
- A compatibility bug with the database library used in current Home Assistant systems was resolved.
- Consumption baselines, learning samples, and central training data can once again be reliably read and saved.
- Access rights of individual integrations to their respective database tables remain fully intact.
- EAI is still exclusively allowed to write to designated
eai_*tables. - No structural changes were made to existing tables, database schemas, or saved learning data.
- Consumption and weather learning data are saved reliably and persistently across restarts.
- Misleading customer warnings for incomplete sensor readings have been reduced.
- Additional edge cases related to restarts, day transitions, daylight saving time, and missing input data were addressed.
SFML – AI Training and Model Quality
Some users noticed that the EOD (End of Day) process has become significantly faster, now executing in a matter of seconds. This is due to the new AI-STACK architecture. Here, too, I have made further enhancements.
- The temporal separation between training and evaluation data was fundamentally improved.
- AI models are trained chronologically and subsequently evaluated exclusively using later data.
- AI data is partitioned into complete date groups.
- Overlapping time periods between training and evaluation are strictly excluded.
- Future sensor values can no longer inadvertently bleed into the training of earlier forecasts.
- Calculated quality metrics now more reliably reflect how a model performs on genuinely unseen future data.
- During EOD, the best epoch achieved during training is restored once again.
- This prevents a later, inferior epoch from being accidentally adopted as the final model.
- Internal optimization steps of the Hubble and Kepler AI stacks were corrected to update model weights in the intended sequence.
- For every training run, the used days, features, target values, and temporal data ranges are transparently recorded.
- Additionally, it is logged whether a target value was fully measured, supplemented, calculated from a remainder, or inherited from older data. This allows later identification of whether a shift in quality stems from the model or an altered data basis, providing me with better maintainability.
- Training data, model configuration, feature schema, random seed, and relevant hyperparameters are explicitly flagged.
- The Attention model was fundamentally overhauled, and its interplay with the 4 Head Transformer was made easier to verify.
- Distinct training runs can thus be reliably distinguished from one another and traced back later.
- Unnecessary parallel or duplicate training runs are avoided, as the Hubble AI stack now runs synchronously with the Kepler stack.
- Hubble went back to school and is much quieter now..
- Hubble also is more calmed now ;-)
SFML – Model Candidates and Safe Activation (IMPORTANT)
- Newly trained models no longer immediately replace the active production model.
- A new model is initially stored as a candidate and evaluated in the background against the currently active model.
- During this shadow phase, the existing forecast for live production remains unchanged.
- Only a fully evaluated candidate with a positive
GOdecision is permitted to become the new production model. - A candidate marked with
NO_GOwill not be activated, but remains saved so I can inspect it if needed. - Prior to activation, model weights, configuration, and associated training details are verified for completeness and consistency. After reading about the issues in the forum, I have tightened the GiGo tolerance even further to prevent false learning signals (HA sensors) from skewing model learning.
- The new model must be fully loaded and operational before switching over from the active model.
- If an activation temporarily fails, a previously valid
GOdecision can be reprocessed, ensuring that the best and most up-to-date model is always used. - Only one un-evaluated model candidate can exist at a time.
- If a candidate is already awaiting shadow evaluation, no additional main model will be trained. This effectively eliminates unnecessary overhead.
- This expected state continues to count as a completed, informative EOD step to prevent log misinterpretations or suspicions that "it isn't running." Therefore, the day closure can correctly report
16/16 completed, even though no new main model was intentionally trained that evening. - A resultingly short EOD does not automatically mean that the AI has stopped learning or that forecast quality is degrading.
- The previous production model remains actively served in this case until the existing candidate has been sufficiently evaluated.
- Actual training, evaluation, or activation errors will continue to be handled as errors and not reported as successful learning processes.
SFML – Weather MLP
- The Weather MLP learning workflow now clearly distinguishes between insufficient data and actual processing errors, preventing misunderstandings.
- Missing or partially available sensor readings are treated as an expected warmup phase.
- Inconsistent training targets or faulty links between weather and telemetry data are no longer counted as successful learning.
- The model remains conservative until sufficient, usable, and chronologically matching learning data is available. We discussed this approach in the January call, and the general direction remains conservative!
- The best achieved model version is restored after training.
- This prevents later performance degradation within the same training run from being accepted.
EAI – Energy and Consumption Forecasts
- EAI now automatically sources astronomy and weather data from the central SFML database. Overall, EAI is now largely independent of the HA Recorder.
- Errors in the morning EAI routine have been fixed.
- Issues causing Kepler and Weather MLP to continuously report zero training data were resolved.
- Consumption baselines can once again be reliably loaded and saved from the central database.
- Learning samples and central training data are shared jointly between Hubble & Kepler.
- The nightly day-closure and learning routines were made more robust.
- A bug in the preparation of AI training data was corrected.
- Insufficient training data is now distinguished from actual training errors.
- EAI continues to use its own database tables, strictly separated from STATS. However, SFML verifies before writing!
STATS – Display and Evaluation
- Price forecasts and actually measured energy flows are now clearly differentiated across the 48-hour timeline.
- Solar yield is displayed in yellow according to the legend.
- Grid battery charging and solar yield are processed correctly as separate data series.
- Future hours no longer display misleading zero-energy values.
- The boundary between past data and price forecast is highlighted with a "Now" marker.
- Recurring timestamps within the 48-hour period are mapped correctly.
- STATS continues to use its own database tables, strictly separated from EAI.
SMC – Economical Charging
- SMC economically decides whether and how much energy to charge into the battery from the grid.
- It factors in electricity prices, battery state of charge, expected consumption, PV forecasts, as well as charging, storage, and inverter losses.
- A low electricity price does not automatically trigger a full charge.
- SMC charges only the amount of energy expected to actually be needed.
- If cheaper hours are available later, SMC waits before charging from the grid.
- If the battery state of charge and expected solar yield are sufficient, it will not charge unnecessarily from the grid.
- If higher electricity prices threaten later and the existing energy reserve is insufficient, SMC can now reliably charge according to demand on the current day as well.
- The actual cost of energy supplied later from the battery is evaluated including system losses.
SMC – Operation and Traceability
- The current decision is clearly displayed as "Charging", "Waiting", or "Not charging".
- The economic charge plan shows the scheduled energy amount, effective storage costs, and the future electricity price used for comparison.
- For energy scheduled later, a clear notice indicates that fixed charging times are not yet guaranteed.
- The misleading "Recommended Charge Window" has been removed.
- The SMC display has been optimized for both light and dark themes.
- Status indicators are more readable and labeled for screen readers.
Premium Configurations (code via PN to tom-ha at Simon42 forum)
- Existing premium configurations for heat pumps are preserved.
- Existing configurations for EVs and wallboxes are preserved.
- Existing Solar Cockpit configurations are preserved.