What's new

How to get rssi for a mac address

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Teddyz

Occasional Visitor
Hi

My goal is to have a script that every 5 seconds checks rssi of a mac address, and if it increases from medium to strong, then sends me a message.

I have a similar script done to let me know if my wan ip has changed:
#!/bin/sh

#Pushover settings
pushover_token="secret" # Your access token here (https://pushover.net/api)
pushover_username="sci-class 4" # Pushover User ID (the user/group key (not e-mail address often referred to as USER_KEY)


OLD_IP=$(nvram get dick_old_ip)
#echo "<$OLD_IP>"
WROUTER_IP=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
#echo "<$WROUTER_IP>"


pushover_message () {
curl -s \
--form-string "token=$pushover_token" \
--form-string "user=$pushover_username" \
--form-string "message=New IP=$WROUTER_IP Old=$OLD_IP" \
https://api.pushover.net/1/messages.json
}

if [ "$OLD_IP" != "$WROUTER_IP" ]; then
pushover_message
nvram set dick_old_ip=$WROUTER_IP
fi

#nvram set dick_old_ip="for test, destroy value to force update"



My problem:
I cannot read the rssi.
dick@AX88U:/tmp# wl rssi 5C:CF:7F:B4:FA:D7
wl: Not Found
dick@AX88U:/tmp#


The device is available to see using the web interface:
upload_2019-10-7_20-37-31.png


1) What am I doing wrong?

Bonus questions:
2) Do I need to use nvram to keep the old ip address? Or is it possible to use som "static" variables, like in C?
3) How do I construct a limiter to have no more than one message, or one message per hour?
4) How can I more easily copy the mac address from the web page? It is very difficult in the box shown above.

My device:
RT-AX88U 384.13

Last:
Thanks!
 
This post suggests that the interface names are different on the AX88U compared to other models. Maybe you need to explicitly state the interface (which you would have to do anyway for devices connected to 5GHz).

Code:
wl -i eth6 rssi 5C:CF:7F:B4:FA:D7
 
Unfortunately it did not help. Thanks for trying! et6 and eth7 seems to be the only interfaces present. I hope I wrote the MAC address in a correct format.
Are there other commands I can try to get similar result?

And something I have thought of for a while, is there a way for the AP to ask any STA how good they receive it's signal?
 
The only device on 5G is my phone. I can only get rssi from it when specifying eth7. It does not work without -i eth7, as you say!
All the nodes I cannot get rssi from are ESP8266 running Arduino-code.

And to make it slightly more complicated; I have a RT-AC68 as a mesh node. It is far away from these Arduino nodes, but worth mentioning.
Close to the mesh-node is a RT-N66U configured as a repeater and connected to my mesh on 2.4GHz. It is also not possible get rssi from that node.
 
Does this command still work (i.e show the connected devices)?

wl -i eth6 assoclist
 
The only device on 5G is my phone. I can only get rssi from it when specifying eth7. It does not work without -i eth7, as you say!
All the nodes I cannot get rssi from are ESP8266 running Arduino-code.

And to make it slightly more complicated; I have a RT-AC68 as a mesh node. It is far away from these Arduino nodes, but worth mentioning.
Close to the mesh-node is a RT-N66U configured as a repeater and connected to my mesh on 2.4GHz. It is also not possible get rssi from that node.

Might be better to get RSSI reports directly from the ESP8266 nodes with your config - and it should work no matter which router/AP you would be using...

https://www.arduino.cc/en/Reference/WiFiRSSI
 
Does this command still work (i.e show the connected devices)?

wl -i eth6 assoclist

I get this reply:
ASUSWRT-Merlin RT-AX88U 384.13-0 Wed Jul 31 17:30:47 UTC 2019
dick@AX88U:/tmp/home/root# wl assoclist
assoclist E0:3F:49:EE:12:A1
dick@AX88U:/tmp/home/root#

I do not see this MAC on the web page. Is it the router's own?
 
I get this reply:
ASUSWRT-Merlin RT-AX88U 384.13-0 Wed Jul 31 17:30:47 UTC 2019
dick@AX88U:/tmp/home/root# wl assoclist
assoclist E0:3F:49:EE:12:A1
dick@AX88U:/tmp/home/root#

I do not see this MAC on the web page. Is it the router's own?
Are you sure your devices are connecting to this router and not the other router or repeater?

