apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboard-home-confort
  namespace: monitoring
  labels:
    grafana_dashboard: "1"
data:
  home-confort.json: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "Prometheus",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "editable": true,
      "gnetId": null,
      "graphTooltip": 0,
      "iteration": 1581704476891,
      "links": [],
      "panels": [
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorPostfix": false,
          "colorPrefix": false,
          "colorValue": false,
          "colors": [
            "#299c46",
            "rgba(237, 129, 40, 0.89)",
            "#d44a3a"
          ],
          "datasource": null,
          "decimals": null,
          "description": "",
          "format": "dateTimeAsIso",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 2,
            "w": 24,
            "x": 0,
            "y": 0
          },
          "id": 9,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": false,
            "lineColor": "rgb(31, 120, 193)",
            "show": false,
            "ymax": null,
            "ymin": null
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "timestamp(temperature{job=\"$location\",metric=\"SENSOR\"}) * 1000",
              "format": "time_series",
              "instant": true,
              "legendFormat": "last update",
              "refId": "A"
            }
          ],
          "thresholds": "",
          "timeFrom": null,
          "timeShift": null,
          "title": "Last update",
          "transparent": true,
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "cacheTimeout": null,
          "datasource": "Prometheus",
          "gridPos": {
            "h": 6,
            "w": 8,
            "x": 0,
            "y": 2
          },
          "id": 5,
          "links": [],
          "options": {
            "fieldOptions": {
              "calcs": [
                "last"
              ],
              "defaults": {
                "decimals": 1,
                "mappings": [
                  {
                    "id": 0,
                    "op": "=",
                    "text": "N/A",
                    "type": 1,
                    "value": "null"
                  }
                ],
                "max": 45,
                "min": 0,
                "nullValueMode": "connected",
                "thresholds": [
                  {
                    "color": "light-blue",
                    "value": null
                  },
                  {
                    "color": "green",
                    "value": 18
                  },
                  {
                    "color": "yellow",
                    "value": 22
                  },
                  {
                    "color": "orange",
                    "value": 25
                  },
                  {
                    "color": "semi-dark-red",
                    "value": 28
                  }
                ],
                "unit": "celsius"
              },
              "override": {},
              "values": false
            },
            "orientation": "horizontal",
            "showThresholdLabels": true,
            "showThresholdMarkers": true
          },
          "pluginVersion": "6.4.4",
          "targets": [
            {
              "expr": "avg(temperature{job=\"$location\",metric=\"SENSOR\"})",
              "instant": true,
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Current Temperature",
          "type": "gauge"
        },
        {
          "cacheTimeout": null,
          "datasource": "Prometheus",
          "gridPos": {
            "h": 6,
            "w": 8,
            "x": 8,
            "y": 2
          },
          "id": 4,
          "links": [],
          "options": {
            "fieldOptions": {
              "calcs": [
                "last"
              ],
              "defaults": {
                "decimals": 1,
                "mappings": [
                  {
                    "id": 0,
                    "op": "=",
                    "text": "N/A",
                    "type": 1,
                    "value": "null"
                  }
                ],
                "max": 100,
                "min": 0,
                "nullValueMode": "connected",
                "thresholds": [
                  {
                    "color": "orange",
                    "value": null
                  },
                  {
                    "color": "green",
                    "value": 40
                  },
                  {
                    "color": "red",
                    "value": 60
                  }
                ],
                "unit": "percent"
              },
              "override": {},
              "values": false
            },
            "orientation": "horizontal",
            "showThresholdLabels": true,
            "showThresholdMarkers": true
          },
          "pluginVersion": "6.4.4",
          "targets": [
            {
              "expr": "avg(humidity{job=\"$location\",metric=\"SENSOR\"})",
              "instant": true,
              "refId": "A"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Current Humidity",
          "type": "gauge"
        },
        {
          "cacheTimeout": null,
          "colorBackground": false,
          "colorPostfix": false,
          "colorPrefix": false,
          "colorValue": true,
          "colors": [
            "#d44a3a",
            "rgba(237, 129, 40, 0.89)",
            "#299c46"
          ],
          "datasource": null,
          "decimals": 0,
          "description": "Battery status if available for this device",
          "format": "percent",
          "gauge": {
            "maxValue": 100,
            "minValue": 0,
            "show": false,
            "thresholdLabels": false,
            "thresholdMarkers": true
          },
          "gridPos": {
            "h": 6,
            "w": 8,
            "x": 16,
            "y": 2
          },
          "id": 7,
          "interval": null,
          "links": [],
          "mappingType": 1,
          "mappingTypes": [
            {
              "name": "value to text",
              "value": 1
            },
            {
              "name": "range to text",
              "value": 2
            }
          ],
          "maxDataPoints": 100,
          "nullPointMode": "connected",
          "nullText": null,
          "options": {},
          "pluginVersion": "6.4.4",
          "postfix": "",
          "postfixFontSize": "50%",
          "prefix": "",
          "prefixFontSize": "50%",
          "rangeMaps": [
            {
              "from": "null",
              "text": "N/A",
              "to": "null"
            }
          ],
          "sparkline": {
            "fillColor": "rgba(31, 118, 189, 0.18)",
            "full": true,
            "lineColor": "rgb(31, 120, 193)",
            "show": true,
            "ymax": 100,
            "ymin": 0
          },
          "tableColumn": "",
          "targets": [
            {
              "expr": "min(battery{job=\"$location\",metric=\"SENSOR\"})",
              "refId": "A"
            }
          ],
          "thresholds": "25,50",
          "timeFrom": null,
          "timeShift": null,
          "title": "Battery Status",
          "type": "singlestat",
          "valueFontSize": "80%",
          "valueMaps": [
            {
              "op": "=",
              "text": "N/A",
              "value": "null"
            }
          ],
          "valueName": "current"
        },
        {
          "aliasColors": {
            "Heat Index": "red",
            "Humidity": "orange",
            "Temperature": "purple"
          },
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": "Prometheus",
          "decimals": 1,
          "fill": 0,
          "fillGradient": 3,
          "gridPos": {
            "h": 8,
            "w": 24,
            "x": 0,
            "y": 8
          },
          "id": 2,
          "interval": "",
          "legend": {
            "alignAsTable": true,
            "avg": true,
            "current": false,
            "hideEmpty": false,
            "hideZero": false,
            "max": true,
            "min": true,
            "rightSide": true,
            "show": true,
            "sideWidth": null,
            "total": false,
            "values": true
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "connected",
          "options": {
            "dataLinks": []
          },
          "percentage": false,
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [
            {
              "alias": "Humidity",
              "fill": 1,
              "linewidth": 2,
              "yaxis": 2
            },
            {
              "alias": "Temperature",
              "dashes": true
            }
          ],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "sum(temperature{job=\"$location\",metric=\"SENSOR\"})",
              "instant": false,
              "intervalFactor": 1,
              "legendFormat": "Temperature",
              "refId": "A"
            },
            {
              "expr": "sum(humidity{job=\"$location\",metric=\"SENSOR\"})",
              "legendFormat": "Humidity",
              "refId": "B"
            }
          ],
          "thresholds": [
            {
              "colorMode": "ok",
              "fill": true,
              "line": false,
              "op": "gt",
              "value": 40,
              "yaxis": "right"
            },
            {
              "colorMode": "ok",
              "fill": true,
              "line": false,
              "op": "lt",
              "value": 60,
              "yaxis": "right"
            }
          ],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Temperature / Humidity",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "decimals": 0,
              "format": "celsius",
              "label": "Temperature",
              "logBase": 1,
              "max": "40",
              "min": "0",
              "show": true
            },
            {
              "decimals": 0,
              "format": "percent",
              "label": "Humidity",
              "logBase": 1,
              "max": "100",
              "min": "0",
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        }
      ],
      "refresh": "30s",
      "schemaVersion": 20,
      "style": "dark",
      "tags": [
        "IoT"
      ],
      "templating": {
        "list": [
          {
            "allValue": null,
            "current": {
              "tags": [],
              "text": "kitchen_hum_temp",
              "value": "kitchen_hum_temp"
            },
            "datasource": "Prometheus",
            "definition": "label_values(temperature, job)",
            "hide": 0,
            "includeAll": false,
            "label": "location",
            "multi": false,
            "name": "location",
            "options": [],
            "query": "label_values(temperature, job)",
            "refresh": 1,
            "regex": "",
            "skipUrlSync": false,
            "sort": 1,
            "tagValuesQuery": "",
            "tags": [],
            "tagsQuery": "",
            "type": "query",
            "useTags": false
          }
        ]
      },
      "time": {
        "from": "now-24h",
        "to": "now"
      },
      "timepicker": {
        "refresh_intervals": [
          "5s",
          "10s",
          "30s",
          "1m",
          "5m",
          "15m",
          "30m",
          "1h",
          "2h",
          "1d"
        ]
      },
      "timezone": "",
      "title": "Home confort",
      "uid": "J45F0oxZz",
      "version": 5
    }
