How to connect values between day change in Discrete plugin

Hello together,
I have some problems with building a View with the Discrete Visualization.

Thanks in advance for your help.

  • What Grafana version and what operating system are you using?
    9.3.6

  • What are you trying to achieve?
    Build a Graph where I can see the different status of a heat pump
    Connect values between day change in Discrete plugin
    Also the acutal values should be only shown until the actual time

  • How are you trying to achieve it?
    Build a Dashboard with Discrete panel

  • What happened?
    First problem is that the values are not connected between day change. First shown data is when the Source InfluxDB receives a new value. One possiblity is of course to write that datapoints each 10min but maybe there is a different/better solution.
    Second problem is that the values are always shown to the end of the day. I want that the values are stopping at the current time. Find attached picture which shows the problem. Actual time was 08:50.

  • Can you copy/paste the configuration(s) that you are having problems with?

{
  "id": 18,
  "gridPos": {
    "h": 8,
    "w": 21,
    "x": 0,
    "y": 16
  },
  "type": "natel-discrete-panel",
  "title": "Statusanzeige",
  "datasource": {
    "type": "influxdb",
    "uid": "805eBRt4z"
  },
  "backgroundColor": "rgba(128,128,128,0.1)",
  "colorMaps": [
    {
      "$$hashKey": "object:94",
      "color": "#CCC",
      "text": "N/A"
    },
    {
      "$$hashKey": "object:97",
      "color": "#F2495C",
      "text": "aus"
    },
    {
      "$$hashKey": "object:100",
      "color": "#73BF69",
      "text": "ein"
    },
    {
      "$$hashKey": "object:545",
      "color": "#73BF69",
      "text": "heat"
    },
    {
      "$$hashKey": "object:548",
      "color": "#73BF69",
      "text": "water"
    },
    {
      "$$hashKey": "object:703",
      "color": "#F2495C",
      "text": "EVU"
    },
    {
      "$$hashKey": "object:706",
      "color": "#73BF69",
      "text": "Brauchwasser"
    }
  ],
  "crosshairColor": "#8F070C",
  "display": "timeline",
  "extendLastValue": true,
  "highlightOnMouseover": true,
  "legendSortBy": "-ms",
  "lineColor": "rgba(0,0,0,0.1)",
  "metricNameColor": "#000000",
  "rangeMaps": [
    {
      "$$hashKey": "object:71",
      "from": "null",
      "text": "N/A",
      "to": "null"
    }
  ],
  "rowHeight": 50,
  "showLegend": true,
  "showLegendNames": true,
  "showLegendTime": true,
  "showLegendValues": true,
  "showTimeAxis": true,
  "showTransitionCount": true,
  "targets": [
    {
      "alias": "Pelletofen",
      "datasource": {
        "type": "influxdb",
        "uid": "805eBRt4z"
      },
      "groupBy": [],
      "measurement": "Pellet_ein",
      "orderByTime": "ASC",
      "policy": "default",
      "refId": "A",
      "resultFormat": "time_series",
      "select": [
        [
          {
            "params": [
              "value"
            ],
            "type": "field"
          }
        ]
      ],
      "tags": []
    },
    {
      "alias": "Wärmepumpe",
      "datasource": {
        "type": "influxdb",
        "uid": "805eBRt4z"
      },
      "groupBy": [],
      "hide": false,
      "measurement": "WP_Status_EVU",
      "orderByTime": "ASC",
      "policy": "default",
      "refId": "B",
      "resultFormat": "time_series",
      "select": [
        [
          {
            "params": [
              "value"
            ],
            "type": "field"
          }
        ]
      ],
      "tags": []
    },
    {
      "alias": "Wärmepumpe Status",
      "datasource": {
        "type": "influxdb",
        "uid": "805eBRt4z"
      },
      "groupBy": [],
      "hide": false,
      "measurement": "ebus.0.ehp.messages.Status.fields.3.value",
      "orderByTime": "ASC",
      "policy": "default",
      "refId": "C",
      "resultFormat": "time_series",
      "select": [
        [
          {
            "params": [
              "value"
            ],
            "type": "field"
          }
        ]
      ],
      "tags": []
    }
  ],
  "textSize": 24,
  "textSizeTime": 12,
  "timeOptions": [
    {
      "name": "Years",
      "value": "years"
    },
    {
      "name": "Months",
      "value": "months"
    },
    {
      "name": "Weeks",
      "value": "weeks"
    },
    {
      "name": "Days",
      "value": "days"
    },
    {
      "name": "Hours",
      "value": "hours"
    },
    {
      "name": "Minutes",
      "value": "minutes"
    },
    {
      "name": "Seconds",
      "value": "seconds"
    },
    {
      "name": "Milliseconds",
      "value": "milliseconds"
    }
  ],
  "timePrecision": {
    "name": "Minutes",
    "value": "minutes"
  },
  "timeTextColor": "#d8d9da",
  "units": "short",
  "valueMaps": [
    {
      "$$hashKey": "object:69",
      "op": "=",
      "text": "ein",
      "value": "true"
    },
    {
      "$$hashKey": "object:73",
      "op": "=",
      "text": "aus",
      "value": "false"
    },
    {
      "$$hashKey": "object:75",
      "op": "=",
      "text": "n/a",
      "value": "null"
    },
    {
      "$$hashKey": "object:389",
      "op": "=",
      "text": "Heizung",
      "value": "heat"
    },
    {
      "$$hashKey": "object:391",
      "op": "=",
      "text": "Brauchwasser",
      "value": "water"
    },
    {
      "$$hashKey": "object:393",
      "op": "=",
      "text": "aus",
      "value": "off"
    },
    {
      "$$hashKey": "object:395",
      "op": "=",
      "text": "EVU",
      "value": "EVU Sperrzeit"
    }
  ],
  "valueTextColor": "#000000",
  "writeLastValue": true,
  "expandFromQueryS": 0,
  "showDistinctCount": false,
  "showLegendPercent": false,
  "use12HourClock": false,
  "useTimePrecision": false,
  "writeAllValues": false,
  "writeMetricNames": false
}

Best regards
Foradh

Welcome @foradh to the Grafana forum.

I do not use the Discrete plugin, but I do use the State timeline that was introduced in v8. It seems to suffer from the same issues that you described. My solution was to record the state of the item every 15 seconds (it’s just boolean data stored in Influx and the size is small, even after years of data collection). The better way is probably to use a query to record ONLY when the value changes and then plot that data.

Are you using InfluxQL or Flux?

1 Like

Hi Grant,
thanks for your quick reply.
I use InfluxQL. Yes, wie state timeline I have exactly the same problems.
Do you have also a solution that the data is only showing up to the current time?
For the issue beween day change I will also add the regular record after 10min.

@foradh I will try to work on this in the coming days. I think the most difficult aspect is to how to correctly visualize the state in say, a 2 hour window, but the last state change or record is BEFORE that 2-hour window. Maybe someone else has figured this out already.

1 Like