I am trying to create a task which automatically disables mobile hotspot (tethering) when no device is connected. I successfully created similar tasks for bluetooth and wifi, however wifi mobile hotspot I seem not to able to get information on how to check if there are clients currently connected or when no client is connected. I researched a bit, a got a hint that this code :
ip neigh show dev wlan0 | grep -i -e reachable -e delay | grep
can give information on clients currently connected to hotspot.
This was the output in terminal:
u0_a209@hws8701:/ $ su -i -e reachable -e delay | grep -o' ..\:..\:..' < unknown option -- usage: grep [-abcDEFGHhIiJLlmnOoPqRSsUVvwxZz] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [pattern] [file ...]  + Done ip neigh show dev wlan0 | Stopped (signal) grep -i -e reachable -e delay | Done (2) grep -o" ..\\:..\\:.." 2|root@hws8701:/ #
however I don’t know how to manipulate this code to get more useful information to create a variable for zero clients connected.