Chart Aggregate Series starts at 1970

  • Platform information:

    • Hardware: Raspberry Pi 4
    • OS: Linux/5.10.63-v8+ (aarch64)
    • Java Runtime Environment: 11.0.13 (Zulu11.52+13-CA)
    • openHAB version: 3.2.0
    • persistence: RRD4j
  • Issue of the topic:
    I’m trying to make graphs that can show the power usage and generation per day/week/month (depending on the device and the available data). This is data coming from a Smart meter (DSMR P1) and data coming from a SolarEdge installation in the house.
    In this case the SolarEdge provides the data of day to day generation and monthly generation itself, no fancy math or anything required. The DSMR needs a bit of fiddeling where the previous day is substracted from the current day value.
    The SolarEdge graph always shows but is somehow fixed to 1970. The DSMR data only shows when editting the page and going into the run mode (but result in the same strange behaviour).

When making any aggregated series chart the date of the chart immediately goes to 01-01-1970 and shows the value only on that day.

Tried to fix another chart too see if i’m doing something wrong and it seems to behave the same. The strange thing is when I have the chart drawn as regular time series the graph shows just fine.

I currently have a graph for both, but they behave the same way and I currently don’t see what I’m doing wrong:

-SolarEdge (Always showing the graph at 1970):

config:
  label: Zonnepanelen dagelijks opgewekt
  period: M
  chartType: month
slots:
  grid:
    - component: oh-chart-grid
      config:
        show: true
        containLabel: true
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
        nameLocation: end
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: Opgewekt
  series:
    - component: oh-aggregate-series
      config:
        name: Dag opbrengst
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: bar
        item: SolarEdgeOmvormer_Aggregate_Day_Production
        dimension1: date
        aggregationFunction: max
        service: rrd4j

This should show the production per day, but comes up like this:

Any ideas on what is going wrong here?

Small bit of extra info here:

The SolarEdge data is always reset on the new day / month.
The value shown in the graph is 18743Wh while the value measured for today is 14659Wh.

The value for the DSMR is set to Maximum with an offset of -1 day. This value as it is from the energy meter is always increasing, thus the -1 day. Its code for the graph looks like this:

config:
  label: Totaal verbruik
  chartType: month
slots:
  grid:
    - component: oh-chart-grid
      config: {}
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: kWh
  series:
    - component: oh-aggregate-series
      config:
        name: Dagverbruik
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: bar
        item: P1StroomGasmeter_TotaalDagverbruik
        dimension1: date
        aggregationFunction: max
        service: rrd4j
        offsetUnit: day
        offsetAmount: -1
    - component: oh-aggregate-series
      config:
        name: Nachterbruik
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: bar
        item: P1StroomGasmeter_TotaalNachtverbruik
        dimension1: date
        aggregationFunction: max
        offsetUnit: day
        service: rrd4j
        offsetAmount: -1
    - component: oh-aggregate-series
      config:
        name: Teruglevering Dag
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: bar
        item: P1StroomGasmeter_TerugleveringDag
        dimension1: date
        aggregationFunction: max
        service: rrd4j
        offsetUnit: day
        offsetAmount: -1
    - component: oh-aggregate-series
      config:
        name: Teruglevering Nacht
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: bar
        item: P1StroomGasmeter_TeruggelevingNacht
        dimension1: date
        aggregationFunction: max
        service: rrd4j
        offsetUnit: day
        offsetAmount: -1

This is a sign that the date is not being supplied. On most computers, date and time is actually represented by the number of milliseconds since midnight, January 1st, 1970 GMT. So when you see a date time with a dare in January 1970 that’s a pretty good sign that the date is not being considered.

That’s interesting.

Go to Developer Tools → API Explorer → persistence → GET /persistence/items/{itemname} and query for some data on one of your Items. This will return something like:

