Tapo changed its IP address now can't read it with Raspberry Pi

13»

Comments

  • Ok thanks, I'll just have to use a relay to switch my propagator on and off.
    The Tapo was handy as I could monitor how much electricity I was using and used an old car battery to power the raspberry pi.
  • MeteredOut
    MeteredOut Posts: 2,782 Forumite
    1,000 Posts Second Anniversary Name Dropper
    edited 12 February 2024 at 6:29PM
    How/when are you triggering the call? Have you considered, eg, HomeAssistant? The simple stuff can be set up with relatively basic technical knowledge, and it can read and control those devices.
  • import time
    from w1thermsensor import W1ThermSensor
    sensor = W1ThermSensor()
    from time import sleep

    from PyP100 import PyP110
    import json
    p110 = PyP110.P110("192.168.0.130"," "******com", "**********") #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


    print(p110.getEnergyUsage()) #Returns dict with all the energy usage
    while True:

       temperature = sensor.get_temperature()
       print("The temperature is %s celsius" % temperature)
       time.sleep(2)
       print(p110.getEnergyUsage()) #Returns dict with all the energy usage

       if temperature  >22:
           p110.turnOff() #Sends the turn off request
       sleep(5)
       else:

           p110.turnOn() #Sends the turn on request
           sleep(1)




  • MeteredOut
    MeteredOut Posts: 2,782 Forumite
    1,000 Posts Second Anniversary Name Dropper
    edited 13 February 2024 at 10:09AM
    Ah, ok, so its just a script running that'll turn off the switch if a temperature sensor is more than 22C. 

    Aside from you battering that API (every 3 or 7 seconds is probably more often than you needed it), there are probably better ways to do it. I don't know what temperature sensor you're using, but its very likely HomeAssistant will support it too and you could do the same within HA too, and have nice dashboards set up to display/automate much more in your home (if you're that way inlclined)
  • MeteredOut

    I installed HomeAssistant on my raspberry pi but it is not what I am looking for and though I can now control and view info about the Tapo on my PC that is not what I want as I cannot control it from my raspberry pi with a thermometer sensor connected to it.

    So the Tapo is now useless to me since it's last update.
    I'll have to find another smart socket I can control with python on a raspberry pi. 

    Thanks for trying to help.
    Back to the drawing board.

    p.s the code I posted wasn't the final version, that checked the temperature every 5 mins.

  • I contacted TP-link and they sent me a new smart plug after I returned my smart plug and the new one connects to my raspberry pi and does what it should.

    So the old one was faulty in some way.

  • MeteredOut
    MeteredOut Posts: 2,782 Forumite
    1,000 Posts Second Anniversary Name Dropper
    I contacted TP-link and they sent me a new smart plug after I returned my smart plug and the new one connects to my raspberry pi and does what it should.

    So the old one was faulty in some way.

    Same product/model/firmware as previously? 
  • JohnSwift10
    JohnSwift10 Posts: 444 Forumite
    Fourth Anniversary 100 Posts Photogenic Name Dropper
    Yes, same product/model/firmware as previously
  • EVandPV
    EVandPV Posts: 2,112 Forumite
    Fifth Anniversary 1,000 Posts Name Dropper
    edited 13 November 2024 at 10:51AM
    Bit late here with this but thought I'll post it anyway in case anyone has this problem.
    I just got a P100 and had the same issue as the OP with the python code.
    Turns out there's an update here which fixes the issue with newer firmware .... https://github.com/almottier/TapoP100
    Scott in Fife, 2.9kwp pv SSW facing, 2.7kw Fronius inverter installed Jan 2012 - 14.3kwh Seplos Mason battery storage with Lux ac controller - Renault Zoe 40kwh, Corsa-e 50kwh, Zappi EV charger and Octopus Go
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 349.8K Banking & Borrowing
  • 252.6K Reduce Debt & Boost Income
  • 453K Spending & Discounts
  • 242.8K Work, Benefits & Business
  • 619.6K Mortgages, Homes & Bills
  • 176.4K Life & Family
  • 255.7K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 15.1K Coronavirus Support Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.