It is currently March 29th, 2024, 7:03 am

Accurate data for local networks with DD-WRT routers

Tips and Tricks from the Rainmeter Community
User avatar
krzysiunet
Posts: 2
Joined: September 13th, 2015, 8:08 pm
Location: Katowice, Poland

Accurate data for local networks with DD-WRT routers

Post by krzysiunet »

At first - hello! My name is Krzysztof, I came from Katowice in Poland. Please see spoiler, to read about me and about licensing of my code.
I'm webmaster and programmer. I'm rather busy guy, so sometimes it tooks longer to get answer on question to me. I like open licenses, so if I'll give code and I'll forgot to note license, it means it's on CC-BY 4.0 and MIT.

I don't support "no commercial" licenses, as you can't use it even if you don't want to earn on that. Like Facebook - posting picture or posting (not linking) code on FB or Twitter or most social networks is against the license and law (as you give FB license to use it commercially). If you want to earn money on stuff I made, then I'd be glad. If you sell it, I don't lose anything and somebody (you) have profits - great!

And a big "no" to "no derivative" licenses, because my axis of life is doing things by myself or modifying it to fit me. If you don't care about proper licensing it's ok with me. Just please attribute it to my website, where I gather some tutorials and stuff I made. If you'd want to visit it, then sorry, the English version have problem with licenses. In a month or so most things will be properly described and it will be easier to search for open license materials.

Remember that copyright law don't apply to ideas. If you'd use my or somebody's idea it's a moral thing, not copyright thing. I'm attributing ideas, but your choice is up to you.

Some people want to donate authors of nice things. If you'd want to donate me someday, then I'd be grateful. The donation I'd love is sending me e-mail or PM with information that you use it - I love to hear it, it makes me smile to hear that other people found it useful :)
Requirements
* router in your LAN
* DD-WRT software on your router
** If you don't have it, I recommend it. Check their database, maybe you can already use it. If you like their software and you want to buy a cheap wifi router with DD-WRT support, then TP-Link TL-WR740N could be bought a new one for less than 15 EUR. Maybe there's something cheaper right now, I don't have a clue.
* disabled "Info Site Password Protection" setting (default)
* optional: wi-fi (to get more precious data)

Result
Actual and accurate data about your network. Sometimes more precise than getting data from Windows with much better refresh rate. You can use data of other machines in your LAN.
What kind of data? Most things from attached picture. To check all available data in poorly readable form data see the file we will be getting data from. Some router could have more informations. I guess that routers based on Broadcom chipset will have more.

The idea
I needed to get data about both Rx and Tx rate and current signal quality, but with better refresh rate than Windows offers. Also it turns out that Windows data is not accurate.

As DD-WRT router offers unprotected status page, I wanted to fetch HTML and get data from there. It turned out you can't simply fetch HTML. It's even better. There's something JSON alike. The example JSON-alike file is here.

That page is located on http://192.168.0.1/Info.live.htm, where 192.168.0.1 is your router IP.

Example of use
I needed Tx Rate, Rx rate and quality of signal displayed in percents. Take note that my regular expression isn't good, but if you don't know how to use them, you can use mine, of course.

It's not copyrighted (too trivial to call it "work" in copyright law definition), but if you want license, then it's CC-BY 4.0/MIT (not compatibile with CC-NC-SA, see spoiler on the top to see why).

Code: Select all

[MeasureWifi]
Measure=Plugin
Plugin=WebParser
UpdateRate=5
URL=http://192.168.0.1/Info.live.htm
RegExp=(?siU)'XX:XX:XX:XX:XX:XX','ath0','.*','(.*)M','(.*)M','.*','.*','.*','.*','(.*)[0-9]'

[MeasureTX]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWifi]
StringIndex=1

[MeasureRX]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWifi]
StringIndex=2

[MeasureQuality]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWifi]
StringIndex=3
Change:
* XX:XX:XX:XX:XX:XX to your (or machine you want to get data from) Mac number
* ath0 to interface name (you will find it in Status page in Clients section)
* 192.168.0.1 to your router IP