Grafana dashboard: AirVisual
Description: AirVisual Panels

### Improvement of this dashboard : https://grafana.com/grafana/dashboards/12359 

Get your API key from ``https://www.iqair.com/dashboard/api`` and replace ``<AIRVISUAL_API_KEY>`` in config. Restart Telegraf or his container.

Please, remember - API Key **valid for one year!** After that time you need to get new one and update configs!
And **limit 10k request / month**.

Also, for sure update ``urls`` by list of cities you need, and don't forget to update dashboard queries related to your cities configuration.

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB-LOCAL",
      "label": "InfluxDB-local",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "7.3.2"
    },
    {
      "type": "panel",
      "id": "graph",
      "name": "Graph",
      "version": ""
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": "-- Grafana --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "AirVisual Panels",
  "editable": true,
  "gnetId": 13410,
  "graphTooltip": 0,
  "id": null,
  "iteration": 1605923295958,
  "links": [],
  "panels": [
    {
      "datasource": "${DS_INFLUXDB-LOCAL}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-blue",
                "value": null
              },
              {
                "color": "dark-green",
                "value": 15
              },
              {
                "color": "#EAB839",
                "value": 25
              },
              {
                "color": "dark-orange",
                "value": 30
              },
              {
                "color": "dark-red",
                "value": 37
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 10,
        "x": 0,
        "y": 0
      },
      "id": 5,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.2",
      "repeat": "City",
      "repeatDirection": "v",
      "targets": [
        {
          "alias": "Temperature",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_weather_tp\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\" =~ /$City$/) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_weather_tp"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Temperature ℃ - $City",
      "type": "stat"
    },
    {
      "datasource": "${DS_INFLUXDB-LOCAL}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": 50
              },
              {
                "color": "dark-orange",
                "value": 100
              },
              {
                "color": "dark-red",
                "value": 150
              },
              {
                "color": "dark-purple",
                "value": 200
              },
              {
                "color": "rgb(255, 255, 255)",
                "value": 300
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 6,
        "x": 10,
        "y": 0
      },
      "id": 4,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.2",
      "repeat": "City",
      "repeatDirection": "v",
      "targets": [
        {
          "alias": "Air Quality",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_pollution_aqius\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\"  =~ /$City$/) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_pollution_aqius"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Air Quality - $City",
      "type": "stat"
    },
    {
      "datasource": "${DS_INFLUXDB-LOCAL}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-red",
                "value": null
              },
              {
                "color": "dark-orange",
                "value": 10
              },
              {
                "color": "dark-green",
                "value": 20
              },
              {
                "color": "dark-purple",
                "value": 50
              },
              {
                "color": "dark-blue",
                "value": 70
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 16,
        "y": 0
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.2",
      "repeat": "City",
      "repeatDirection": "v",
      "targets": [
        {
          "alias": "Humidity",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_weather_hu\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\" =~ /$City$/) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_weather_hu"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Humidity % - $City",
      "type": "stat"
    },
    {
      "datasource": "${DS_INFLUXDB-LOCAL}",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "dark-green",
                "value": null
              },
              {
                "color": "dark-orange",
                "value": 1000
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 5,
        "w": 4,
        "x": 20,
        "y": 0
      },
      "id": 7,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "last"
          ],
          "fields": "",
          "values": false
        },
        "textMode": "auto"
      },
      "pluginVersion": "7.3.2",
      "repeat": "City",
      "repeatDirection": "v",
      "targets": [
        {
          "alias": "Pressure",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_weather_pr\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\" =~ /$City$/ ) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_weather_pr"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        }
      ],
      "timeFrom": null,
      "timeShift": null,
      "title": "Pressure - $City",
      "type": "stat"
    },
    {
      "aliasColors": {},
      "bars": false,
      "dashLength": 10,
      "dashes": false,
      "datasource": "${DS_INFLUXDB-LOCAL}",
      "description": "",
      "fieldConfig": {
        "defaults": {
          "custom": {},
          "links": []
        },
        "overrides": []
      },
      "fill": 1,
      "fillGradient": 1,
      "gridPos": {
        "h": 5,
        "w": 24,
        "x": 0,
        "y": 10
      },
      "hiddenSeries": false,
      "id": 2,
      "legend": {
        "alignAsTable": true,
        "avg": true,
        "current": true,
        "max": false,
        "min": false,
        "rightSide": true,
        "show": true,
        "total": false,
        "values": true
      },
      "lines": true,
      "linewidth": 1,
      "nullPointMode": "null",
      "options": {
        "alertThreshold": true
      },
      "percentage": false,
      "pluginVersion": "7.3.2",
      "pointradius": 2,
      "points": false,
      "renderer": "flot",
      "repeat": "City",
      "repeatDirection": "v",
      "seriesOverrides": [],
      "spaceLength": 10,
      "stack": false,
      "steppedLine": false,
      "targets": [
        {
          "alias": "AirQuality",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_pollution_aqius\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\" =~ /$City$/) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_pollution_aqius"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        },
        {
          "alias": "Temperature",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_weather_tp\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\" =~ /$City$/) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_weather_tp"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        },
        {
          "alias": "Humidity",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "measurement": "airvisual",
          "orderByTime": "ASC",
          "policy": "autogen",
          "query": "SELECT last(\"data_current_weather_hu\") FROM \"autogen\".\"airvisual\" WHERE (\"data_city\" =~ /$City$/) AND $timeFilter GROUP BY time($__interval) fill(previous)",
          "rawQuery": true,
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "data_current_weather_hu"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "data_city",
              "operator": "=",
              "value": "Vitry-Sur-Seine"
            }
          ]
        }
      ],
      "thresholds": [],
      "timeFrom": null,
      "timeRegions": [],
      "timeShift": null,
      "title": "AirVisual - $City",
      "tooltip": {
        "shared": true,
        "sort": 0,
        "value_type": "individual"
      },
      "type": "graph",
      "xaxis": {
        "buckets": null,
        "mode": "time",
        "name": null,
        "show": true,
        "values": []
      },
      "yaxes": [
        {
          "$$hashKey": "object:185",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        },
        {
          "$$hashKey": "object:186",
          "format": "short",
          "label": null,
          "logBase": 1,
          "max": null,
          "min": null,
          "show": true
        }
      ],
      "yaxis": {
        "align": false,
        "alignLevel": null
      }
    }
  ],
  "refresh": "10s",
  "schemaVersion": 26,
  "style": "dark",
  "tags": [
    "airvisual"
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "InfluxDB-local",
          "value": "InfluxDB-local"
        },
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": null,
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "influxdb",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "allValue": null,
        "current": {},
        "datasource": "$datasource",
        "definition": "",
        "error": null,
        "hide": 0,
        "includeAll": false,
        "label": "City",
        "multi": true,
        "name": "City",
        "options": [],
        "query": "SHOW TAG VALUES FROM \"autogen\".\"airvisual\" WITH KEY=data_city",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "tagValuesQuery": "",
        "tags": [],
        "tagsQuery": "",
        "type": "query",
        "useTags": false
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ]
  },
  "timezone": "",
  "title": "AirVisual",
  "uid": "UrpOSvkMz",
  "version": 22
}