pvnode: revert to end-labelled interval resampling (#33133)

This commit is contained in:
andig 2026-08-24 11:30:53 +02:00 • committed by GitHub
parent b15f81a85a
commit 1416134c1d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View file

@ -51,15 +51,16 @@ render: |
type: bearer type: bearer
token: {{ .apikey }} token: {{ .apikey }}
jq: | jq: |
# values are the average power of the 15min interval starting at the timestamp. # values are the average power of the 15min interval ending at the timestamp,
# per https://github.com/evcc-io/evcc/pull/33102#issuecomment-5392639519.
# evcc expects the power at the timestamp, which is the mean of the intervals # evcc expects the power at the timestamp, which is the mean of the intervals
# meeting there- the leading interval is dropped as its predecessor is unknown. # meeting there- the trailing interval is dropped as its successor is unknown.
[.values[] | {t: (.timestamp | fromdateiso8601), v: .pv_power}] as $s [.values[] | {t: (.timestamp | fromdateiso8601), v: .pv_power}] as $s
| [ range(1; ($s|length)) | | [ range(0; ($s|length)-1) |
{ {
start: ($s[.].t | todateiso8601), start: ($s[.].t | todateiso8601),
end: ($s[.].t + 900 | todateiso8601), end: ($s[.].t + 900 | todateiso8601),
value: ((($s[.-1].v + $s[.].v) / 2) | round) value: ((($s[.].v + $s[.+1].v) / 2) | round)
} }
] | tostring ] | tostring
interval: {{ .interval }} interval: {{ .interval }}

View file

@ -54,15 +54,16 @@ render: |
type: bearer type: bearer
token: {{ .apikey }} token: {{ .apikey }}
jq: | jq: |
# values are the average power of the 15min interval starting at the timestamp. # values are the average power of the 15min interval ending at the timestamp,
# per https://github.com/evcc-io/evcc/pull/33102#issuecomment-5392639519.
# evcc expects the power at the timestamp, which is the mean of the intervals # evcc expects the power at the timestamp, which is the mean of the intervals
# meeting there- the leading interval is dropped as its predecessor is unknown. # meeting there- the trailing interval is dropped as its successor is unknown.
[.values[] | {t: (.dtm | sub(" "; "T") + "Z" | fromdateiso8601), v: .pv_watts}] as $s [.values[] | {t: (.dtm | sub(" "; "T") + "Z" | fromdateiso8601), v: .pv_watts}] as $s
| [ range(1; ($s|length)) | | [ range(0; ($s|length)-1) |
{ {
start: ($s[.].t | todateiso8601), start: ($s[.].t | todateiso8601),
end: ($s[.].t + 900 | todateiso8601), end: ($s[.].t + 900 | todateiso8601),
value: ((($s[.-1].v + $s[.].v) / 2) | round) value: ((($s[.].v + $s[.+1].v) / 2) | round)
} }
] | tostring ] | tostring
interval: {{ .interval }} interval: {{ .interval }}