Grafana dashboard: SmartThings - Contacts, Motion, & Switches
Description: A SmartThings dashboard for contacts, motion, and switches utilizing the SmartThings Metrics Prometheus exporter: https://github.com/moikot/smartthings-metrics

A SmartThings dashboard for contacts, motion, and switches utilizing the SmartThings Metrics Prometheus exporter: https://github.com/moikot/smartthings-metrics

{
  "__inputs": [
    {
      "name": "DS_PROMETHEUS",
      "label": "Prometheus",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.3.6"
    },
    {
      "type": "panel",
      "id": "natel-discrete-panel",
      "name": "Discrete",
      "version": "0.1.0"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "gnetId": 13551,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1610379084134,
  "links": [
    {
      "asDropdown": true,
      "icon": "external link",
      "tags": [
        "smartthings"
      ],
      "title": "SmartThings",
      "type": "dashboards"
    }
  ],
  "panels": [
    {
      "backgroundColor": "rgba(128,128,128,0.1)",
      "colorMaps": [
        {
          "$$hashKey": "object:13906",
          "color": "rgb(82, 82, 82)",
          "text": "Closed"
        },
        {
          "$$hashKey": "object:13908",
          "color": "#3274D9",
          "text": "Open"
        }
      ],
      "crosshairColor": "#8F070C",
      "datasource": "${DS_PROMETHEUS}",
      "display": "timeline",
      "expandFromQueryS": 0,
      "extendLastValue": true,
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 10,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "highlightOnMouseover": true,
      "id": 4,
      "legendSortBy": "-ms",
      "lineColor": "rgba(0,0,0,0.1)",
      "metricNameColor": "#000000",
      "rangeMaps": [
        {
          "$$hashKey": "object:13821",
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "rowHeight": 35,
      "showLegend": false,
      "showLegendNames": false,
      "showLegendPercent": true,
      "showLegendValues": true,
      "showTimeAxis": true,
      "targets": [
        {
          "expr": "sum by (label)(smartthings_contact_sensor_contact{label=~\"$contacts\"})",
          "instant": false,
          "interval": "",
          "legendFormat": "{{label}}",
          "refId": "A"
        }
      ],
      "textSize": 20,
      "textSizeTime": 12,
      "timeFrom": null,
      "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"
      },
      "timeShift": null,
      "timeTextColor": "#d8d9da",
      "title": "Contacts",
      "transparent": true,
      "type": "natel-discrete-panel",
      "units": "short",
      "useTimePrecision": false,
      "valueMaps": [
        {
          "$$hashKey": "object:13819",
          "op": "=",
          "text": "Closed",
          "value": "0"
        },
        {
          "$$hashKey": "object:13915",
          "op": "=",
          "text": "Open",
          "value": "1"
        }
      ],
      "valueTextColor": "#000000",
      "writeAllValues": false,
      "writeLastValue": true,
      "writeMetricNames": true
    },
    {
      "backgroundColor": "rgba(128,128,128,0.1)",
      "colorMaps": [
        {
          "$$hashKey": "object:7907",
          "color": "#3274D9",
          "text": "On"
        },
        {
          "$$hashKey": "object:7908",
          "color": "rgb(82, 82, 82)",
          "text": "Off"
        }
      ],
      "crosshairColor": "#8F070C",
      "datasource": "${DS_PROMETHEUS}",
      "display": "timeline",
      "expandFromQueryS": 0,
      "extendLastValue": true,
      "fieldConfig": {
        "defaults": {
          "custom": {}
        },
        "overrides": []
      },
      "gridPos": {
        "h": 31,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "highlightOnMouseover": true,
      "id": 6,
      "legendSortBy": "-ms",
      "lineColor": "rgba(0,0,0,0.1)",
      "metricNameColor": "#000000",
      "rangeMaps": [
        {
          "$$hashKey": "object:7929",
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "rowHeight": 22,
      "showLegend": false,
      "showLegendNames": true,
      "showLegendPercent": true,
      "showLegendValues": true,
      "showTimeAxis": true,
      "targets": [
        {
          "expr": "sum by (label)(smartthings_switch_switch{label=~\"$switches\"})",
          "interval": "",
          "legendFormat": "{{label}}",
          "refId": "A"
        }
      ],
      "textSize": 16,
      "textSizeTime": 12,
      "timeFrom": null,
      "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"
      },
      "timeShift": null,
      "timeTextColor": "#d8d9da",
      "title": "Switches",
      "type": "natel-discrete-panel",
      "units": "short",
      "useTimePrecision": false,
      "valueMaps": [
        {
          "$$hashKey": "object:7927",
          "op": "=",
          "text": "On",
          "value": "0"
        },
        {
          "$$hashKey": "object:7931",
          "op": "=",
          "text": "Off",
          "value": "1"
        }
      ],
      "valueTextColor": "#000000",
      "writeAllValues": false,
      "writeLastValue": true,
      "writeMetricNames": true
    },
    {
      "backgroundColor": "rgba(128,128,128,0.1)",
      "colorMaps": [
        {
          "$$hashKey": "object:13008",
          "color": "rgb(82, 82, 82)",
          "text": "No Motion"
        },
        {
          "$$hashKey": "object:13020",
          "color": "#3274D9",
          "text": "Motion"
        }
      ],
      "crosshairColor": "#8F070C",
      "datasource": "${DS_PROMETHEUS}",
      "display": "timeline",
      "expandFromQueryS": 0,
      "extendLastValue": true,
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 22,
        "w": 12,
        "x": 0,
        "y": 10
      },
      "highlightOnMouseover": true,
      "id": 2,
      "legendSortBy": "-ms",
      "lineColor": "rgba(0,0,0,0.1)",
      "metricNameColor": "#000000",
      "pluginVersion": "7.3.3",
      "rangeMaps": [
        {
          "$$hashKey": "object:12520",
          "from": "null",
          "text": "N/A",
          "to": "null"
        }
      ],
      "rowHeight": 28,
      "showLegend": false,
      "showLegendNames": true,
      "showLegendPercent": true,
      "showLegendValues": true,
      "showTimeAxis": true,
      "targets": [
        {
          "expr": "sum by (label)(smartthings_motion_sensor_motion{label=~\"$motion\"})",
          "instant": false,
          "interval": "",
          "legendFormat": "{{label}}",
          "refId": "A"
        }
      ],
      "textSize": 20,
      "textSizeTime": 12,
      "timeFrom": null,
      "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"
      },
      "timeShift": null,
      "timeTextColor": "#d8d9da",
      "title": "Motion",
      "transformations": [],
      "transparent": true,
      "type": "natel-discrete-panel",
      "units": "short",
      "useTimePrecision": false,
      "valueMaps": [
        {
          "$$hashKey": "object:12518",
          "op": "=",
          "text": "Motion",
          "value": "0"
        },
        {
          "$$hashKey": "object:13017",
          "op": "=",
          "text": "No Motion",
          "value": "1"
        }
      ],
      "valueTextColor": "#000000",
      "writeAllValues": false,
      "writeLastValue": true,
      "writeMetricNames": true
    }
  ],
  "refresh": false,
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "smartthings",
    "prometheus"
  ],
  "templating": {
    "list": [
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(smartthings_contact_sensor_contact, label)",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Contacts",
        "multi": true,
        "name": "contacts",
        "options": [],
        "query": "label_values(smartthings_contact_sensor_contact, label)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(smartthings_motion_sensor_motion, label)",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Motion",
        "multi": true,
        "name": "motion",
        "options": [],
        "query": "label_values(smartthings_motion_sensor_motion, label)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_PROMETHEUS}",
        "definition": "label_values(smartthings_switch_switch, label)",
        "error": null,
        "hide": 0,
        "includeAll": true,
        "label": "Switches",
        "multi": true,
        "name": "switches",
        "options": [],
        "query": "label_values(smartthings_switch_switch, label)",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 5,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "SmartThings - Contacts, Motion, & Switches",
  "uid": "lux4rd0labs_st_02",
  "version": 17,
  "description": "A SmartThings dashboard for contacts, motion, and switches utilizing the SmartThings Metrics Prometheus exporter: https://github.com/moikot/smartthings-metrics"
}