Grafana dashboard: Trend Data by Device


{
  "__inputs": [
    {
      "name": "DS_INFINITYHTTPDATASOURCE",
      "label": "InfinityHTTPDataSource",
      "description": "",
      "type": "datasource",
      "pluginId": "yesoreyeram-infinity-datasource",
      "pluginName": "Infinity"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "8.2.2"
    },
    {
      "type": "panel",
      "id": "table",
      "name": "Table",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    },
    {
      "type": "panel",
      "id": "yesoreyeram-boomtheme-panel",
      "name": "Boom Theme",
      "version": "0.1.1"
    },
    {
      "type": "datasource",
      "id": "yesoreyeram-infinity-datasource",
      "name": "Infinity",
      "version": "0.7.8"
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- 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,
  "gnetId": 15382,
  "graphTooltip": 1,
  "id": null,
  "iteration": 1643771141156,
  "links": [
    {
      "asDropdown": false,
      "icon": "external link",
      "includeVars": true,
      "keepTime": false,
      "tags": [
        "Status"
      ],
      "targetBlank": false,
      "title": "Device Status",
      "tooltip": "",
      "type": "dashboards",
      "url": ""
    }
  ],
  "liveNow": false,
  "panels": [
    {
      "datasource": "${DS_INFINITYHTTPDATASOURCE}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 9,
        "w": 23,
        "x": 0,
        "y": 0
      },
      "id": 4,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "table",
          "placement": "right"
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "pluginVersion": "8.1.3",
      "repeat": "DeviceID",
      "repeatDirection": "v",
      "targets": [
        {
          "columns": [
            {
              "selector": "1",
              "text": "Point Type",
              "type": "string"
            },
            {
              "selector": "4",
              "text": "Value",
              "type": "number"
            },
            {
              "selector": "3",
              "text": "tmst",
              "type": "timestamp"
            },
            {
              "selector": "2",
              "text": "Units",
              "type": "string"
            }
          ],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "timeseries",
          "global_query_id": "",
          "hide": false,
          "json_options": {
            "columnar": false,
            "root_is_not_array": false
          },
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://api.infisense.com/data/",
          "url_options": {
            "data": "",
            "headers": [
              {
                "key": "X-API-KEY",
                "value": "$ApiKey"
              }
            ],
            "method": "GET",
            "params": [
              {
                "key": "end_time",
                "value": "${__to:date:iso}"
              },
              {
                "key": "return_type",
                "value": "json"
              },
              {
                "key": "data_version",
                "value": "2"
              },
              {
                "key": "device_ids",
                "value": "$DeviceID"
              },
              {
                "key": "start_time",
                "value": "${__from:date:iso}"
              },
              {
                "key": "iso8601_date_format",
                "value": "true"
              }
            ]
          }
        },
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "${__to:date:YYYY-MM-dd hh:mm:ss}",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "refId": "B",
          "root_selector": "",
          "source": "inline",
          "type": "csv",
          "url": "https://jsonplaceholder.typicode.com/users",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Interval Data for $DeviceID",
      "transformations": [
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "desc": false,
                "field": "tmst"
              }
            ]
          }
        },
        {
          "id": "prepareTimeSeries",
          "options": {}
        },
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "temperature celsius",
              "operator": "*",
              "reducer": "sum",
              "right": "1.8"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "temperature fahrenheit",
            "binary": {
              "left": "temperature celsius * 1.8",
              "operator": "+",
              "reducer": "sum",
              "right": "32"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "temperature C",
              "operator": "*",
              "reducer": "sum",
              "right": "1.8"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "temperature F",
            "binary": {
              "left": "temperature C * 1.8",
              "operator": "+",
              "reducer": "sum",
              "right": "32"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "temperature C": true,
              "temperature C * 1.8": true,
              "temperature celsius": true,
              "temperature celsius * 1.8": true
            },
            "indexByName": {},
            "renameByName": {}
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "activeThemeId": 0,
      "datasource": null,
      "description": "",
      "disableThemePicker": true,
      "gridPos": {
        "h": 1,
        "w": 1,
        "x": 23,
        "y": 0
      },
      "id": 8,
      "targets": [
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "queryType": "randomWalk",
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://jsonplaceholder.typicode.com/users",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "themes": [
        {
          "name": "Night Theme",
          "styles": [
            {
              "props": {
                "theme": "default"
              },
              "type": "basetheme"
            },
            {
              "props": {
                "text": "#ApiKey {\n-webkit-text-security: disc;\nplaceholder: \"Input API Key\";\n}"
              },
              "type": "style"
            }
          ]
        }
      ],
      "transparent": true,
      "type": "yesoreyeram-boomtheme-panel"
    },
    {
      "datasource": "${DS_INFINITYHTTPDATASOURCE}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "align": "auto",
            "displayMode": "auto",
            "filterable": true
          },
          "links": [
            {
              "title": "View Interval Data",
              "url": "/d/ujYaV3S7k?var-ApiKey=$ApiKey&var-DeviceID=${__data.fields.device_id}&from=﻿﻿﻿${from}&to=${to}"
            }
          ],
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "signal_strength"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "color-text"
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "options": {
                      "No Issues": {
                        "color": "green",
                        "index": 1
                      },
                      "Unknown": {
                        "color": "#87878b",
                        "index": 2
                      },
                      "fair": {
                        "color": "yellow",
                        "index": 3
                      },
                      "good": {
                        "color": "green",
                        "index": 0
                      }
                    },
                    "type": "value"
                  }
                ]
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Last Heard (Minutes)"
            },
            "properties": [
              {
                "id": "custom.displayMode",
                "value": "basic"
              },
              {
                "id": "color",
                "value": {
                  "mode": "thresholds"
                }
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 720
                    },
                    {
                      "color": "red",
                      "value": 1440
                    }
                  ]
                }
              },
              {
                "id": "max",
                "value": 1440
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 11,
        "w": 23,
        "x": 0,
        "y": 9
      },
      "id": 12,
      "options": {
        "showHeader": true,
        "sortBy": []
      },
      "pluginVersion": "8.2.2",
      "targets": [
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "queryType": "randomWalk",
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://api.infisense.com/network/device/status",
          "url_options": {
            "data": "",
            "headers": [
              {
                "key": "X-API-KEY",
                "value": "$ApiKey"
              }
            ],
            "method": "GET"
          }
        },
        {
          "columns": [],
          "csv_options": {
            "columns": "",
            "comment": "",
            "delimiter": ",",
            "relax_column_count": false,
            "skip_empty_lines": false,
            "skip_lines_with_error": false
          },
          "data": "",
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "hide": false,
          "json_options": {
            "columnar": false,
            "root_is_not_array": false
          },
          "refId": "B",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://api.infisense.com/device/?keys=user_context&partial=true&include_gateways=false&return_type=json-object",
          "url_options": {
            "data": "",
            "headers": [
              {
                "key": "X-API-KEY",
                "value": "$ApiKey"
              }
            ],
            "method": "GET",
            "params": []
          }
        }
      ],
      "title": "Device Status",
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "calculateField",
          "options": {
            "alias": "Last Heard (Minutes)",
            "binary": {
              "left": "last_heard_seconds",
              "operator": "/",
              "reducer": "sum",
              "right": "60"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": false
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "_configuration": true,
              "account_id": true,
              "app_eui": true,
              "battery_level_volts": false,
              "configuration": true,
              "created_at": true,
              "device_status": true,
              "device_version": true,
              "last_heard": true,
              "last_heard_seconds": true,
              "network": true,
              "project_id": true,
              "serial_number": true,
              "status": true,
              "type": true
            },
            "indexByName": {
              "Customer_Address": 11,
              "Customer_Gateway_ID": 12,
              "Customer_Name": 10,
              "Last Heard (Minutes)": 5,
              "_configuration": 13,
              "account_id": 8,
              "battery_level_volts": 7,
              "device_id": 0,
              "device_status": 3,
              "device_type": 1,
              "last_heard": 4,
              "last_heard_seconds": 9,
              "network": 2,
              "signal_strength": 6
            },
            "renameByName": {
              "signal_strength": "Device Signal Strength / Gateway Connectivity"
            }
          }
        },
        {
          "id": "filterByValue",
          "options": {
            "filters": [
              {
                "config": {
                  "id": "equal",
                  "options": {
                    "value": "gateway"
                  }
                },
                "fieldName": "device_type"
              }
            ],
            "match": "any",
            "type": "exclude"
          }
        },
        {
          "id": "sortBy",
          "options": {
            "fields": {},
            "sort": [
              {
                "field": "Last Heard (Minutes)"
              }
            ]
          }
        }
      ],
      "type": "table"
    }
  ],
  "refresh": false,
  "schemaVersion": 31,
  "style": "dark",
  "tags": [
    "Interval"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "description": null,
        "error": null,
        "hide": 1,
        "label": null,
        "name": "ApiKey",
        "options": [
          {
            "selected": false,
            "text": "c5b0cc4743603b8ce809dba8ee2a8a5b",
            "value": "c5b0cc4743603b8ce809dba8ee2a8a5b"
          }
        ],
        "query": "",
        "skipUrlSync": false,
        "type": "textbox"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "${DS_INFINITYHTTPDATASOURCE}",
        "definition": "InfinityHTTPDataSource- (infinity) ",
        "description": "Select Device ID",
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "Device ID",
        "multi": true,
        "name": "DeviceID",
        "options": [],
        "query": {
          "infinityQuery": {
            "columns": [],
            "csv_options": {
              "columns": "",
              "comment": "",
              "delimiter": ",",
              "relax_column_count": false,
              "skip_empty_lines": false,
              "skip_lines_with_error": false
            },
            "data": "",
            "filters": [],
            "format": "table",
            "refId": "variable",
            "root_selector": "",
            "source": "url",
            "type": "csv",
            "url": "https://api.infisense.com/device/",
            "url_options": {
              "data": "",
              "headers": [
                {
                  "key": "X-API-KEY",
                  "value": "$ApiKey"
                }
              ],
              "method": "GET",
              "params": [
                {
                  "key": "return_type",
                  "value": "csv"
                },
                {
                  "key": "include_gateways",
                  "value": "false"
                }
              ]
            }
          },
          "query": "",
          "queryType": "infinity"
        },
        "refresh": 2,
        "regex": "[0-9a-z]{16}",
        "skipUrlSync": false,
        "sort": 1,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Trend Data by Device",
  "uid": "ujYaV3S7k",
  "version": 43
}