TransWikia.com

raspberry pi access point status

Raspberry Pi Asked by Aayush Lakkad on January 4, 2022

I have created an access point on my raspberry pi, now I wish write a python program to check if an access point has been created or not? is it possible to know through command line or python library. If yes, how?
Thank you

One Answer

I don't know if there is a library function to check if there is an access point created or not. But on the command line you can use iw or wpa_cli. iw is more generic, with wpa_cli you have to specify the interface name, but you can get more details if needed.

rpi ~$ iw dev | grep 'type AP'
        type AP

# or just check for the return code:
rpi ~$ iw dev | grep --quiet 'type AP'
rpi ~$ echo $?
0

rpi ~$ wpa_cli -iwlan0 status | grep 'mode=AP'
mode=AP

# or just check for the return code:
rpi ~$ wpa_cli -iwlan0 status | grep --quiet 'mode=AP'
rpi ~$ echo $?
0

Answered by Ingo on January 4, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP