Open preintel opened 6 months ago
Also would like to get any devices labeled as "wired" connection in addition to 5Ghz, for some reason the TP-Link router switches devices between 2.4Ghz, 5Ghz and even wired (while they are only wireless connected) so ideally I want to get a list of ALL current connected devices to the router.
@preintel You may use this code:
from tplinkrouterc6u import TplinkRouter, Connection
from logging import Logger
router = TplinkRouter('192.168.0.1', 'password', logger=Logger('test'))
router.authorize()
status = router.get_status()
for device in status.devices:
if device.type in [Connection.HOST_5G, Connection.GUEST_5G, Connection.IOT_5G]:
# do something with 5G connected device
if device.type == Connection.WIRED:
// do something with wired connected device
router.logout()
@AlexandrErohin thanks for the reply, I was able to get all the devices info with the below code However how can I get the leasetime by device as there is no device.lease_time property in the documentation. When I use the IPv4DHCPLease.lease_time it only shows the lease times of the devices connected to 2.4Ghz wifi only.
for device in status.devices:
print(f"{device.macaddr} {device.ipaddr:16s} {device.hostname:36}")
I am able to use the python script to get all the 2.4Ghz network connected devices list using the included script however I am not sure how I can also request the 5Ghz connected devices or if I need a separate script to run for them? I am running the script on an Archer AX73 TP-Link AX5400 Version 2.0 Firmware 1.1.0.