Created
March 3, 2021 12:57
-
-
Save eloquentarduino/d5bf7291351181a101324497ddcd62a0 to your computer and use it in GitHub Desktop.
Wifi indoor positioning for PC/Raspberry Pi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from rssi import RSSI_Scan | |
from time import sleep | |
if __name__ == '__main__': | |
scanner = RSSI_Scan('wlp2s0') | |
lines = [] | |
while True: | |
location = input('Enter location (leave empty to exit): ') | |
if not location: | |
print('No location entered, exiting...') | |
break | |
repeat = int(input('How many samples will you take? ')) | |
for i in range(repeat): | |
print('scanning %d/%d' % (i + 1, repeat)) | |
networks = scanner.getAPinfo(sudo=True) | |
rssis = {network['ssid']: network['signal'] for network in networks} | |
rssis.update(__location=location) | |
lines.append(json.dumps(rssis)) | |
print(lines[-1]) | |
print('Here comes the data for port_wifi_indoor_positioning()') | |
[print(line) for line in lines] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment