jhubig/FritzBoxShell

any chance to get wifi clients from mesh repeater

dia-de-muertos opened this issue ยท 7 comments

Hi,
when I do a fritzBoxShell.sh WLAN_2G STATISTICS | grep -i NewTotalAssociations
I only get the number of clients directly connected to the Box (7590).
There's a AVM2400 repeater connected via mesh to the 7590.
Sadly I'm unable to grab the data from the repeater. fritzBoxShell always connects
to the FritzBox ant not the mesh-repeater.
In the FritzBox GUI, all WiFI clients are visible, also the ones connected via mesh.
Is the any chance to get the 'correct' number with fritzBoxShell?

jhubig commented

Hi,

sorry for my late answer. I have added a new function to get the full number of connected WLAN or LAN clients via the latest commit: b833510

Please download the latest files and run via

fritzBoxShell.sh MISC_LUA totalConnectionsWLAN

fritzBoxShell.sh MISC_LUA totalConnectionsLAN

Currently I'm not aware if the same can be achieved via the TR-064 protocol. For the moment I have used the AHA-HTTP-Interface. For me was quite slow (because my Fritz!Box 7490 is also not the newest ๐Ÿ˜€). Could you maybe try for you and let me know if it works? Thank you.

Cheers,
Johannes

Hello Johannes,
thanks for the feature.
Sadly it doesn't work for me.
First, there is a typo in the help text: totalConnectsionWLAN instead of totalConnectionsWLAN
Second, I get this error:

# ./fritzBoxShell.sh MISC_LUA totalConnectionsWLAN
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
.data.net.devices.[] | select(.type=="wlan" ) | length
jq: 1 compile error
0
# 

Any hints?

jhubig commented

Which version of jq do you have installed? Where do you run your scripts?

jq --version
jq-1.7.1

Thanks for the typo.

It's version 1.6 on debian 12.4
Quick and (very) dirty hack for me:

totalConnectionsWLAN2G=$(wget -O - --post-data "xhr=1&sid=$SID&page=overview&xhrId=first&noMenuRef=1" "http://$BoxIP/data.lua" 2>/dev/null | grep -ow '"desc":"2,4 GHz"' | wc -l)
totalConnectionsWLAN5G=$(wget -O - --post-data "xhr=1&sid=$SID&page=overview&xhrId=first&noMenuRef=1" "http://$BoxIP/data.lua" 2>/dev/null | grep -ow '"desc":"5 GHz"' | wc -l)
totalConnectionsWLANguest=$(wget -O - --post-data "xhr=1&sid=$SID&page=overview&xhrId=first&noMenuRef=1" "http://$BoxIP/data.lua" 2>/dev/null | grep -ow '"guest":true,"online"' | wc -l)
jhubig commented

The whole FritzBoxShell is a bit quick and dirty ๐Ÿ˜€

Maybe linked to jq? On my debian system (jq 1.5) it also doesn't work.

I guess we continue with the quick & dirty approach ๐Ÿ˜€. Did a new commit with your solution. Thanks.

Thanks for the quick implementation. Works as expected now.
Just a cosmetic fix (useless use of cat):

totalConnectionsWLAN2G=$(grep -ow '"desc":"2,4 GHz"' <<< $overview | wc -l)
totalConnectionsWLAN5G=$(grep -ow '"desc":"5 GHz"' <<< $overview | wc -l)
totalConnectionsWLANguest=$(grep -ow '"guest":true,"online"' <<< $overview | wc -l)
jhubig commented

Done. Thanks.
0725289