alexjustesen / speedtest-tracker

Speedtest Tracker is a self-hosted internet performance tracking application that runs speedtest checks against Ookla's Speedtest service.
https://speedtest-tracker.dev/
MIT License
2.88k stars 106 forks source link

Homepage dashboards support #81

Closed alexjustesen closed 1 year ago

alexjustesen commented 2 years ago

The following selfhosted homepages reference Speedtest Tracker data for widgets:

zvarg commented 1 year ago

Waiting for homepage support ;)

alexjustesen commented 1 year ago

Waiting for homepage support ;)

Me too, man this developer is slacking 😅

philhagger commented 1 year ago

Would love this!

casudo commented 1 year ago

Any updates?

zvarg commented 1 year ago

I am quietly announcing that @alexjustesen is not authorized to delay this feature to later milestone rather than v0.14.0 🤣🤣

alexjustesen commented 1 year ago

Working a bit slower these days... https://twitter.com/alexjustesen/status/1629641625868681223?t=2kDg6llnqM1hqNvfJhk4jw&s=19

cinderblockgames commented 1 year ago

How are you converting download/upload into Mbps on the Result detail modal? I've almost got this working, but I need to do the same conversion.

alexjustesen commented 1 year ago

@cinderblockgames there is a broken ass method currently doing that conversion, it might be better in the API to not covert any metrics and instead report them as the bytes their stored as.

This also reminds me, I need to create a data model so each attribute is well defined.

cinderblockgames commented 1 year ago

@alexjustesen The issue is that Homepage expects it as Mbps. My widget currently shows 45 Tbsp speeds, lol.

SAS-1 commented 1 year ago

yeah I was playing with it in PowerBI and ended up using this conversion Download/125000 rounding to 2 decimal places same with upload, it looked right when doing a manual check to the web interface. Getting it stored properly would be helpful though

shamoon commented 1 year ago

@alexjustesen The issue is that Homepage expects it as Mbps. My widget currently shows 45 Tbsp speeds, lol.

Homepage expects it in bytes

alexjustesen commented 1 year ago

@alexjustesen The issue is that Homepage expects it as Mbps. My widget currently shows 45 Tbsp speeds, lol.

Homepage expects it in bytes

That's what I had thought, been a while since I've done any Homepage source code diving though

cinderblockgames commented 1 year ago

...Huh. So, I've got this coming out of the API:

