Skip to content

[Backend/Edge] Make resend (backfill) work with a plain Timedata.InfluxDB - #11

Merged
arindahills merged 5 commits into
mainfrom
fix/timedata-resend-backfill
Jul 28, 2026
Merged

[Backend/Edge] Make resend (backfill) work with a plain Timedata.InfluxDB#11
arindahills merged 5 commits into
mainfrom
fix/timedata-resend-backfill

Conversation

@arindahills

Copy link
Copy Markdown

Problem

Resend/backfill (gap-fill on Edge reconnect) doesn't work on a plain Timedata.InfluxDB backend: the InfluxDB provider had no resend write path, and the Edge's rrd4j resend produced AVERAGE channels whose field type didn't match InfluxDB's stored type (integer-vs-float conflict), so backfilled points were rejected.

Like the aggregator-cache patch (OpenEMS#10), this lived out-of-tree in the NFE builds and was never in main — so from-main builds drop it. Second of the two open NFE PRs (upstream OpenEMS#3798), never reviewed.

Fix (cherry-picked from OpenEMS#3798, 4 commits, applied clean onto main)

  • Backend Timedata.InfluxDB: implement the resend (backfill) write path.
  • Edge Timedata.Rrd4j: resend AVERAGE channels at native step and coerce values to the channel's OpenemsType, so integer channels serialise without a float/integer field conflict.
  • Tests for both.

Effect

Backfill after an Edge reconnect actually persists to InfluxDB. Completes the pair with OpenEMS#10 so the NFE fork main builds a fully-working backend + edge (no out-of-tree patches).

🤖 Generated with Claude Code

arindahills and others added 5 commits July 29, 2026 02:48
write(edgeId, ResendDataNotification) was an empty stub, so data replayed by an
Edge after a reconnect (the rrd4j resend pipeline) was silently dropped and gaps
were never filled. Persist it via the same writeData path as timestamped data.

Signed-off-by: arindahills <arinda.hillary@gmail.com>
queryResendData silently dropped AVERAGE-consolidated channels (Voltage,
Current, Frequency, ActivePower) from the backfill: the 'adjustSeconds =
arcStep - 300' shift was 0 for the 300s AVERAGE archive, so the narrow
(<=300s) resend window left rrd4j slots NaN or just outside the window
and only cumulated (3600s) channels survived a reconnect.

Read each channel at the archive matching its consolidation and native
step (mirroring queryHistoricData), and coerce the rrd4j double back to
the channel's OpenemsType so integer/boolean channels are written with
the same field type as live data - otherwise a float-vs-integer field
conflict makes the timeseries backend drop the whole resent point.

Completes resend/backfill support for a plain Timedata.InfluxDB backend.

Signed-off-by: arindahills <293051436+arindahills@users.noreply.github.com>
… a decimal

gson JsonPrimitive#equals treats 100 and 100.0 as equal, so the value check
did not actually verify the OpenemsType coercion. Assert the serialized form
so the regression for the float-vs-integer InfluxDB field conflict is real.

Signed-off-by: arindahills <293051436+arindahills@users.noreply.github.com>
@arindahills
arindahills merged commit 2661f25 into main Jul 28, 2026
2 checks passed
@arindahills
arindahills deleted the fix/timedata-resend-backfill branch July 28, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants