Periods, updates and time
When are values updated: live or at midnight?
In short: Both. SourceAnalytix recalculates the running values immediately with every new value from the source. At midnight, the period rollover comes on top: it writes the previous periods such as "yesterday", sets new start values and starts the new periods at 0.
What is written when
| States | When |
|---|---|
cumulativeReading, and the values 01_currentDay to 05_currentYear under currentYear.<category> | With every new value from the source, but only if the value changes |
currentWeek.<weekday>, weeks, months, quarters of the running period, and the yearly archive | Likewise with every new value |
statisticsJson | Collected shortly after the changes, at most every 300 ms |
01_previousDay to 05_previousYear | At the rollover of the respective period, with the time stamp 23:59:59 on the last day of the period |
| Start values in the source settings | At the rollover of the respective period |
SourceAnalytix writes all values as acknowledged (ack=true). Because the running values are only written when they change, their time stamp shows the last change. If the source doesn't deliver a new value for a while, the SourceAnalytix values stay as they are, too.
For power sources (W), SourceAnalytix calculates the energy since the last value with every new power value. So here, too, the values only change when the device reports something.
The rollover at midnight
At 0:00 system time, SourceAnalytix checks which periods have ended: the day always, the week on Monday, the month on the 1st, the quarter on 1 January, April, July and October, the year on 1 January. For each period that has ended, it copies the running value into the previous period and sets the start value to the current total. The new period then starts at 0.
On Monday, SourceAnalytix also clears the weekdays of the running week, and on 1 January the weeks, months and quarters under currentYear.
During the rollover, calculation pauses briefly. Values that arrive at that moment are not processed. A change is planned (#1270).
If ioBroker was off at midnight, SourceAnalytix catches up on the rollover at startup, and it also checks every hour. See ioBroker was off at midnight.
See also: Where do I find yesterday, last week, last month (previous states)? · Why do week, month, quarter and year values differ? · Crash or rollover at the wrong time
Why does week 52/53 show values in the new year?
In short: SourceAnalytix counts calendar weeks according to ISO 8601. A week starts on Monday, and week 1 is the week with the first Thursday of the year. The first days of January can therefore still belong to week 52 or 53 of the previous year, and the last days of December can already belong to week 1 of the next year.
Two examples:
| Days | Calendar week |
|---|---|
| Monday, 29 December 2025, to Sunday, 4 January 2026 | Week 1 of 2026 |
| Monday, 28 December 2026, to Sunday, 3 January 2027 | Week 53 of 2026 |
How SourceAnalytix handles this
From v0.6.2: SourceAnalytix assigns each week to the year it belongs to under ISO 8601 (#1256). In detail:
02_currentWeekalways counts the whole week from Monday to Sunday, even across the turn of the year. On 2 January 2027, it therefore contains the consumption since Monday, 28 December.05_currentYear, on the other hand, starts at 0 on 1 January.currentYear.<category>.weeksonly shows weeks that belong to the current calendar year. From 1 to 3 January 2027, SourceAnalytix writes nothing there, because week 53 belongs to 2026. Likewise, on 29 to 31 December 2025 it doesn't write to week01, so that the first week of January of the current year isn't overwritten.- The week archive
<year>.<category>.weeksis in the folder of the year the week belongs to. Week 53 of 2026 is under2026.consumed.weeks.53, including the January days of 2027. Week 1 of 2026 is under2026.consumed.weeks.01, including the December days of 2025.
Up to v0.6.1: SourceAnalytix used the ISO number for weeks but the calendar year. In early January, the values of week 52 or 53 therefore ended up under currentYear and in the archive folder of the new year. At the end of December, week 1 of the next year overwrote the first week of January in the archive of the current year.
See also: Why do week, month, quarter and year values differ? · Which week, month and quarter states and weekdays are there? · What happens at the turn of the year?
Does SourceAnalytix calculate retroactively or only from activation?
In short: Only from activation. SourceAnalytix doesn't recalculate values from the past. If you know the meter readings at the beginning of the running periods, you can enter them as start values. Consumption since the beginning of the day, week, month, quarter or year then counts too, but only for the running periods.
What happens on first activation
With the first value of a new source, SourceAnalytix sets every empty start value and every start value of 0 to the current total. All periods therefore start at 0. The log says "Initialized empty period start values for … from current reading …". Start values you entered stay as they are.
From v0.7.0, the "Add source" wizard asks about this in the "Start values" step:
| Choice | What happens |
|---|---|
| "Count from now" | All periods start at 0 now. |
| "Include consumption since the start of the period" | You enter the meter readings at the beginning of the day, week, month, quarter and year. Empty fields start from now. |
What exactly belongs in the fields is described under What do I enter for the start values (and in which unit)?.
What applies afterwards
- The first month, the first quarter and the first year only contain the consumption since activation, unless you entered start values.
- The previous periods such as
01_previousDayor03_previousMonthare only filled after the first rollover of the respective period. - SourceAnalytix can't create values for earlier periods, such as last year. Start values only take effect until the end of the running period.
Power sources (W) always count from activation. They don't deliver a meter reading, and SourceAnalytix only builds their total itself from activation on. The wizard therefore doesn't offer "Include consumption since the start of the period" for them.
Adding older consumption or meter readings afterwards is planned (#256).
See also: What do I enter for the start values (and in which unit)? · Why are my values negative after I entered start values?
Why do week, month, quarter and year values differ?
In short: Each period has its own start value and begins at a different time. Consumption is always the total minus the start value of that period. Because a week begins on Monday and can span month or year boundaries, weekly values don't match monthly or yearly values, and the sum of the weeks doesn't add up to the month.
When each period begins
| Period | State under currentYear.<category> | Begins at 0:00 on |
|---|---|---|
| Day | 01_currentDay | Every day |
| Week | 02_currentWeek | Monday |
| Month | 03_currentMonth | The 1st of the month |
| Quarter | 04_currentQuarter | 1 January, 1 April, 1 July, 1 October |
| Year | 05_currentYear | 1 January |
At the rollover, SourceAnalytix sets the start value of each period that has ended to the total at that moment. The other periods carry on untouched.
Why the values don't add up
- A week across a month boundary: On Saturday, 3 October 2026,
03_currentMonthcounts three days but02_currentWeekcounts five, because the week began on Monday, 28 September. It therefore contains days that belong to the previous month. The same applies at the turn of the year, see Week 52/53. - Activation in the middle of a period: Without start values of your own, all periods begin at activation. The first month, the first quarter and the first year then contain the same amount, namely the consumption since activation.
- Your own start values: If you entered start values, each period counts from its own value. If the values don't fit together, the results don't fit together either.
- Rounding: SourceAnalytix rounds each period value on its own. The sum of rounded daily values can therefore differ from the monthly value in the last digit.
For costs, the basic fee comes on top: it is booked monthly and not spread evenly over the days. More on this under How do I include a monthly basic fee?.
Where the individual weeks and months are
You find the individual weeks, months and quarters of the current year under currentYear.<category>.weeks.01 to 53, months.01_January to 12_December and quarters.Q1 to Q4, if "Weeks", "Months" and "Quarters" are switched on under "Current year" in the instance settings. February, for example, is in months.02_February.
See also: What do I enter for the start values (and in which unit)? · Which week, month and quarter states and weekdays are there? · When are values updated: live or at midnight?