Last active
December 4, 2022 00:09
-
-
Save jeffeb3/4adedd744547b6671343310463cf9ecf to your computer and use it in GitHub Desktop.
speedRecorder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
speedtest-cli | |
fastcli | |
adafruit-io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aioUsername = "YOUR USERNAME" | |
aioKey = "YOUR KEY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read two speed test results and store them in adafruit.io's feeds. | |
# You have to make the feeds first, and get the keys. | |
from Adafruit_IO import Client | |
from fastcli import fastcli | |
from speedtest import Speedtest | |
from secrets import aioUsername, aioKey | |
aio = Client(aioUsernam, aioKey) | |
# Fast.com | |
fastspeed = fastcli.run() | |
print("Fast.com: ",fastspeed,"Mbps") | |
# SpeedTest.net | |
servers = [] | |
threads = None | |
s = Speedtest() | |
s.get_servers(servers) | |
s.get_best_server() | |
s.download(threads=threads) | |
s.upload(threads=threads) | |
results = s.results.dict() | |
download = results['download']*1.0e-6 | |
print("speedtest.net download: ",download,"Mbps") | |
upload = results['upload']*1.0e-6 | |
print("speedtest.net upload: ",upload,"Mbps") | |
ping = results['ping'] | |
print("speedtest.net ping: ",ping,"Mbps") | |
# aio | |
aio.send('internet-speeds.st-download', download) | |
aio.send('internet-speeds.st-upload', upload) | |
aio.send('internet-speeds.st-ping', ping) | |
aio.send('internet-speeds.fastdotcom', fastspeed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment