Show Download and Upload speed on your LaMetric Time

Following a request at the LaMetric forum I wrote a small Python script for displaying your current download and upload speed  on a LaMetric Time. The script can run on your own laptop or server (preferred).

Basically you need to do two things:

  • Create an app for the LaMetric Time
  • run the script that performs the speed test and push the results to the device

1. Create an indicator app

This is quite an easy thing to do. You need an account for the LaMetric developer area (it’s free, so don’t worry). In the developer area you can create a new app – in this case select indicator application.

On the new page, you can create the layout of the app. You need two text frames, one for the download speed and one for the upload speed. Also choose an icon for each frame, I decided to use a green down and green up arrow. It’s important that you select “Push” so that you can send your information to the LaMetric Time.

My design looks like this, but I later decided to drop the “Mbit/s”. It made the text too long, which is ok, the text will scroll on the display, but it means you have to wait for the scrolling to end, before the next frame is displayed. Plus I know that it’s Mbit/s. I’m also thinking about dropping the “UL” and “DL” prefix, since the arrows give me enough information.

Next you need to enter some information about the app, that is displayed in the store. You nee an App name and a short description, also make sure to check the “Private app” field.

Click “Save” and the app is ready to be published. On the next page you will see the URLs and the access token that is needed to send data to the app. Copy the “Local Push URL” and “Access token”. You could also use the “Push URL” instead of the local one, but I prefer it that way. I find it unnecessary  to send the data from my server at home to the LaMetric servers from where it comes back to my LaMetric Time which stands 5m away from my server.

Hit “Publish” and after a few minutes you should get a mail telling you that your app is ready.

Now you can install the app on your LaMetric Time. The following four screenshots describe how to do this:

Now your LaMetric Time is ready to receive data.

2. Run the script periodically on your server to update the values

The script can be found on GitHub: lm_connection_speed – if you don’t know how to clone a repository, you can also directly download the files: Download

I recommend Python 3, but it should work (no guarantee) with Python 2. It has three dependencies (requests, json and speedtest-cli). Please make sure install those before running the script.

Open the connection_speed.py in an text editor and look for lines 21/22 and insert the access token and push url from above. Save the file and you are good to go.

If you remember I said that I don’t want to see the “Mbit/s” – if you want to see it, you need to change two more lines in the file:

dl_rate = "DL {:.2f}".format(DL / 1000 / 1000)
dl_icon = "i402"
ul_rate = "UL {:.2f}".format(UL / 1000 / 1000)
ul_icon = "i120"

needs to be:

dl_rate = "DL {:.2f} Mbit/s".format(DL / 1000 / 1000)
dl_icon = "i402"
ul_rate = "UL {:.2f} Mbit/s".format(UL / 1000 / 1000)
ul_icon = "i120"

Now you can run the script

python3 connection_speed.py

Have a look the remarks in the README and for running the script periodically please consult your preferred search engine.

1
Leave a comment

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Laurent Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Laurent
Guest
Laurent

Thank you! Worked flawlessly!