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

WPS vs AP mode #1

Open
ivomarino opened this issue Oct 17, 2021 · 2 comments
Open

WPS vs AP mode #1

ivomarino opened this issue Oct 17, 2021 · 2 comments
Assignees

Comments

@ivomarino
Copy link

ivomarino commented Oct 17, 2021

Hi and thanks for this great integration, on my OpenWRT instance I don't have WPS so I hade to disable this part in the code:

        macs = dict()
        for key, value in response['clients'].items():
            macs[key] = dict(signal=value.get("signal"))
        #response = await self._ubus.api_call(
        #    f"hostapd.{interface_id}",
        #    'wps_status',    
        #    dict()
        #)                           
        return dict(
            clients=len(macs),
            macs=macs,  
            # wps=response["pbc_status"] == "Active"
        ) 

I just have normal AP clients cause running in AP mode, like:

ubus call hostapd.wlan1 get_clients
{
	"freq": 2462,
	"clients": {
		"xx:xx:xx:xx:xx:xx": {
			"auth": true,
			"assoc": true,
			"authorized": true,
			"preauth": false,
			"wds": false,
			"wmm": true,
			"ht": true,
			"vht": false,
			"wps": false,
			"mfp": false,
			"rrm": [
				0,
				0,
				0,
				0,
				0
			],
			"aid": 2,
			"bytes": {
				"rx": 148449402,
				"tx": 8522063
			},
			"airtime": {
				"rx": 0,
				"tx": 0
			},
			"packets": {
				"rx": 153853,
				"tx": 99111
			},
			"rate": {
				"rx": 72200,
				"tx": 72200
			},
			"signal": -55,
			"capabilities": {
				
			}
		}
	}
}

would be great if we could add support also for this use case, thanks;)

@ivomarino
Copy link
Author

I also had to modify this to exclude radio2:

    async def discover_wireless(self) -> dict:
        result = dict(ap=[], mesh=[])
        if not self.is_api_supported("network.wireless"):
            return result
        try:
            response = await self._ubus.api_call('network.wireless', 'status', {})
            for radio, item in response.items():
                if radio != 'radio2':                          <--------------------------  modified here
                    for iface in item['interfaces']:
                        conf = dict(ifname=iface['ifname'],network=iface['config']['network'][0])
                        if iface['config']['mode'] == 'ap':
                            result['ap'].append(conf)
                        if iface['config']['mode'] == 'mesh':
                            conf['mesh_id'] = iface['config']['mesh_id']
                            result['mesh'].append(conf)
        except NameError as err:
            _LOGGER.warning(
                f"Device [{self._id}] doesn't support wireless: {err}")
        return result

radio2 is a device which ist not active on a wrt3200acm, it's added to the config on boot. This interface needs to be skipped, if not we get a Python KeyError

@kvj kvj self-assigned this Oct 23, 2021
@kvj
Copy link
Owner

kvj commented Oct 24, 2021

Hi,

on my OpenWRT instance I don't have WPS so I hade to disable this part in the code

I've made WPS support optional. Please fetch the latest version and re-add your device. (there should be WPS support checkbox)

radio2 is a device which ist not active on a wrt3200acm, it's added to the config on boot

if you're not using it, why it's not disabled in the config then?

if not we get a Python KeyError

Where exactly did you get this error?

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

No branches or pull requests

2 participants