Skip to content

Instantly share code, notes, and snippets.

@der-pw
Created April 16, 2024 15:00
Show Gist options
  • Save der-pw/d7ae83b56c8af303cfe30e2ad5a37e01 to your computer and use it in GitHub Desktop.
Save der-pw/d7ae83b56c8af303cfe30e2ad5a37e01 to your computer and use it in GitHub Desktop.
Grafna Dashboard Timelines bool-values and 3-state
{
"__inputs": [
{
"name": "DS_INFLUXDB",
"label": "influxdb",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "10.4.1"
},
{
"type": "datasource",
"id": "influxdb",
"name": "InfluxDB",
"version": "1.0.0"
},
{
"type": "panel",
"id": "state-timeline",
"name": "State timeline",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"custom": {
"fillOpacity": 100,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineWidth": 0,
"spanNulls": 3600000
},
"mappings": [
{
"options": {
"false": {
"color": "semi-dark-blue",
"index": 1,
"text": "aus"
},
"true": {
"color": "light-yellow",
"index": 2,
"text": "an"
}
},
"type": "value"
},
{
"options": {
"result": {
"color": "semi-dark-purple",
"index": 0,
"text": "N/A"
}
},
"type": "range"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 0
},
"id": 3,
"options": {
"alignValue": "center",
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"mergeValues": true,
"rowHeight": 0.9,
"showValue": "always",
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "7.3.0-test",
"targets": [
{
"alias": "TV",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"Fernseher_state\" WHERE time >= ${__from}ms - 24h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "Sz Lichterkette",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"Sz_Lichterkette_state\" WHERE time >= ${__from}ms - 24h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "Allg. Anzeigetafel 1",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"Allg_Anzeigetafel1_state\" WHERE time >= ${__from}ms - 24h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "C",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
}
],
"title": "Betriebszeiten",
"transparent": true,
"type": "state-timeline"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "continuous-GrYlRd"
},
"custom": {
"fillOpacity": 100,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineWidth": 5,
"spanNulls": false
},
"mappings": [
{
"options": {
"false": {
"color": "green",
"index": 1,
"text": "anwesend"
},
"true": {
"color": "semi-dark-red",
"index": 2,
"text": "abwesend"
}
},
"type": "value"
},
{
"options": {
"result": {
"index": 0,
"text": "N/A"
}
},
"type": "range"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 4,
"w": 24,
"x": 0,
"y": 4
},
"id": 4,
"options": {
"alignValue": "center",
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"mergeValues": true,
"rowHeight": 0.9,
"showValue": "always",
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "7.3.0-test",
"targets": [
{
"alias": "Patrick",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"Patrick_abwesend\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "Larissa",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"Larissa_abwesend\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
}
],
"title": "Anwesenheitsübersicht",
"transparent": true,
"type": "state-timeline"
},
{
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"description": "Zeigt ob und welche Fenster, geöffnet oder gekippt sind.",
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "green",
"mode": "continuous-GrYlRd"
},
"custom": {
"fillOpacity": 75,
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineWidth": 0,
"spanNulls": false
},
"mappings": [
{
"options": {
"0": {
"color": "semi-dark-green",
"index": 3,
"text": "geschlossen"
},
"1": {
"color": "light-yellow",
"index": 2,
"text": "gekippt"
},
"2": {
"color": "#c52b3d",
"index": 1,
"text": "offen"
}
},
"type": "value"
},
{
"options": {
"result": {
"color": "purple",
"index": 0,
"text": "N/A"
}
},
"type": "range"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 6,
"w": 24,
"x": 0,
"y": 8
},
"id": 5,
"options": {
"alignValue": "center",
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"mergeValues": true,
"rowHeight": 0.87,
"showValue": "always",
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"pluginVersion": "7.3.0-test",
"targets": [
{
"alias": "R Kü Fenster",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"3state_kueche_fenster-rechts\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "L Kü Fenster",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"3state_kueche_fenster-links\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "Sz Balkontür",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"3state_schlafzimmer_balkontuer\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "C",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "Wz Balkontür",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"3state_wohnzimmer_balkontuer\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "D",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
},
{
"alias": "Kinderzimmer",
"datasource": {
"type": "influxdb",
"uid": "${DS_INFLUXDB}"
},
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"previous"
],
"type": "fill"
}
],
"hide": false,
"limit": "",
"measurement": "Patrick_away",
"orderByTime": "ASC",
"policy": "global",
"query": "SELECT last(\"value\") FROM \"global\".\"3state_kinderzimmer_fenster\" WHERE time >= ${__from}ms - 48h AND time <= ${__to}ms GROUP BY time($__interval) fill(previous)",
"rawQuery": true,
"refId": "E",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "last"
}
]
],
"tags": [],
"tz": ""
}
],
"title": "Fensterstatus",
"transparent": true,
"type": "state-timeline"
}
],
"refresh": "",
"schemaVersion": 39,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-24h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Status Zeitleisten",
"uid": "_7CFLIcGz",
"version": 2,
"weekStart": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment