apiVersion: v1
kind: ConfigMap
metadata:
  name: pvcontrol-dashboard
  labels:
     grafana_dashboard: "1"
data:
  pvcontrol-dashboard.json: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,
            "datasource": "-- Grafana --",
            "enable": true,
            "hide": true,
            "iconColor": "rgba(0, 211, 255, 1)",
            "name": "Annotations & Alerts",
            "type": "dashboard"
          }
        ]
      },
      "editable": true,
      "gnetId": null,
      "graphTooltip": 1,
      "links": [],
      "panels": [
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 9,
            "w": 24,
            "x": 0,
            "y": 0
          },
          "hiddenSeries": false,
          "id": 4,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.2",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "max(pvcontrol_meter_power_consumption_total_watts) without (pod, instance)",
              "interval": "",
              "legendFormat": "Total",
              "refId": "A"
            },
            {
              "expr": "max(pvcontrol_meter_power_consumption_total_watts-pvcontrol_wallbox_power_watts) without (pod, instance)",
              "hide": false,
              "interval": "",
              "legendFormat": "Home",
              "refId": "B"
            },
            {
              "expr": "max(pvcontrol_wallbox_power_watts) without (pod, instance)",
              "hide": false,
              "interval": "",
              "legendFormat": "Car",
              "refId": "C"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Power Consumption",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:166",
              "format": "watt",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "$$hashKey": "object:167",
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "description": "Positive grid values = consume from grid; negative grid values = feeding into grid\n",
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 9
          },
          "hiddenSeries": false,
          "id": 2,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.2",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "max(pvcontrol_meter_power_watts) without(pod, instance)",
              "interval": "",
              "legendFormat": "{{source}}",
              "refId": "A"
            }
          ],
          "thresholds": [
            {
              "$$hashKey": "object:82",
              "colorMode": "warning",
              "fill": false,
              "line": true,
              "op": "lt",
              "value": 0,
              "yaxis": "left"
            }
          ],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Power Sources",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:62",
              "format": "watt",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "$$hashKey": "object:63",
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 8,
            "w": 24,
            "x": 0,
            "y": 19
          },
          "hiddenSeries": false,
          "id": 6,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.2",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "max(pvcontrol_wallbox_max_current_amperes) without (pod, instance)",
              "interval": "",
              "legendFormat": "Max Current",
              "refId": "A"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Wallbox: Max Current",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:346",
              "format": "amp",
              "label": null,
              "logBase": 1,
              "max": null,
              "min": null,
              "show": true
            },
            {
              "$$hashKey": "object:347",
              "decimals": 0,
              "format": "short",
              "label": "",
              "logBase": 1,
              "max": "3",
              "min": "0",
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "aliasColors": {},
          "bars": false,
          "dashLength": 10,
          "dashes": false,
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "fill": 0,
          "fillGradient": 0,
          "gridPos": {
            "h": 5,
            "w": 24,
            "x": 0,
            "y": 27
          },
          "hiddenSeries": false,
          "id": 9,
          "legend": {
            "avg": false,
            "current": false,
            "max": false,
            "min": false,
            "show": true,
            "total": false,
            "values": false
          },
          "lines": true,
          "linewidth": 1,
          "nullPointMode": "null",
          "options": {
            "alertThreshold": true
          },
          "percentage": false,
          "pluginVersion": "7.4.2",
          "pointradius": 2,
          "points": false,
          "renderer": "flot",
          "seriesOverrides": [],
          "spaceLength": 10,
          "stack": false,
          "steppedLine": false,
          "targets": [
            {
              "expr": "max(pvcontrol_wallbox_phases_out) without (pod, instance)",
              "hide": false,
              "interval": "",
              "legendFormat": "# Phases (out)",
              "refId": "B"
            },
            {
              "expr": "max(pvcontrol_wallbox_phases_in) without (pod, instance)",
              "hide": false,
              "interval": "",
              "legendFormat": "# Phases (in)",
              "refId": "C"
            }
          ],
          "thresholds": [],
          "timeFrom": null,
          "timeRegions": [],
          "timeShift": null,
          "title": "Wallbox: Phases",
          "tooltip": {
            "shared": true,
            "sort": 0,
            "value_type": "individual"
          },
          "type": "graph",
          "xaxis": {
            "buckets": null,
            "mode": "time",
            "name": null,
            "show": true,
            "values": []
          },
          "yaxes": [
            {
              "$$hashKey": "object:346",
              "decimals": 0,
              "format": "short",
              "label": null,
              "logBase": 1,
              "max": "3",
              "min": "0",
              "show": true
            },
            {
              "$$hashKey": "object:347",
              "decimals": 0,
              "format": "short",
              "label": "",
              "logBase": 1,
              "max": "3",
              "min": "0",
              "show": true
            }
          ],
          "yaxis": {
            "align": false,
            "alignLevel": null
          }
        },
        {
          "cards": {
            "cardHSpacing": 2,
            "cardMinWidth": 5,
            "cardRound": null,
            "cardVSpacing": 2
          },
          "color": {
            "cardColor": "#b4ff00",
            "colorScale": "sqrt",
            "colorScheme": "interpolateGnYlRd",
            "defaultColor": "#757575",
            "exponent": 0.5,
            "mode": "discrete",
            "thresholds": [
              {
                "$$hashKey": "object:125",
                "color": "#C0D8FF",
                "tooltip": "OFF",
                "value": "1"
              },
              {
                "$$hashKey": "object:133",
                "color": "#73BF69",
                "tooltip": "PV_ONLY",
                "value": "2"
              },
              {
                "$$hashKey": "object:137",
                "color": "#37872D",
                "tooltip": "PV_ALL",
                "value": "3"
              },
              {
                "$$hashKey": "object:186",
                "color": "#C4162A",
                "tooltip": "MAX",
                "value": "4"
              },
              {
                "$$hashKey": "object:190",
                "color": "#FF780A",
                "tooltip": "MANUAL",
                "value": "5"
              }
            ]
          },
          "datasource": null,
          "fieldConfig": {
            "defaults": {
              "custom": {}
            },
            "overrides": []
          },
          "gridPos": {
            "h": 4,
            "w": 24,
            "x": 0,
            "y": 32
          },
          "highlightCards": true,
          "id": 8,
          "legend": {
            "show": true
          },
          "nullPointMode": "as empty",
          "pageSize": 15,
          "pluginVersion": "7.4.2",
          "seriesFilterIndex": -1,
          "statusmap": {
            "ConfigVersion": "v1"
          },
          "targets": [
            {
              "expr": "(max_over_time(pvcontrol_controller_mode{pvcontrol_controller_mode=\"OFF\"}[$__interval]) == 1) * 1",
              "interval": "",
              "legendFormat": "Mode",
              "refId": "A"
            },
            {
              "expr": "(max_over_time(pvcontrol_controller_mode{pvcontrol_controller_mode=\"PV_ONLY\"}[$__interval]) == 1) * 2",
              "hide": false,
              "interval": "",
              "legendFormat": "Mode",
              "refId": "C"
            },
            {
              "expr": "(max_over_time(pvcontrol_controller_mode{pvcontrol_controller_mode=\"PV_ALL\"}[$__interval]) == 1) * 3",
              "hide": false,
              "interval": "",
              "legendFormat": "Mode",
              "refId": "D"
            },
            {
              "expr": "(max_over_time(pvcontrol_controller_mode{pvcontrol_controller_mode=\"MAX\"}[$__interval]) == 1) * 4",
              "hide": false,
              "interval": "",
              "legendFormat": "Mode",
              "refId": "B"
            },
            {
              "expr": "(max_over_time(pvcontrol_controller_mode{pvcontrol_controller_mode=\"MANUAL\"}[$__interval]) == 1) * 5",
              "hide": false,
              "interval": "",
              "legendFormat": "Mode",
              "refId": "E"
            }
          ],
          "timeFrom": null,
          "timeShift": null,
          "title": "Charge Mode",
          "tooltip": {
            "extraInfo": "",
            "freezeOnClick": true,
            "items": [],
            "show": true,
            "showExtraInfo": false,
            "showItems": false
          },
          "type": "flant-statusmap-panel",
          "useMax": true,
          "usingPagination": false,
          "xAxis": {
            "show": true
          },
          "yAxis": {
            "maxWidth": -1,
            "minWidth": -1,
            "show": true
          },
          "yAxisSort": "metrics",
          "yLabel": {
            "delimiter": "",
            "labelTemplate": "",
            "usingSplitLabel": false
          }
        }
      ],
      "schemaVersion": 27,
      "style": "dark",
      "tags": [],
      "templating": {
        "list": []
      },
      "time": {
        "from": "now-6h",
        "to": "now"
      },
      "timepicker": {},
      "timezone": "",
      "title": "PV Control",
      "uid": "DhDWBAkRk",
      "version": 3
    }