We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
Tapo changed its IP address now can't read it with Raspberry Pi

JohnSwift10
Posts: 443 Forumite

in Techie Stuff
I have a python program that reads the details from my Tapo P110 smart socked, well it used to until until I got a new router and left the socket unplugged for a while.
Now the socket has a new IP address and even though I change the IP address in my program the program will no longer run.
Anyone had this problem and found a solution?
from PyP100 import PyP110
Now the socket has a new IP address and even though I change the IP address in my program the program will no longer run.
Anyone had this problem and found a solution?
from PyP100 import PyP110
p110 = PyP110.P110("192.168.X.X", "email@gmail.com", "Password123") #Creating a P110 plug object
p110.handshake() #Creates the cookies required for further methods
p110.login() #Sends credentials to the plug and creates AES Key and IV for further methods
#PyP110 has all PyP100 functions and additionally allows to query energy usage infos
p110.getEnergyUsage() #Returns dict with all the energy usage
0
Comments
-
Have you looked in the control panel of the router? With some you can specify that certain devices are assigned fixed IPs and therefore you could revert it back to the old IP address.0
-
Assuming you've double-checked the new IP address is correct, it should work.
Any firewall on the new router? What protocol/port does the PyP110 library use to communicate with the device. HTTP? HTTPS?
What network error does the program provide when it tries to connect?0 -
Here is the error messageTraceback (most recent call last):File "/home/pi/tapo/p110.py", line 9, in <module>p110.handshake() #Creates the cookies required for further methodsFile "/usr/local/lib/python3.9/dist-packages/PyP100/PyP100.py", line 129, in handshakeencryptedKey = r.json()["result"]["key"]KeyError: 'result'0
-
Put a DHCP reservation in the router for the device (you'll need the MAC address) to fix it's IP address. Can you ping it?
Kind Regards,
Bill0 -
Possible firmware update on the plug preventing this method now working?4.29kWp Solar system, 45/55 South/West split in cloudy rainy Cumbria.0
-
JohnSwift10 said:Here is the error messageTraceback (most recent call last):File "/home/pi/tapo/p110.py", line 9, in <module>p110.handshake() #Creates the cookies required for further methodsFile "/usr/local/lib/python3.9/dist-packages/PyP100/PyP100.py", line 129, in handshakeencryptedKey = r.json()["result"]["key"]KeyError: 'result'
Have you checked you have the latest package?0 -
MeteredOut said:JohnSwift10 said:Here is the error messageTraceback (most recent call last):File "/home/pi/tapo/p110.py", line 9, in <module>p110.handshake() #Creates the cookies required for further methodsFile "/usr/local/lib/python3.9/dist-packages/PyP100/PyP100.py", line 129, in handshakeencryptedKey = r.json()["result"]["key"]KeyError: 'result'
Have you checked you have the latest package?
PyP100 · PyPI
I think it stopped working because I got my router replaced by Virgin Media when I was upgraded from 132 mbs to 1000 mbs fibre.which probably caused the IP address change which has probably nothing to do with the code no longer working.
0 -
If it stopped working the very day you changed ISPs, that is the most likely root cause. I asked above - is there firewall settings in the new router that is stopping the comms?0
-
MeteredOut said:If it stopped working the very day you changed ISPs, that is the most likely root cause. I asked above - is there firewall settings in the new router that is stopping the comms?
If it is relevant the app on my phone, tablet and bluestacks app on my computer all work OK.0 -
I agree with MeteredOut. The code does not handle the exception - it always assumes it can extract the encryption key from the response.So the easiest way to find out what's going on is to find out what the response is. It's probably going to be either blank/empty, or an error message, or an empty JSON structure.It might be interesting to visit the address it's trying to connect to using a web browser, i.e. http:// (the Tapo's IP here) /app to see what happens.0
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 349.8K Banking & Borrowing
- 252.6K Reduce Debt & Boost Income
- 453K Spending & Discounts
- 242.7K Work, Benefits & Business
- 619.5K Mortgages, Homes & Bills
- 176.3K Life & Family
- 255.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 15.1K Coronavirus Support Boards