Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hotspot Wifi informations #937

Closed
nicolargo opened this issue Oct 12, 2016 · 6 comments
Closed

Add hotspot Wifi informations #937

nicolargo opened this issue Oct 12, 2016 · 6 comments

Comments

@nicolargo
Copy link
Owner

Description

Thanks to the Wifi lib (https://wifi.readthedocs.io/en/latest/scanning.html), grab and display Wifi hotspot information.

from wifi import Cell, Scheme
Cell.all('wlan0')

This returns a list of Cell objects. Under the hood, this calls iwlist scan and parses the unfriendly output.

Each cell object should have the following attributes:

ssid
signal
quality
frequency
bitrates
encrypted
channel
address
mode

For cells that have encrypted as True, there will also be the following attributes:

encryption_type
@nicolargo nicolargo added this to the Version 2.8 milestone Oct 12, 2016
@nicolargo
Copy link
Owner Author

nicolargo commented Oct 12, 2016

In [4]: w = wifi.Cell.all('wlp2s0')

In [5]: w
Out[5]: 
[Cell(ssid=Freebox-40A258),
 Cell(ssid=FreeWifi),
 Cell(ssid=FreeWifi_secure),
 Cell(ssid=FREEBOX_ALENA_R3),
 Cell(ssid=FreeWifi),
 Cell(ssid=FreeWifi_secure),
 Cell(ssid=)]

In [8]: w[0]
Out[8]: Cell(ssid=Freebox-40A258)

In [9]: w[0].ssid
Out[9]: u'Freebox-40A258'

In [10]: w[0].signal
Out[10]: -44

In [11]: w[0].quality
Out[11]: u'66/70'

In [12]: w[0].frequency
Out[12]: u'2.472 GHz'

In [14]: w[0].bitrates
Out[14]: 
[u'1 Mb/s',
 u'2 Mb/s',
 u'5.5 Mb/s',
 u'11 Mb/s',
 u'22 Mb/s',
 u'6 Mb/s',
 u'9 Mb/s',
 u'12 Mb/s',
 u'18 Mb/s',
 u'24 Mb/s',
 u'36 Mb/s',
 u'48 Mb/s',
 u'54 Mb/s']

In [15]: w[0].mode
Out[15]: u'Master'

@nicolargo
Copy link
Owner Author

nicolargo commented Oct 21, 2016

Preview:

wifi

nicolargo added a commit that referenced this issue Oct 21, 2016
nicolargo added a commit that referenced this issue Oct 21, 2016
nicolargo added a commit that referenced this issue Oct 21, 2016
@nicolargo
Copy link
Owner Author

nicolargo commented Oct 21, 2016

Implementation available in the DEVELOP branch.

ONLY for GNU/Linux Operating System

Please test it.

@nclsHart / @notFloran : Can you implement it on the WebUI ?

@notFloran
Copy link
Collaborator

@nicolargo I don't have a computer with linux and wifi, can you send me a json of the api results ?

@nicolargo
Copy link
Owner Author

@notFloran : Here it is:

curl http://0.0.0.0:61208/api/2/wifi

[{"ssid": "Freebox-40A258", "encrypted": true, "signal": -45, "key": "ssid", "encryption_type": "wpa2", "quality": "65/70"}]

curl http://0.0.0.0:61208/api/2/wifi/views

{"Freebox-40A258": {"ssid": {"decoration": "DEFAULT", "optional": false, "additional": false, "splittable": false}, "encrypted": {"decoration": "DEFAULT", "optional": false, "additional": false, "splittable": false}, "signal": {"decoration": "OK", "optional": false, "additional": false, "splittable": false}, "key": {"decoration": "DEFAULT", "optional": false, "additional": false, "splittable": false}, "encryption_type": {"decoration": "DEFAULT", "optional": false, "additional": false, "splittable": false}, "quality": {"decoration": "OK", "optional": false, "additional": false, "splittable": false}}}

In my example there is only one hotspot. You can have multiple hotspot (one dict per hotspot).
If encrypted = true then encryption_type is eqaul to the encryption algorithm. If encrypted = false then encryption_type is equal to 'null' (do not display in the WebUI).

@nicolargo nicolargo reopened this Oct 30, 2016
@nicolargo
Copy link
Owner Author

@notFloran Any news concerning the implementation inside the WebUI ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants