Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data extrapolation for connected devices #65

Open
muenzpraeger opened this issue Oct 24, 2022 · 12 comments
Open

Data extrapolation for connected devices #65

muenzpraeger opened this issue Oct 24, 2022 · 12 comments
Labels
blocked-by-InfluxDB-mess First the way forward with InfluxDB needs to be solved - see #114

Comments

@muenzpraeger
Copy link
Contributor

I was wondering if you're open to add some more data extrapolation capabilities for active devices to the project.

Specifically:

  • Is part of Mesh
  • Wifi frequency
  • Upstream / Downstream speed
  • Parent device

Alternatively maybe an option to use a config file with additional services that would then be merged at runtime into the built-in config.

Happy to provide a PR for any of that.

@bb-Ricardo
Copy link
Owner

Hi @muenzpraeger,

I'm open to additions to the current collected data. If you know where to pull the data from you are more then welcome to create a PR. Please fork from next-release as there are already a lot of changes prepared for the next version.

@bb-Ricardo
Copy link
Owner

Hi @muenzpraeger,

Just pushed 0faba89 which reworks your PR a bit. Can you review and test it let me know what you think?

I removed the separation between powerline and wifi upstream and downstream values. The regex should now match all cases.

@bb-Ricardo bb-Ricardo added this to the 1.1 milestone Oct 29, 2022
@bb-Ricardo
Copy link
Owner

Also a dashboard is still missing.

We should add another "Wifi" Dashboard.

@muenzpraeger
Copy link
Contributor Author

Change looks good. I can add my dashboard. That's in InfluxQL, but if I recall correctly you're moving to Flux, no?

@bb-Ricardo
Copy link
Owner

Hi,

Yes I try to limit maintenance to one type of Dahboards. A Flux Dashboard would be great.

@bb-Ricardo
Copy link
Owner

Hey,

I would like to get version 1.1.0 out of the door. Is it ok if I release this version and add the dashboard later?

@muenzpraeger
Copy link
Contributor Author

Feel free to release. Still reading through Flux documentation...

@bb-Ricardo
Copy link
Owner

Great. Or just post the influx version here (or a PR) and I'll try to convert it to Flux queries

@muenzpraeger
Copy link
Contributor Author

Actually I've got it working now. 😄 Feel free to adjust as you see fit.

{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- 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,
  "graphTooltip": 0,
  "id": 4,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "p2cAWORRz"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "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": "auto",
            "spanNulls": false,
            "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": 12,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.2.1",
      "targets": [
        {
          "alias": "$col",
          "datasource": {
            "type": "influxdb",
            "uid": "p2cAWORRz"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "name"
              ],
              "type": "tag"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "fritzbox",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: v.defaultBucket)\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => (r[\"_value\"]>0 and (r._field == \"active_hosts_upstream\" or r._field == \"active_hosts_downstream\")))\n  |> filter(fn: (r) => (r._field == \"active_hosts_upstream\" or r._field == \"active_hosts_downstream\"))\n  |> filter(fn: (r) => contains(value: r[\"name\"], set: ${device:json}))\n  |> group(columns: [\"_measurement\", \"_field\"])\n  |> map(fn: (r) => ({ r with _field: \n      if r._field == \"active_hosts_upstream\" then r.name + \" Upstream\" else r.name + \" Downstream\"\n  }))\n  |> map(fn: (r) => ({\n    _time: r._time,\n    _field: r._field,\n    _value: r._value\n  }))\n\n\n\n",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "active_hosts_name"
                ],
                "type": "field"
              },
              {
                "params": [
                  "alias"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": []
        }
      ],
      "title": "Connection Speed",
      "type": "timeseries"
    }
  ],
  "refresh": false,
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": true,
          "text": [
            "Ella-iPhone",
            "Badezimmer"
          ],
          "value": [
            "Ella-iPhone",
            "Badezimmer"
          ]
        },
        "datasource": {
          "type": "influxdb",
          "uid": "p2cAWORRz"
        },
        "definition": "from(bucket: v.defaultBucket)\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => (r[\"_value\"]>0 and (r._field == \"active_hosts_upstream\" or r._field == \"active_hosts_downstream\")))\n  |> map(fn: (r) => ({\n    label: r.name\n  }))\n\n\n\n",
        "hide": 0,
        "includeAll": true,
        "label": "Device",
        "multi": true,
        "name": "device",
        "options": [],
        "query": "from(bucket: v.defaultBucket)\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => (r[\"_value\"]>0 and (r._field == \"active_hosts_upstream\" or r._field == \"active_hosts_downstream\")))\n  |> map(fn: (r) => ({\n    label: r.name\n  }))\n\n\n\n",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-7d",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Connection over time",
  "uid": "FlGAWdggk",
  "version": 25,
  "weekStart": ""
}

