Fun Comparing RSSI example (Windows)

I wrote a simple script to get the current Signal Quality percentage (not RSSI) from a Windows 10 laptop and using the Mist API to get the RSSI associated with my MAC address and run continuously. You will need to ^c to break out of the script. Keep in mind the Mist AP reports its stats every 60 seconds or so.

I did look up turning the percentage into RSSI and found a few things others had done but I will leave that up to the reader if they want to add that.

Inspiration from https://github.com/mike-albano/rssi_getter

This worked with a Windows 10 laptop with a basic Python3.7 download.  Follow the instructions to edit your Windows path to include where Python is installed as well as where the “Scripts” directory is.  I did need to do a “pip3 install requests

The command to get WiFi information in windows is “netsh wlan show interface” and you will note that both the MAC address and WiFi Signal percentage is here.  If I were to write from scratch I would call this once and get both values but I wanted to keep a similar model to the previous Apple script so I called it twice.

This is the script.

I am not a Python coder and this was a challenge for me.  I’m sure there is a more elegant way to do this but it worked for me.  Note the get_windowsmac() and get_clientrssi() look almost similar.  This is what took a little time to figure out, so I thought I would share the value of the debug print on line 41.  We create a dictionary on line 37 and when I tried to reuse get_clientrssi() that debug print showed me the MAC address was being split into separate values because we used the “:” as the split object. (MAC address is colon delimited)

 

By using that debug print I could see what was happening.  Doing a little Google searching I figured out the change in line 40.  By turning ‘:’ into ‘: ‘ (adding a space) the debug print looked like this:

And then it worked.  Python is interesting because there is no 1 way to do things and if you do Google searches you will find folks have posted answers and sample code for almost anything you can think of.

All course scripts are available on GitHub.  Pls click link below