{"data":{"id":583,"ping":20.382,"download":45655636,"upload":26669082,

And Homepage is showing me this:

image

Here it is in Speedtest Tracker:

image

alexjustesen commented 1 year ago

@cinderblockgames you'll need to convert bits vs. bytes. Data stored in the table is in bits while Speedtest Tracker UI and Homepage expects bytes (Megabytes)

cinderblockgames commented 1 year ago

@alexjustesen That's still a factor of 8, not 125000. So, 1000000 bits/second = 125000 bytes/second, which matches what's in the UI as well as what Homepage appears to be looking for.

I've got it working with the 125000 division in my fork, if you want to take a look against your Homepage instance: https://github.com/cinderblockgames/speedtest-tracker

alexjustesen commented 1 year ago

Let me do some digging... Resources for later Alex to look at:

shamoon commented 1 year ago

Ultimately homepage can accept any, https://github.com/benphelps/homepage/blob/fb15f5dbc9273a3a024bfd70edad4544ebfe9208/src/widgets/speedtest/component.jsx#L34 or https://github.com/benphelps/homepage/blob/fb15f5dbc9273a3a024bfd70edad4544ebfe9208/src/widgets/nzbget/component.jsx#L30 etc.

If there's a stable API here Im happy to handle the homepage widget, not clear if that part has been implemented here already? Is it documented?

alexjustesen commented 1 year ago

@shamoon not yet, since I'm targeting replacing henrywhitaker3/Speedtest-Tracker I (ideally) want this to be a drop-in replacement for those using Homepage.

In a nutshell henrywhitaker3/Speedtest-Tracker references an incorrect uri /speedtest/latest, I'll be enabling this endpoint for backwards compatibility but forwarding the request it to a more standardized endpoint like /api/results/latest.

Hopefully won't need any changes to Homepage so we don't break anything for those using the abandoned project still.

shamoon commented 1 year ago

Oh now I understand. Yea that would be great for sure, alternatively homepage could probably handle any changes (or just a separate widget) but agree would probably be cleaner here.

Let me know if I can help at any point!

SAS-1 commented 1 year ago

I use Organizr so hopefully it will be the same as Homepage but happy to test for that once ready

alexjustesen commented 1 year ago

Let me know if I can help at any point!

I appreciate it!

alexjustesen commented 1 year ago

I use Organizr so hopefully it will be the same as Homepage but happy to test for that once ready

Organizr uses the same endpoint as Homepage so both will be drop-in replacements once done 🤘: https://github.com/causefx/Organizr/blob/e79b6d39a682f01f8d6d2e6841bb33c5a817d825/api/homepage/speedtest.php#L73

alexjustesen commented 1 year ago

463 introduces /api/speedtest/latest route which enables support for home lab dashboards like Homepage and Organizer

At a later date a robust API will be developed, in the interim this endpoint will serve to close the gap with the dashboards.

alexdelprete commented 1 year ago

Let me know if I can help at any point!

Is there an importer for dashy config? I'd love to test homepage, but I've spent so much time on dashy that doing it all over blocks me from trying homepage. (#lazymode ON) :D

image

alexjustesen commented 1 year ago

@alexdelprete not that I'm aware of and HOLY CRAP

alexdelprete commented 1 year ago

There's more stuff under it...but I stopped there. :)

alexjustesen commented 1 year ago

I have dashboard envy

SAS-1 commented 1 year ago

working great on Organizr image Thanks!

spupuz commented 1 year ago

In homepage is there an example to how to make it work? This version uses https and user and password Henry version wasn't

cinderblockgames commented 1 year ago

@spupuz It's a drop-in replacement; it's exactly the same.

        widget:
          type: speedtest
          url: https://speedtest.example.com
alexjustesen commented 1 year ago

In homepage is there an example to how to make it work? This version uses https and user and password Henry version wasn't

This legacy endpoint isn't behind any authentication and will work with either http or https protocols.

zvarg commented 1 year ago

I was quiet confused, expected only in version 14... I got to do my homewrok here :) image

neonmaus commented 1 year ago

Something is going wrong for me, on the homepage dashboard the upload is exactly the same value as the download, although my upload speed is only half as high as it is also correctly displayed on the speedtester dashboard

image image

The API endpoint "/api/speedtest/latest" also reports the wrong values "id":2,"ping":18.991,"download":522.7744,"upload":522.7744,

alexjustesen commented 1 year ago

Oops... https://github.com/alexjustesen/speedtest-tracker/blob/main/app/Http/Controllers/API/Speedtest/GetLatestController.php#L32-L33

Unless someone can pr a bugfix it'll be a couple of days until I can circle around to fixing it.

neonmaus commented 1 year ago

I have made quickly :)

alexdelprete commented 1 year ago

I have dashboard envy

You definitely should. :D

Yesterday I completed the configuration...I like dashboard, even though it takes a pretty good hit on the servers with all those widgets open while browsing the page. But it's so cool...:)

image

image

image

adam50hhh commented 1 year ago

I have dashboard envy

You definitely should. :D

Yesterday I completed the configuration...I like dashboard, even though it takes a pretty good hit on the servers with all those widgets open while browsing the page. But it's so cool...:)

image

image

image

Are you using homepage?

alexdelprete commented 1 year ago

Are you using homepage?

yes, that is Homepage.

adam50hhh commented 1 year ago

Are you using homepage?

yes, that is Homepage.

Odd question but, how did you get the different groups? (Media, Home Automation, etc.) I'm doing mine and it adds them into different columns. :/

alexdelprete commented 1 year ago

Totally OT here, anyway, did you read the docs? https://gethomepage.dev/en/configs/settings/

It's the Layout setting in settings.yaml.

Here's mine:

title: HomeLab Dash
theme: dark
color: zinc

layout:
  System Management:
    style: row
    columns: 4
  Network Core:
    style: row
    columns: 4
  Network Services:
    style: row
    columns: 4
  Home Automation:
    style: row
    columns: 4
  Media:
    style: row
    columns: 4
  Productivity:
    style: row
    columns: 4
  Starr apps:
    style: row
    columns: 4

headerStyle: boxed
background:
    image: /images/john-towner-FD_sabE544U-unsplash.jpg
    blur: none # none, sm, "", md, lg, xl see https://tailwindcss.com/docs/backdrop-blur
    saturate: 20 # 0, 50, 100 see https://tailwindcss.com/docs/backdrop-saturate
    brightness: 60 # 0, 50, 75 see https://tailwindcss.com/docs/backdrop-brightness
    opacity: 30 # 0-100

providers:
  openweathermap: xxxx
  weatherapi: yyyy

quicklaunch:
    searchDescriptions: true
    hideInternetSearch: false
    hideVisitURL: false

showStats: true
adam50hhh commented 1 year ago

Totally OT here, anyway, did you read the docs? https://gethomepage.dev/en/configs/settings/

It's the Layout setting in settings.yaml.

Here's mine:

You rock! Thanks for the share and pointing me to the right area!!!