[PYTHON] Display the signal strength RSSI of a specific SSID (raspberry pi (linux))

rasbperry pi has iwconfig, but I want the strength of the SSID that is not currently connected, so I will create it. :::cd ../../usr/local/bin :::sudo nano getsi

getsi


#!/bin/sh
sudo iwlist wlan0 scan | grep -e ESSID -e Quality

:::sudo chmod a+x getsi It should be done. ↓ Easier method (Since alias did not work on the system I want to make, I will leave the above as well)

[Display the signal strength of a specific SSID (mac)] By using the alias command, which was pointed out in the comment of [a], the above command registration work becomes unnecessary.
alias getsi="sudo iwlist wlan0 scan | grep -e ESSID -e Quality"

Yes, this completes getsi registration (early)

Hit getsi to confirm.

test.py


import subprocess as spc
res=spc.check_output("getsi")
lis=res.split()
ss=lis.index('ESSID:"The SSID you want to find"')
ss=ss-2
ra=lis[ss].split("=")
RSSI=abs(int(ra[1]))
print RSSI

It is the same as mac, and the closer it is to 0, the better the signal strength.

Just run the command on python and format the output (forced)

If alias doesn't work, unalias getsiIf you delete the command with and write it in the path as shown above, it should work.

Recommended Posts

Display the signal strength RSSI of a specific SSID (raspberry pi (linux))
Display the signal strength RSSI of a specific SSID (mac)
Raspberry Pi --1 --First time (Connect a temperature sensor to display the temperature)
Measure SIM signal strength with Raspberry Pi
Measure the relevance strength of a crosstab
A quick overview of the Linux kernel
Python code to determine the monthly signal of a relative strength investment
Connect to the console of Raspberry PI and display local IP and SD information
How to make a Raspberry Pi that speaks the tweets of the specified user
When a file is placed in the shared folder of Raspberry Pi, the process is executed.
Display images taken with the Raspberry Pi camera module
Take the value of SwitchBot thermo-hygrometer with Raspberry Pi
Log the value of SwitchBot thermo-hygrometer with Raspberry Pi
Make a note of what you want to do in the future with Raspberry Pi
Control the display of RGB LED matirix electric bulletin board freely with Raspberry Pi 3B +
Avoiding the pitfalls of using a Mac (for Linux users?)
Get the number of specific elements in a python list
Create a partition and then install the Raspberry Pi OS
A rough summary of the differences between Windows and Linux
Mac Linux Check the capacity directly under a specific directory
Is there a secret to the frequency of pi numbers?
I sent the data of Raspberry Pi to GCP (free)
A program that receives the servo command of the radio control, interrupts the Raspberry Pi and logs it
A brief summary of Linux
How to display a specified column of files in Linux (awk)
Control the motor with a motor driver using python on Raspberry Pi 3!
pandas Fetch the name of a column that contains a specific character
I tried to automate the watering of the planter with Raspberry Pi
On Linux, the time stamp of a file is a little past.
How to output the output result of the Linux man command to a file
Make a Kanji display compass with Raspberry Pi and Sense Hat
Graph display of household power consumption with 3GPI and Raspberry Pi
Periodically log the value of Omron environment sensor with Raspberry Pi
Building a distributed environment with the Raspberry PI series (Part 1: Summary of availability of diskless clients by model)