{
  "name": "TestSwitch",
  "datapoints": "2879",
  "data": [
    {
      "time": 1649857800000,
      "state": "ON"
    },
    {
      "time": 1649857860000,
      "state": "ON"
    },
...
``

Those "time" entries are in epoch (num milliseconds since the start of 1970). You can use a website like https://www.epochconverter.com/ to convert that to human readable form.

1649857800000 becomes Wednesday, April 13, 2022 7:50:00 AM GMT-06:00 DST.

Verify that the times for a few entries makes sense. That will tell us if the problem is in the persisted data (which is unlikely since the one chart works) or the problem is in the UI.

[quote="VV3SL3Y, post:2, topic:135104"]
The value for the DSMR is set to Maximum with an offset of -1 day. This value as it is from the energy meter is always increasing, thus the -1 day. Its code for the graph looks like this:
[/quote]
This could be causing problems too. I'm not certain how those offset parameters work. What happens without them? That could point to the core problem.

I’ve gone through the data. I indeed thought that it would had to do with the epoch time but it doesn’t explain why one chart is working.
I gotten the data of one of the items and the epoch time that it returned makes sense when looking at it:

{
  "name": "SolarEdgeOmvormer_Aggregate_Day_Production",
  "datapoints": "1440",
  "data": [
    {
      "time": 1649870940000,
      "state": "14603.0"
    },
    {
      "time": 1649871000000,
      "state": "14603.0"
    },
    {
      "time": 1649871060000,
      "state": "14603.0"
    },
    {
      "time": 1649871120000,
      "state": "14630.0"
    },
    {
      "time": 1649871180000,
      "state": "14630.0"
    },
    {
      "time": 1649871240000,
      "state": "14630.0"
    },
    {
      "time": 1649871300000,
      "state": "14630.0"
    },
    {
      "time": 1649871360000,
      "state": "14630.0"
    },
    {
      "time": 1649871420000,
      "state": "14630.0"
    },

So I don’t think that that is the issue.

– Edit [15-10-2022]:
I’ve gotten the graphs fixed. Currently the data is showing and the graphs don’t bug out anymore.
It took some fiddeling and re-adding the graphs multiple times, but they now look something like this:

Power usage:

config:
  chartType: month
  label: Stroomverbruik Dagelijks
  visibleTo:
    - role:administrator
slots:
  grid:
    - component: oh-chart-grid
      config:
        show: true
  legend:
    - component: oh-chart-legend
      config:
        bottom: bottom
        orient: horizontal
        show: true
  series:
    - component: oh-aggregate-series
      config:
        aggregationFunction: diff_last
        dimension1: date
        gridIndex: 0
        item: P1StroomGasmeter_TotaalDagverbruik
        name: Verbruik Dag
        offsetAmount: 1
        offsetUnit: day
        type: bar
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-aggregate-series
      config:
        aggregationFunction: diff_last
        dimension1: date
        gridIndex: 0
        item: P1StroomGasmeter_TotaalNachtverbruik
        name: Verbruik Nacht
        offsetAmount: 1
        offsetUnit: day
        type: bar
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-aggregate-series
      config:
        aggregationFunction: diff_last
        dimension1: date
        gridIndex: 0
        item: P1StroomGasmeter_TerugleveringDag
        name: Teruglevering Dag
        offsetAmount: 1
        offsetUnit: day
        type: bar
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-aggregate-series
      config:
        aggregationFunction: diff_last
        dimension1: date
        gridIndex: 0
        item: P1StroomGasmeter_TeruggelevingNacht
        name: Teruglevering Nacht
        offsetAmount: 1
        offsetUnit: day
        type: bar
        xAxisIndex: 0
        yAxisIndex: 0
  tooltip:
    - component: oh-chart-tooltip
      config:
        show: true
  xAxis:
    - component: oh-category-axis
      config:
        categoryType: month
        gridIndex: 0
        monthFormat: default
        weekdayFormat: default
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: kWh

Gas usage:

config:
  chartType: month
  label: Gasverbruik Dagelijks
  visibleTo:
    - role:administrator
slots:
  grid:
    - component: oh-chart-grid
      config:
        containLabel: true
        show: true
    - component: oh-chart-grid
      config: {}
  series:
    - component: oh-aggregate-series
      config:
        aggregationFunction: diff_last
        dimension1: date
        gridIndex: 0
        item: P1StroomGasmeter_Gasverbruik
        name: Verbruik Dag
        offsetAmount: 1
        offsetUnit: day
        type: bar
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-aggregate-series
      config:
        aggregationFunction: diff_last
        dimension1: month
        gridIndex: 1
        item: P1StroomGasmeter_Gasverbruik
        name: Verbruik Dag
        offsetAmount: 1
        offsetUnit: day
        type: bar
        xAxisIndex: 1
        yAxisIndex: 1
  tooltip:
    - component: oh-chart-tooltip
      config:
        show: true
  xAxis:
    - component: oh-category-axis
      config:
        categoryType: month
        gridIndex: 0
        monthFormat: default
        weekdayFormat: default
    - component: oh-category-axis
      config:
        categoryType: year
        gridIndex: 1
        monthFormat: default
        weekdayFormat: default
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: M3
    - component: oh-value-axis
      config:
        gridIndex: 1
        name: M3

Hope this helps for people running into the same issue.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.