@bb-Ricardo
Copy link
Owner

Thank you for the dashboard. I get the idea but need to rework it a bit. Also couldn't import the dashboard because the uuid for the datasource was not found. The issue is, you have to set the export to "extern" so it can be imported by other people. I think this is a silly option which should be the default, but is isn't.

I will have a look into a Wifi dashboard the next few days.

@bb-Ricardo bb-Ricardo modified the milestones: 1.1.0, 1.2.0 Nov 2, 2022
@dp20eic
Copy link

dp20eic commented Nov 10, 2022

Hello,
I also tried a dashboard, I hope I interpreted the requirements correctly.

Dashboard Connection over time:

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB2-FRITZINFLUXDB",
      "label": "InfluxDB2-fritzinfluxdb",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.2.4"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- 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,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB2-FRITZINFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "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": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "Mbit/s"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 22,
        "w": 24,
        "x": 0,
        "y": 0
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "min",
            "max"
          ],
          "displayMode": "table",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.2.4",
      "targets": [
        {
          "alias": "$col",
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB2-FRITZINFLUXDB}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "name"
              ],
              "type": "tag"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "fritzbox",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: v.defaultBucket)\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => (r._field == \"active_hosts_upstream\" or r._field == \"active_hosts_downstream\"))\n  |> filter(fn: (r) => r[\"name\"] =~ /^${device:regex}$/)\n  |> group(columns: [\"_measurement\", \"_field\"])\n  |> map(fn: (r) => ({ r with _field: \n      if r._field == \"active_hosts_upstream\" then r.name + \" Upstream\" else r.name + \" Downstream\"\n  }))\n  |> map(fn: (r) => ({\n    _time: r._time,\n    _field: r._field,\n    _value: r._value\n  }))\n\n\n\n",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "active_hosts_name"
                ],
                "type": "field"
              },
              {
                "params": [
                  "alias"
                ],
                "type": "alias"
              }
            ]
          ],
          "tags": []
        }
      ],
      "title": "Connection Speed",
      "type": "timeseries"
    }
  ],
  "refresh": false,
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "allValue": "",
        "current": {},
        "datasource": {
          "type": "influxdb",
          "uid": "${DS_INFLUXDB2-FRITZINFLUXDB}"
        },
        "definition": "from(bucket: v.defaultBucket)\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"fritzbox\" and (r[\"_field\"] == \"active_hosts_downstream\" and r[\"_value\"]>0) or (r[\"_field\"] == \"active_hosts_upstream\" and  r[\"_value\"]>0) and r[\"box\"] == \"fritz.box\")\n  |> distinct(column: \"uid\")\n  |> map(fn: (r) => ({\n     label: r.name\n  }))",
        "hide": 0,
        "includeAll": true,
        "label": "Device",
        "multi": false,
        "name": "device",
        "options": [],
        "query": "from(bucket: v.defaultBucket)\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"fritzbox\" and (r[\"_field\"] == \"active_hosts_downstream\" and r[\"_value\"]>0) or (r[\"_field\"] == \"active_hosts_upstream\" and  r[\"_value\"]>0) and r[\"box\"] == \"fritz.box\")\n  |> distinct(column: \"uid\")\n  |> map(fn: (r) => ({\n     label: r.name\n  }))",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Connection over time Copy",
  "uid": "mu2hGBDVz",
  "version": 2,
  "weekStart": ""
}

But I noticed something. I use a FritzBox 7590 and a FRITZ!WLAN Repeater 1160.
Now I noticed that all the devices that are connected to the repeater are not visible in my dashboard because some values ​​are missing.

Question, new problem or can this be managed by configuration?

@bb-Ricardo bb-Ricardo modified the milestones: 1.2.0, 1.30 Dec 22, 2022
@bb-Ricardo bb-Ricardo modified the milestones: 1.2.1, 1.3.0 Jan 26, 2023
@bb-Ricardo
Copy link
Owner

Sorry for not working on this. It is currently blocked by this issue #114. I need to find a good way forward with influxDB as I don't like to repeat everything once again.

Any ideas from your side?

@bb-Ricardo bb-Ricardo removed this from the 1.3.0 milestone Jul 13, 2024
@bb-Ricardo bb-Ricardo added the blocked-by-InfluxDB-mess First the way forward with InfluxDB needs to be solved - see #114 label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-by-InfluxDB-mess First the way forward with InfluxDB needs to be solved - see #114
Projects
None yet
Development

No branches or pull requests

3 participants