Thanks for the help. I tried your suggestion above; however, it didn't work. So I did a search and found the command line below that worked, i.e. it did a speed test on wgc4.You could use the installed ookla speedtest that spdmerlin uses to possibly get what you are looking for.
Not sure what your script needs.
/jffs/addons/spdmerlin.d/ookla/speedtest --interface="wgc4" --format="human-readable" --unit="Mbps"