You can see the router's MAC addresses on the Network Map/System Status page.
 
Thanks, but that will not help in my case. The reason I want to see rssi is a bug that increase TX power in Arduino. https://github.com/esp8266/Arduino/issues/6620

Interesting...

This is easy to monitor via OpenWRT... I prefer that platform for IOT development, and the ath9k driver is pretty decent.

Code:
#! /bin/ash
ifaces="wlan0"

for iface in $ifaces
do
  echo $iface
  stations=`iw dev $iface station dump | grep Station | awk '{print $2}'`

  for sta in $stations
  do
    echo "------------------------------------------------------"
    iw dev $iface station get $sta
    echo -e "\t ---"
    grep $sta /proc/net/arp | awk '{print "\t IP: "$1" (from ARP table)"}'
    grep -i $sta /var/dhcp.leases | awk '{print "\t IP: "$3" (from DHCP Lease)\n\t NAME: "$4" (from DHCP Lease)"}'
  done
  echo "------------------------------------------------------"
done

output looks like this...

Code:
------------------------------------------------------
Station 9c:b6:d0:74:ef:e3 (on wlan0)
        inactive time:  0 ms
        rx bytes:       3017370
        rx packets:     17982
        tx bytes:       37686421
        tx packets:     30847
        tx retries:     4607
        tx failed:      0
        rx drop misc:   140
        signal:         -70 [-70] dBm
        signal avg:     -71 [-71] dBm
        tx bitrate:     65.0 MBit/s MCS 6 short GI
        tx duration:    9653302 us
        rx bitrate:     58.5 MBit/s MCS 6
        rx duration:    2800624 us
        airtime weight: 256
        expected throughput:    26.733Mbps
        authorized:     yes
        authenticated:  yes
        associated:     yes
        preamble:       short
        WMM/WME:        yes
        MFP:            no
        TDLS peer:      no
        DTIM period:    2
        beacon interval:100
        short preamble: yes
        short slot time:yes
        connected time: 2718 seconds
         ---
         IP: 192.168.0.140 (from ARP table)
         IP: 192.168.0.140 (from DHCP Lease)
         NAME: * (from DHCP Lease)
------------------------------------------------------
 
Are you sure your devices are connecting to this router and not the other router or repeater?

I know that my devices are connected to my AX88 router. My other router, that is in my only other mesh participant, is the one that has this MAC that I found using wl assoclist. It is placed three floors below my apartment.

upload_2019-10-8_20-20-11.png


So for now, I believe that using AiMesh costs the ability to read rssi via scripts.
It is not that important after all. :)

/Dick
 
So for now, I believe that using AiMesh costs the ability to read rssi via scripts.
Or detect them using assoclist. Very strange. Maybe the "wl" command is no longer appropriate for this model (or a mesh setup).

Last thought - Are the clients connecting to a guest network? I guess not as you're using a mesh network.
 
Or detect them using assoclist. Very strange. Maybe the "wl" command is no longer appropriate for this model (or a mesh setup).

Last thought - Are the clients connecting to a guest network? I guess not as you're using a mesh network.

Hmmm... wondering if the AIMesh stuff is getting in the way...

WL and AsusWRT is kinda closed - which is why I suggested looking at an OpenWRT solution on a supported chipset, as it does answer OP's needs.
 
Last thought - Are the clients connecting to a guest network? I guess not as you're using a mesh network.

Good point, thanks for mention it! Of course I am using a Guest network for them. Only reason is that I do not want to put my ssid/password on a flash memory that can easily be extracted and the password can then be read next to the ssid. And using my a MQTT-broker, I have no reason to have them on my (what's opposite of guest goes here) network.

Read out flash from ESP8266: esptool.py -p COM18 -b 230400 read_flash 0 0x200000 flash_contents.bin

So I added my tablet, and sure I could see its rssi. I did not know that guest networks were not included. Do they have their own eth:s where I can find rssi?
 
On most of the other models the guest interfaces are as follows.

wl0.1 = 2.4GHz guest SSID #1
wl0.2 = 2.4GHz guest SSID #2
wl0.3 = 2.4GHz guest SSID #3

wl1.1 = 5GHz guest SSID #1
wl1.2 = 5GHz guest SSID #2
wl1.3 = 5GHz guest SSID #3


I don't know whether it's still the same for your router. Doing an ifconfig -a should show the interface names.
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top