Why is my smart plug on out of time frame?


#1

1) Give a description of the problem
The smart plug is on out of the specified time
2) What is the expected behavior?
The smart plug should only be on between 6PM-10PM.
3) What is happening/not happening?
It’s been on for 17 hours since morning according to the webcore script.
**4) Post a Green Snapshot of the piston!


#2

You only have a condition to turn on your outlet. You need another condition to turn it off. You can make a simple timers repeat daily at 6 pm to turn on and repeat daily at 10 pm to turn off to accomplish what you want.


#3

I see. I thought “between” means it’ll turn on at 6PM and turn off 10PM. I guess that’s not the case then. Thanks!


#4

Okay, this is what I have. My problem right now is that when the temperature reach 68 degree or greater the smart plug did not turn off. Any suggestion?


#5

Oh, never mind, looks like I forgot to turn off the smart plug in the “then” section.


#6

Okay, so it’s not working as expected. It should turned on when the temperature is 68 degrees or colder and only after 6PM but it’s not.


#7

I would code something like this:

IF Keypad's temperature DROPS BELOW 68°  <-- Trigger
and
Time is after 6PM                        <-- Condition
    Then Turn on Outlet
END IF

IF Keypad's temperature RISES ABOVE 68°  <-- Trigger
    Then Turn off Outlet
END IF

Every day at 11PM                        <-- Trigger
    Turn off Outlet
END EVERY

#8

WCmore, many thanks for the help. I gave your suggestion a tried and this is what I have. However, perhaps something is wrong in my code or what because the smart plug did not turn on at 6PM even though the room temperature is 64 degrees.


#9

Hmmm… I don’t know if it matters, but in an IF statement, I always put the trigger first, and the condition second… I am tempted to switch lines 18 & 20 in your last screenshot…


The other possibility is:
If the temperature dropped during the day, and then an hour later the time turned to 6PM, it would not fire with the current wording.

If this was what happened, you can add a tiny block like this:

Every day at 6PM                         <-- Trigger
do
    IF Keypad's temperature is below 72  <-- Condition
        Then Turn on Outlet
    END IF
END EVERY

#10

This is what I have. The outlet turns off at 11PM but it’s not turning on at 6PM.


#11

I think the problem is in line 20. For some reason it does not recognize the drops below.


#12

I think I over complicated this thing. I don’t need the IF statement within the every day at 6PM since I already have the IF statement in line 29. The outlet will only turn on if it is below 71F else it’ll turn off. I’ll try that tonight.


#13

Yes, you are right! (it didn’t work because you changed the wording from my earlier suggestion) Each block of code should have no more than one trigger, with conditions following that. To clarify:

  • A trigger inside a trigger will never fire.
  • A condition inside a trigger will fire if true

Long story short:
Never put a trigger inside another trigger.


For example, either of these blocks will execute if the conditions are right:

IF Keypad's temperature DROPS BELOW 70°  <-- Trigger (precise moment)
and
Time is after 6PM                        <-- Vague Condition

or

Every day at 6PM                         <-- Trigger (precise moment)
    IF Keypad's temp IS below 70°        <-- Vague Condition

#14

Okay, so this is what I have. Why is it that my outlet turns on around 3PM and also get 6PM everyday? I’m quite confused.


#15

The only “Turn on” command in this piston is at 6PM.
That is the only time this piston will turn the device on.

If the device is turning on at any other time, there is probably some old programming still in effect…
(another piston, SmartApp, routines etc)


#16

That is why I was quite puzzled. Thank you for the response. I’ll check if there is anything else that is triggering this outlet then. Again, thank you so much for the help.