Tapo p110 Switched on and off every 5 Minutes?

I have a Tapo p110 connected to a heating mat in a propagator and a raspberry pi which sends a signal every five minutes to either switch on or switch off the p110 depending on the temperature.

Such as if it is less than 20 deg C every 5 minutes a signal is sent to turn it on and if it is more than 20 deg C a signal is sent every is sent every 5 minutes to switch it off.

Since the propagator is indoors the temperature can be above 20 deg C for the whole day.

Will this cause any problems with the tapo p110 being told to switch off every 5 minutes even if it is off? 
«1

Comments

  • teaselMay
    teaselMay Posts: 567 Forumite
    500 Posts Name Dropper
    Can you not write into your code to check previous signal and only send a signal if the new signal is different to the previous one?
  • vacheron
    vacheron Posts: 2,065 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Photogenic
    edited 5 February at 2:43PM
    Off when off, or on when on won't cause the hardware any problems. 

    As above my tapo 110's are connected using conditional statements,

     ie.
    If temp > 20 degrees AND Tapo is on, then tapo = OFF
    If temp < 20 degrees AND Tapo is off, then tapo = ON
    • The rich buy assets.
    • The poor only have expenses.
    • The middle class buy liabilities they think are assets.
    Robert T. Kiyosaki
  • JohnSwift10
    JohnSwift10 Posts: 443 Forumite
    Fourth Anniversary 100 Posts Photogenic Name Dropper
    vacheron said:
    Off when off, or on when on won't cause the hardware any problems. 

    As above my tapo 110's are connected using conditional statements,

     ie.
    If temp > 20 degrees AND Tapo is on, then tapo = OFF
    If temp < 20 degrees AND Tapo is off, then tapo = ON
    As most of my code is lifted from what others have published on the web  :) as at my age I can't code very well and usually get my son to do it but he is away at the moment, how do I convert your code so I can use it as I don't know how to get my pi to know whether the tapo is off or on?

    This is what I have at present

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

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

  • forgotmyname
    forgotmyname Posts: 32,852 Forumite
    Part of the Furniture 10,000 Posts Name Dropper
    edited 5 February at 4:36PM
    I think your using the wrong device.  I think it's going to have a short lifespan because it uses a relay.  Use a PID controller and an SSR instead.

    I have the same setup for several hobby items, seed propogator, small toaster oven for fimo clay and low temperature enamel
    and then upto the furnaces for melting metals that will reach 1800ºC.

    The PID controllers are smart and over time they calculate how long it takes to heat back up to the set temperature and they keep the
    temperature super stable.  They are cheap also your only looking at low temperatures.

    Censorship Reigns Supreme in Troll City...

  • JohnSwift10
    JohnSwift10 Posts: 443 Forumite
    Fourth Anniversary 100 Posts Photogenic Name Dropper
    I think your using the wrong device.  I think it's going to have a short lifespan because it uses a relay.  Use a PID controller and an SSR instead.

    I have the same setup for several hobby items, seed propogator, small toaster oven for fimo clay and low temperature enamel
    and then upto the furnaces for melting metals that will reach 1800ºC.

    The PID controllers are smart and over time they calculate how long it takes to heat back up to the set temperature and they keep the
    temperature super stable.  They are cheap also your only looking at low temperatures.

    You may be correct because the one I was using last year failed and I had to buy a replacement 

    However they are less than £10 so not all that expensive in the big picture and they tell me how much electricity I use.

    Any suggestions for a replacement I can control with a raspberry pi and store electricity usage?
  • vacheron
    vacheron Posts: 2,065 Forumite
    Part of the Furniture 1,000 Posts Name Dropper Photogenic
    edited 5 February at 6:01PM
    Given at the Tapos are about £20 and a normal relay will act last for at least 100,000 cycles, Even 50 on-off cycles per day should still last about 6 years, then you just buy another one..

    OP, does the thing that you’re measuring really have to be so accurate that you keep it within +/- half a degree of accuracy?

    If you added some hysteresis (for example turning on below 18 and turning off above 22) You could hugely reduce the number of on off cycles per day? 


    • The rich buy assets.
    • The poor only have expenses.
    • The middle class buy liabilities they think are assets.
    Robert T. Kiyosaki
  • forgotmyname
    forgotmyname Posts: 32,852 Forumite
    Part of the Furniture 10,000 Posts Name Dropper
    edited 5 February at 11:32PM
    The tapo's have a habit of failing after a year or so.   SSR's are rated for millions of on/off cycles not 100,000's.

    You can get the PID and SSR for under £20.   You can control the SSR via an arduino or Pi also.  Just removing the
    Tapo from the circuit will increase reliability.

    REX-C100's generally come in kits upto 400ºC and as I mentioned they are smart and can pulse the heat on and off
    much faster than a relay without wear and tear issues whilst keeping the temperature exactly where you need it.

    Use the Tapo but it stays on 24/7 and can measure the power used, best of both worlds and the Tapo not switching
    on/off means it will last a lot longer.


    Censorship Reigns Supreme in Troll City...

  • bob2302
    bob2302 Posts: 526 Forumite
    500 Posts Second Anniversary Name Dropper
    vacheron said:
    Given at the Tapos are about £20 and a normal relay will act last for at least 100,000 cycles, Even 50 on-off cycles per day should still last about 6 years, then you just buy another one..


    If you added some hysteresis (for example turning on below 18 and turning off above 22) You could hugely reduce the number of on off cycles per day? 


    They are currently £9.99 at Argos or £7.50  each in boxes of 4.  The price of single p110s fluctuates a bit though, I got my last for £8.99.

    As regards the code I'd leave it. I does  no harm and it's potentially a little more robust.
  • GDB2222
    GDB2222 Posts: 25,952 Forumite
    Part of the Furniture 10,000 Posts Photogenic Name Dropper
    edited 6 February at 9:59PM
    I asked ChatGPT your question, and this is what it said:

    To check whether the Tapo P110 is already on or off before sending a command, you need to:

    1. Retrieve the current state of the Tapo smart plug before issuing turnOn() or turnOff().
    2. Only send a command if the state needs to change (i.e., avoid redundant API calls).

    Assuming p110.getState() returns True if the plug is ON and False if it's OFF, here's how you can modify your code:

    import time  


    while True:

        current_state = p110.getState()  # Check if the plug is on or off


        if temperature > 20 and current_state:  

            print("Plug is already OFF, no action needed.")  

        elif temperature > 20 and not current_state:  

            print("Turning plug OFF...")  

            p110.turnOff()  


        elif temperature <= 20 and not current_state:  

            print("Plug is already ON, no action needed.")  

        elif temperature <= 20 and current_state:  

            print("Turning plug ON...")  

            p110.turnOn()  


        time.sleep(600)  # Wait for 10 minutes before checking again




    No reliance should be placed on the above! Absolutely none, do you hear?
  • GDB2222
    GDB2222 Posts: 25,952 Forumite
    Part of the Furniture 10,000 Posts Photogenic Name Dropper
    You could just try out ChatGPT's  code and see whether it works. No guarantees, of course, but it's unlikely to cause a major calamity.


    No reliance should be placed on the above! Absolutely none, do you hear?
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.7K Work, Benefits & Business
  • 619.5K Mortgages, Homes & Bills
  • 176.4K Life & Family
  • 255.6K 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.