Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Set default values to 0 in range_statistics() #2045

Closed
wants to merge 1 commit into from

Conversation

RichieB2B
Copy link
Contributor

range_statistics() only returns data for full days with the data for the current day being added by period_totals() later. This does not work on new years day where there are no full days yet. Setting the default values to 0 fixes this issue.

Fixes #1944

@dennissiemensma
Copy link
Member

Bedankt voor je suggestie. Ik denk dat deze fix wat te diep zit, gezien het ook niet-MQTT raakt (zie ook de falende tests).

Waarschijnlijk is de MQTT-callback een betere plek. Verder is 0 niet hetzelfde als <niets>, dus zal het alleen toegepast moeten worden op zaken die nul kunnen zijn en niet leeg.

Dit is ook de reden dat ik het destijds nog niet direct had gefixt.

@RichieB2B
Copy link
Contributor Author

RichieB2B commented Jan 2, 2025

range_statistics() is dan misschien te diep, maar in de convert_period_totals() callback is het te laat om het probleem op te lossen. Dat zit in dsmr_stats.services.period_totals() die weer gebruik maakt van month_statistics() en year_statistics(). Die laatste twee functies moeten overweg kunnen met het ontbreken van dagtotalen en ook correct zijn als er net een nieuwe dag is begonnen (zie #1811). Dan zijn we weer terug bij de kern van het probleem: de refactoring om #1770 op te lossen.

@dennissiemensma
Copy link
Member

Ik denk dat #1770 dan beter is. Ook omdat het slechts een jaarlijks ding is als bij-effect

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚨Geen MQTT berichten voor dsmr/current-period op nieuwjaarsdag
2 participants