Ubidots Community

Expanding on the "Test your internet speed using a Raspberry Pi + Ubidots" script

Hello,

I’m a new Ubidots user (and not a Python guy at all). I’m wondering if there is a simple way to add to the little script posted in this great article:

What I’d like to do is add other devices on the network (internal or external) that I can also ping.

For example, I’ve got five SmartThings mesh devices - I’d love to have a gauge for each showing the ping response times. I don’t know enough about Python to know for sure, but I suspect the destination of the device being pinged is specified in the imported “speedtest” script. What I’d like to do is add a number of static IP addresses for it to ping as well. Any ideas how I might do that?

Original script from the article is this:

#!/usr/bin/python

import speedtest
import requests

st = speedtest.Speedtest()
st.get_best_server()
payload = {‘Download’: round(st.download() / 1000000, 2) , ‘Upload’: round(st.upload() / 1000000, 2), ‘Ping’: round(st.results.ping, 2)}

r = requests.post(‘http://things.ubidots.com/api/v1.6/devices/raspberry-pi/?token=YOUR-UBIDOTS-TOKEN-HERE’, data=payload)