-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support client.getDeviceList #208
Comments
You can configure your router to statically assign an IP to your device as a quick workaround. Nevertheless, discovering all the Tapo devices on your network and/or Tapo Cloud account is a great feature to have. I'm not sure when I'll be able to add it, but if someone wants to have a crack at it, I'm happy to help. |
@mihai-dinculescu Thanks. I'm unable to assign static IP with Starlink but I had a workaround! Since each smart plug has a MAC address that is unchangeable but IP can be dynamic (due to restarting router). I noted down each smart plug MAC address & mapped them to corresponding IP output from arp-scan The command I use for
This makes sure to only output just IP & MAC address of the connected devices to my network making sure I always get the latest assigned IP for each device! e.g. output
I then converted the string output to json. I was able to do all of this in a python environment on my Raspberry Pi. Pretty happy with the result |
Hello, I wonder too if it is necessary too to add the login and password to manipulate lights in a local network? |
Hello - rather than pull this repo I'm just going to put my getDeviceList() implementation example here. It takes advantage of the fact we are in the asyncio world, so can take engage its timeout mechanism. It simply blasts all IP addresses concurrently! My assumption is that IF a Tapo device is going to respond, it will do so in 1 second. In practice it is instant, so after 1 second we dump any async task that has not completed. Of course, you can increase this as needed if your Tapo devices respond sluggishly.
Call it like this:
My output (after a just a couple of seconds of starting the script):
If you want to play nice on your network, then you can use a Semaphore. Here are the same functions adjusted to only allow 10 concurrent tasks by default in the task list to run concurrently. Adjust the 'limit' property in getDeviceList() to be more passive / aggressive:
Weakness to overcome:
|
Hi @mihai-dinculescu, first of all I want to show my gratitude to you for creating this package. I've been able to use it do some really cool stuff at home.
Request: I was thinking if there's a way to do
client.getDeviceList()
after initializing theApiClient
without having to supply the address of the different devices to e.g.client.p100("IP_ADDRESS_OF_DEVICE")
? This will enable programmatically getting the address of connected devices without having to supply it manuallyWhy? I have a cron job that periodically checks if a particular device is turned off to do some stuff but the problem I noticed after letting the cron run for about 10hrs is the script had crashed and the reason is because the IP address of that device had changed!
Device IP Address changes whenever router is rebooted
The text was updated successfully, but these errors were encountered: