Skip to content

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

Open
arindahills wants to merge 4 commits into
OpenEMS:developfrom
arindahills:pr/influx-resend-backfill
Open

[Backend/Edge] Make resend (backfill) work with a plain Timedata.InfluxDB#3798
arindahills wants to merge 4 commits into
OpenEMS:developfrom
arindahills:pr/influx-resend-backfill

Conversation

@arindahills

@arindahills arindahills commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Backfill of historic data after a reconnect did not work end-to-end with a plain Timedata.InfluxDB backend (only AggregatedInflux handled it). Two independent gaps, fixed here:

  1. Backend Timedata.InfluxDB did not implement the ResendDataNotification write, so resent data was silently ignored. Implemented it to write resent points at their original timestamps, mirroring the timestamped write.

  2. Edge Timedata.Rrd4j.queryResendData silently dropped AVERAGE-consolidated channels (Voltage, Current, Frequency, ActivePower): the adjustSeconds = arcStep - 300 shift is 0 for the 300s AVERAGE archive, so the narrow (<=300s) resend window left slots NaN or just outside the window and only cumulated (3600s) channels survived. Now reads each channel at the archive matching its consolidation and native step (mirroring queryHistoricData), and coerces 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 InfluxDB drop the whole resent point).

Verified on Backend 2026.6.0 + a real Edge over a controlled reconnect: Voltage, Current, Frequency and Energy backfill into the gap at 5-minute resolution with correct types and no field-type conflicts.

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>
@arindahills
arindahills force-pushed the pr/influx-resend-backfill branch from f32e8d9 to 41b9f0a Compare June 30, 2026 21:03
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>
@arindahills arindahills changed the title [Backend] Timedata.InfluxDB: implement resend (backfill) write [Backend/Edge] Make resend (backfill) work with a plain Timedata.InfluxDB Jul 1, 2026
tushabe and others added 2 commits July 1, 2026 16:36
… 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>
@tushabe

tushabe commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@sfeilmeier Could you please help review this PR when you have a moment? It makes resend/backfill work with a plain Timedata.InfluxDB setup: Backend writes ResendDataNotification data, and Edge RRD4J resend reads AVERAGE channels with the correct serialized field types.

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